@@ -65,6 +65,7 @@ def __init__(
6565 min_area_pixels: Minimum area in pixels.
6666 max_area_pixels: Maximum area in pixels.
6767 min_brightness_threshold: Minimum brightness threshold for bright spots.
68+ min_average_brightness_threshold: Minimum absolute average brightness of detected blobs.
6869 """
6970 self .brightspot_percentile_threshold = brightspot_percentile_threshold
7071 self .filter_by_color = filter_by_color
@@ -150,12 +151,9 @@ def run(
150151 grey_image , combined_threshold , 255 , cv2 .THRESH_BINARY
151152 )
152153 if threshold_used == 0 :
153- self .__local_logger .error (f" { time . time () } : Failed to percentile threshold image." )
154+ self .__local_logger .error (" Failed to percentile threshold image." )
154155 return False , None
155156
156- # cv2.imshow("Thresholded", bw_image) # type: ignore
157- # cv2.waitKey(0) # type: ignore
158-
159157 # Set up SimpleBlobDetector
160158 params = cv2 .SimpleBlobDetector_Params ()
161159 params .filterByColor = self .__config .filter_by_color
@@ -178,9 +176,7 @@ def run(
178176
179177 # A lack of detections is not an error, but should still not be forwarded
180178 if len (keypoints ) == 0 :
181- self .__local_logger .info (
182- f"{ time .time ()} : No brightspots detected (before blob average filter)."
183- )
179+ self .__local_logger .info ("No brightspots detected (before blob average filter)." )
184180 return False , None
185181
186182 # Compute the average brightness of each blob
@@ -221,16 +217,9 @@ def run(
221217
222218 # A lack of detections is not an error, but should still not be forwarded
223219 if len (filtered_keypoints ) == 0 :
224- self .__local_logger .info (
225- f"{ time .time ()} : No brightspots detected (after blob average filter)."
226- )
220+ self .__local_logger .info ("No brightspots detected (after blob average filter)." )
227221 return False , None
228222
229- # Annotate the image (green circle) with detected keypoints
230- image_annotated = cv2 .drawKeypoints (
231- image , filtered_keypoints , None , (0 , 255 , 0 ), cv2 .DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS
232- )
233-
234223 # Process bright spot detection
235224 result , detections = detections_and_time .DetectionsAndTime .create (data .timestamp )
236225 if not result :
@@ -269,6 +258,15 @@ def run(
269258 if self .__filename_prefix != "" :
270259 filename = self .__filename_prefix + str (self .__counter )
271260
261+ # Annotate the image (green circle) with detected keypoints
262+ image_annotated = cv2 .drawKeypoints (
263+ image ,
264+ filtered_keypoints ,
265+ None ,
266+ (0 , 255 , 0 ),
267+ cv2 .DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS ,
268+ )
269+
272270 # Annotated image
273271 cv2 .imwrite (filename + ".png" , image_annotated ) # type: ignore
274272
0 commit comments