mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-05 13:07:44 +03:00
Adjust blur factors
This commit is contained in:
parent
e34836ca86
commit
962ddf2a42
@ -200,11 +200,11 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
variance = cv2.Laplacian(input, cv2.CV_64F).var()
|
variance = cv2.Laplacian(input, cv2.CV_64F).var()
|
||||||
|
|
||||||
if variance < 60: # image is very blurry
|
if variance < 60: # image is very blurry
|
||||||
return 0.85
|
return 0.96
|
||||||
elif variance < 70: # image is kind of blurry
|
elif variance < 70: # image moderately blurry
|
||||||
return 0.9
|
return 0.98
|
||||||
elif variance < 80:
|
elif variance < 80: # image is slightly blurry
|
||||||
return 0.95
|
return 0.99
|
||||||
else:
|
else:
|
||||||
return 1.0
|
return 1.0
|
||||||
|
|
||||||
@ -248,8 +248,13 @@ class FaceRealTimeProcessor(RealTimeProcessorApi):
|
|||||||
if not self.recognizer:
|
if not self.recognizer:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# face recognition is best run on grayscale images
|
||||||
img = cv2.cvtColor(face_image, cv2.COLOR_BGR2GRAY)
|
img = cv2.cvtColor(face_image, cv2.COLOR_BGR2GRAY)
|
||||||
|
|
||||||
|
# get blur factor before aligning face
|
||||||
blur_factor = self.__get_blur_factor(img)
|
blur_factor = self.__get_blur_factor(img)
|
||||||
|
|
||||||
|
# align face and run recognition
|
||||||
img = self.__align_face(img, img.shape[1], img.shape[0])
|
img = self.__align_face(img, img.shape[1], img.shape[0])
|
||||||
index, distance = self.recognizer.predict(img)
|
index, distance = self.recognizer.predict(img)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user