Only measure sharpness if camera has "array" method

This commit is contained in:
Joel Collins 2019-12-28 18:57:53 +00:00
parent 20bbf5ab21
commit b4e2d5b172

View file

@ -144,7 +144,8 @@ def sharpness_edge(image):
def measure_sharpness(microscope, metric_fn=sharpness_sum_lap2):
"""Measure the sharpness of the camera's current view."""
return metric_fn(microscope.camera.array(use_video_port=True))
if hasattr(microscope.camera, "array"):
return metric_fn(microscope.camera.array(use_video_port=True))
def autofocus(microscope, dz, settle=0.5, metric_fn=sharpness_sum_lap2):