Camera not working in opencv but does on libcamera

Viewed 54

New to this

Installed Picamera2 Opencv Numpy

Have x219 camera with motorized focus It works with libcamera ( libcamrea-hello and sorts) but when i run a code .py or try and use VideoCapture() in cv2 it cant find 'controls' import error no idear everything sez installed to lastest version... any help thanks

Traceback (most recent call last):
  File "/home/leddy/leddycode/code/cass.py", line 13, in <module>
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.6.0) /tmp/pip-wheel-u79916uk/opencv-python_ea2489746b3a43bfb3f2b5331b7ab47a/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

also i get this track back from opening the (python3 AutofocusTest.py -i 10)

from libcamera import ControlType, Size, Rectangle
ImportError: cannot import name 'ControlType' from 'libcamera' (/home/leddy/.local/lib/python3.9/site-packages/libcamera.cpython-39-arm-linux-gnueabihf.so)

they are the two errors i have when im trying to use camera does work with libcamera but with one warn listed below

leddy@Leddypie:~ $ libcamera-hello
Made X/EGL preview window
[0:00:42.276441121] [1300]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3866-0c55e522
[0:00:42.331671047] [1301]  WARN RPI raspberrypi.cpp:1258 Mismatch between Unicam and CamHelper for embedded data usage!
[0:00:42.333703436] [1301]  INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media3 and ISP device /dev/media1
[0:00:42.335808584] [1300]  INFO Camera camera.cpp:1035 configuring streams: (0) 1640x1232-YUV420
[0:00:42.337020047] [1301]  INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA
leddy@Leddypie:~ $ 

enter image description here

0 Answers
Related