I got a new Arducam IMX519 Autofocus camera and I have been fighting for weeks to try and get it to work within Python. Out of the box within minutes I was able to get it working with libcamera so I know the camera itself works, but I’ve followed literally 50 tutorials and I can’t find any way to make it work in Python. The latest attempt has been to go back to the Arducam site and follow the instructions provided here: Picamera2 with Arducam V1/V2/HQ/16MP-AF/64MP-AF/Pivariety Cameras (Guide) - Arducam
ImportError: cannot import name ‘ControlType’ from ‘libcamera’ (unknown location)
Or more sepcifically
trezero@raspberrypi:~/Applications/picamera2/examples $ python3 easy_capture.py
Traceback (most recent call last):
File "/home/trezero/Applications/picamera2/examples/easy_capture.py", line 3, in <module>
from picamera2 import Picamera2
File "/home/trezero/.local/lib/python3.9/site-packages/picamera2/__init__.py", line 1, in <module>
from .configuration import CameraConfiguration, StreamConfiguration
File "/home/trezero/.local/lib/python3.9/site-packages/picamera2/configuration.py", line 1, in <module>
from .controls import Controls
File "/home/trezero/.local/lib/python3.9/site-packages/picamera2/controls.py", line 4, in <module>
from libcamera import ControlType, Size, Rectangle
ImportError: cannot import name 'ControlType' from 'libcamera' (unknown location)
This is running an extremely simple app which is this:
#!/usr/bin/python3
from picamera2 import Picamera2
picam2 = Picamera2()
# Capture one image with the default configurations.
picam2.start_and_capture_file("test.jpg")
# Capture 3 images. Use a 0.5 second delay after the first image.
picam2.start_and_capture_files("test{:d}.jpg", num_files=3, delay=0.5)
Can someone please help me understand how to get past this error?
Unfortunately I just re-imaged to a 64 bit Raspberry Pi image based on reading some other sites. Can you confirm if this should work on the 64Bit Raspberry Pi OS?
@Edward One last thing though. After following this, the one thing that no longer works that always worked before is autofocus. When I try this now I get this error:
libcamera-still -t 0 --viewfinder-width 2328 --viewfinder-height 1748 --autofocus
Closing Libcamera application(frames displayed 0, dropped 0)
Camera stopped!
Tearing down requests, buffers and configuration
Camera closed
ERROR: *** unrecognised option ‘–autofocus’ ***
Any ideas? Is there something missing that I need to install for Autofocus to work? Also, how do I use Autofocus within Python? I couldn’t find anything about it with Picamera2.