Removed cv2 resize

This commit is contained in:
Chish36 2025-08-06 14:50:17 +01:00 committed by Julian Stirling
parent 3a0961e9dc
commit 1afaa53413

View file

@ -125,9 +125,7 @@ def _move_and_measure(
wrong_axis = "x" wrong_axis = "x"
if autofocus_proc: if autofocus_proc:
autofocus.looping_autofocus(dz=800) autofocus.looping_autofocus(dz=800)
image2 = cv2.resize( image2 = np.array(Image.open(cam.grab_jpeg().open()))
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
)
offset = fft_image_tracking.displacement_between_images( offset = fft_image_tracking.displacement_between_images(
image_0=image1, image_1=image2, sigma=10, fractional_threshold=0.1, pad=True image_0=image1, image_1=image2, sigma=10, fractional_threshold=0.1, pad=True
) # Units is pixels ) # Units is pixels
@ -166,9 +164,7 @@ def _acquire_z_predict_points(
medium_step, stream_resolution, direction, factor=0.1 medium_step, stream_resolution, direction, factor=0.1
) )
for _loop in range(5): for _loop in range(5):
image1 = cv2.resize( image1 = np.array(Image.open(cam.grab_jpeg().open()))
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
) # Captures image with option to resize
offset, wrong_axis = _move_and_measure( offset, wrong_axis = _move_and_measure(
step_size=_generate_move_dicts(medium_step, stream_resolution, direction), step_size=_generate_move_dicts(medium_step, stream_resolution, direction),
axis=axis, axis=axis,
@ -226,9 +222,7 @@ def _check_stage_operation(
failure_count = 0 failure_count = 0
for _loop in range(3): for _loop in range(3):
image1 = cv2.resize( image1 = np.array(Image.open(cam.grab_jpeg().open()))
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
)
offset, wrong_axis = _move_and_measure( offset, wrong_axis = _move_and_measure(
step_size=_generate_move_dicts(small_step, stream_resolution, direction), step_size=_generate_move_dicts(small_step, stream_resolution, direction),
axis=axis, axis=axis,
@ -250,9 +244,7 @@ def _check_stage_operation(
f"Correlation failed. Refocusing to check. Attempt {failure_count + 1}/3" f"Correlation failed. Refocusing to check. Attempt {failure_count + 1}/3"
) )
autofocus.looping_autofocus(dz=1000) autofocus.looping_autofocus(dz=1000)
image2 = cv2.resize( image2 = np.array(Image.open(cam.grab_jpeg().open()))
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
)
failure_count += 1 failure_count += 1
offset = fft_image_tracking.displacement_between_images( offset = fft_image_tracking.displacement_between_images(
image_0=image1, image_0=image1,
@ -313,13 +305,9 @@ def _motion_detection(
for loop in range(np.shape(displacements)[0]): for loop in range(np.shape(displacements)[0]):
this_motion_step[axis] = displacements[loop] * direction * -1 this_motion_step[axis] = displacements[loop] * direction * -1
logger.info(f"Testing with step size {this_motion_step[axis]}") logger.info(f"Testing with step size {this_motion_step[axis]}")
image1 = cv2.resize( image1 = np.array(Image.open(cam.grab_jpeg().open()))
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
)
csm.move_in_image_coordinates(x=this_motion_step["x"], y=this_motion_step["y"]) csm.move_in_image_coordinates(x=this_motion_step["x"], y=this_motion_step["y"])
image2 = cv2.resize( image2 = np.array(Image.open(cam.grab_jpeg().open()))
np.array(Image.open(cam.grab_jpeg().open())), dsize=(0, 0), fx=1, fy=1
)
offset = fft_image_tracking.displacement_between_images( offset = fft_image_tracking.displacement_between_images(
image_0=image1, image_0=image1,
image_1=image2, image_1=image2,