Cv2 opencv unable to open 64mp stream error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow’

  1. Where did you get the camera module(s)?

  2. Model number of the product(s)?
    arducam_64mp [9248x6944] (/base/soc/i2c0mux/[email protected]/[email protected])

  3. What hardware/platform were you working on?
    Linux drone 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

  4. Instructions you have followed. (link/manual/etc.)

  5. Problems you were having?
    See below, basically can’t open camera for opencv2

  6. The dmesg log from your hardware?

  7. Troubleshooting attempts you’ve made?

  8. What help do you need?
    Trying to rid myself of this error:
    import numpy as np
    import cv2
    cap = cv2.VideoCapture(0)
    ret, frame =


[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory.
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (914) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Traceback (most recent call last):
File “/home/pi/CNN/”, line 7, in
cv2.error: OpenCV(4.5.1) …/modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow’

libcamera-hello --list-cameras
Open i2c bus error: No such file or directory
Available cameras

0 : arducam_64mp [9248x6944] (/base/soc/i2c0mux/[email protected]/[email protected])
Modes: ‘SRGGB10_CSI2P’ : 1280x720 [120.03 fps - (2064, 2032)/5120x2880 crop]
1920x1080 [60.04 fps - (784, 1312)/7680x4320 crop]
2312x1736 [30.00 fps - (0, 0)/9248x6944 crop]
3840x2160 [20.00 fps - (784, 1312)/7680x4320 crop]
4624x3472 [10.00 fps - (0, 0)/9248x6944 crop]
9152x6944 [2.70 fps - (0, 0)/9152x6944 crop]


Opencv takes the image from the video0 node, and libcamera takes the image from the media-controllor. Can’t get image through opencv.
you can use detect command

./ -d

I ran the command, can you link me to an example of how to get the image? Thanks.

Also, now when I run
libEGL warning: DRI3: failed to query the version
libEGL warning: DRI2: failed to authenticate
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 155 ()
Minor opcode of failed request: 1
Serial number of failed request: 16
Current serial number in output stream: 16

Can’t I get video from arudcam64 into opencv2 and then grab stills inside opencv2, not from the camera inself? No?


how to use 64mp with libcamera:
How to use arducam_64mp & arducam_64mp FAQ - Raspberry Pi Cameras - Arducam Camera Support Forum
How To Use Arducam 64MP Camera On Rapberry Pi - Arducam

You can display the obtained data with opencv, but you cannot get the data directly with opencv.
You can refer to picamera.
picamera2/examples at main · raspberrypi/picamera2 · GitHub