Skip to content

Commit 784f8a8

Browse files
authored
Cytation focus inner 50% of image (#654)
1 parent b89c767 commit 784f8a8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pylabrobot/plate_reading/biotek_backend.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,15 @@ async def evaluate_focus(focus_value):
920920
f"cv2 needs to be installed for auto focus. Import error: {_CV2_IMPORT_ERROR}"
921921
)
922922

923+
# cut out 25% on each side
924+
np_image = np.array(image, dtype=np.float64)
925+
height, width = np_image.shape[:2]
926+
crop_height = height // 4
927+
crop_width = width // 4
928+
np_image = np_image[crop_height : height - crop_height, crop_width : width - crop_width]
929+
923930
# NVMG: Normalized Variance of the Gradient Magnitude
924931
# Chat invented this i think
925-
np_image = np.array(image, dtype=np.float64)
926932
sobel_x = cv2.Sobel(np_image, cv2.CV_64F, 1, 0, ksize=3)
927933
sobel_y = cv2.Sobel(np_image, cv2.CV_64F, 0, 1, ksize=3)
928934
gradient_magnitude = np.sqrt(sobel_x**2 + sobel_y**2)

0 commit comments

Comments
 (0)