mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-08-24 07:06:20 -07:00
Add files via upload
in BlurEstimatorSubprocessor, instead of masked image, full aligned image is taken for sharpness estimation in estimate_sharpness, laplacian function for the given image is the return value
This commit is contained in:
parent
97b6fabaab
commit
0069dd500a
1 changed files with 752 additions and 764 deletions
|
@ -22,16 +22,7 @@ def estimate_sharpness(image):
|
|||
if image.ndim == 3:
|
||||
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
||||
|
||||
sharpness = 0
|
||||
for y in range(height):
|
||||
for x in range(width-1):
|
||||
sharpness += abs( int(image[y, x]) - int(image[y, x+1]) )
|
||||
|
||||
for x in range(width):
|
||||
for y in range(height-1):
|
||||
sharpness += abs( int(image[y, x]) - int(image[y+1, x]) )
|
||||
|
||||
return sharpness
|
||||
return cv2.Laplacian(image, cv2.CV_64F).var()
|
||||
|
||||
|
||||
class BlurEstimatorSubprocessor(Subprocessor):
|
||||
|
@ -54,9 +45,6 @@ class BlurEstimatorSubprocessor(Subprocessor):
|
|||
|
||||
if dflimg is not None:
|
||||
image = cv2_imread( str(filepath) )
|
||||
image = ( image * \
|
||||
LandmarksProcessor.get_image_hull_mask (image.shape, dflimg.get_landmarks()) \
|
||||
).astype(np.uint8)
|
||||
return [ str(filepath), estimate_sharpness( image ) ]
|
||||
else:
|
||||
self.log_err ("%s is not a dfl image file" % (filepath.name) )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue