Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4411

Advanced users • Problem with Waveshare Rpi Cam G on Raspberry Pi Zero 2W

$
0
0
Congratulations. I have a raspberry pi zero 2w and a Wavashare rpi cam G. I want to get the video stream from the camera using the below code but the raspberry is giving this error :

(myenv) rpi@raspberrypi:~/cod/cod $ python cod2.py

Traceback (most recent call last):
File "/home/rpi/cod/cod/cod2.py", line 10, in <module>
cv2.imshow("ActiveTrack",frame)
cv2.error: OpenCV(4.10.0) /io/opencv/modules/highgui/src/window.cpp:973: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'[/color]


It should be noted that the camera connects well and works if you enter the libcamera-hello command. Thank you in advance.

This is my cod.
import cv2

cap = cv2.VideoCapture(0)

if not cap.isOpened():
print("Не вдалося отримати доступ до камери.")

while True:
ret, frame = cap.read()
cv2.imshow("Tracking", frame)

key = cv2.waitKey(1) & 0xFF
if key == ord('q') or key == 27:
break
cap.release()
cv2.destroyAllWindows()

Statistics: Posted by Mykhailo — Wed Dec 25, 2024 9:49 am — Replies 0 — Views 13



Viewing all articles
Browse latest Browse all 4411

Trending Articles