@@ -71,9 +71,9 @@ def crop_image(im, settings):
71
71
return results
72
72
73
73
def focal_point (im , settings ):
74
- corner_points = image_corner_points (im , settings )
75
- entropy_points = image_entropy_points (im , settings )
76
- face_points = image_face_points (im , settings )
74
+ corner_points = image_corner_points (im , settings ) if settings . corner_points_weight > 0 else []
75
+ entropy_points = image_entropy_points (im , settings ) if settings . entropy_points_weight > 0 else []
76
+ face_points = image_face_points (im , settings ) if settings . face_points_weight > 0 else []
77
77
78
78
pois = []
79
79
@@ -144,7 +144,7 @@ def image_face_points(im, settings):
144
144
settings .dnn_model_path ,
145
145
"" ,
146
146
(im .width , im .height ),
147
- 0.8 , # score threshold
147
+ 0.9 , # score threshold
148
148
0.3 , # nms threshold
149
149
5000 # keep top k before nms
150
150
)
@@ -159,7 +159,7 @@ def image_face_points(im, settings):
159
159
results .append (
160
160
PointOfInterest (
161
161
int (x + (w * 0.5 )), # face focus left/right is center
162
- int (y + (h * 0 )), # face focus up/down is close to the top of the head
162
+ int (y + (h * 0.33 )), # face focus up/down is close to the top of the head
163
163
size = w ,
164
164
weight = 1 / len (faces [1 ])
165
165
)
@@ -207,7 +207,7 @@ def image_corner_points(im, settings):
207
207
np_im ,
208
208
maxCorners = 100 ,
209
209
qualityLevel = 0.04 ,
210
- minDistance = min (grayscale .width , grayscale .height )* 0.03 ,
210
+ minDistance = min (grayscale .width , grayscale .height )* 0.06 ,
211
211
useHarrisDetector = False ,
212
212
)
213
213
@@ -256,8 +256,8 @@ def image_entropy_points(im, settings):
256
256
257
257
def image_entropy (im ):
258
258
# greyscale image entropy
259
- band = np .asarray (im .convert ("L" ))
260
- # band = np.asarray(im.convert("1"), dtype=np.uint8)
259
+ # band = np.asarray(im.convert("L"))
260
+ band = np .asarray (im .convert ("1" ), dtype = np .uint8 )
261
261
hist , _ = np .histogram (band , bins = range (0 , 256 ))
262
262
hist = hist [hist > 0 ]
263
263
return - np .log2 (hist / hist .sum ()).sum ()
0 commit comments