If you only need capture the tray then a narrower FOV (Field of View) camera might be a better starting point. However, with the existing camera, using the ScalerCrop control is one way to digitally zoom in on a section of the image.
Adding the ScalerCrop control to the create_still_configuration as in the code snippet should give an idea of what is possible.
Adding the ScalerCrop control to the create_still_configuration as in the code snippet should give an idea of what is possible.
Code:
#!/usr/bin/python3import timefrom picamera2 import Picamera2, Previewpicam2 = Picamera2()picam2.start_preview(Preview.QTGL)preview_config = picam2.create_preview_configuration()picam2.configure(preview_config)# Set up 'Zoom'offset=(1800,800)size=(1600,900)capture_config=picam2.create_still_configuration(controls={"ScalerCrop":offset+size})# Previewpicam2.start()time.sleep(2)picam2.stop()# Switch modespicam2.configure(capture_config)picam2.start()# Capture file and print metadatametadata=picam2.capture_file("TestZoomHiRes.jpg")print(metadata)
Statistics: Posted by sandyol — Sat Sep 14, 2024 6:11 pm