Got a bit of problem trying to use VideoCapture capability of OpenCV.
After the VideoCapture.read() I get the "VIDIOC_STREAMON: Invalid Argument" error.
I am using Raspberry Pi 3 with Camera Module installed (this is working fine, as I am able to run my application to detect Aruco Markers)
I am trying to improve aforementioned application, which currently captures images, detects markers on them, and displays them using imshow. I want to be able to detect markers in real-time video capture, just like on this video: https://www.youtube.com/watch?v=IsXWrcB_Hvs
Here is the code I'm trying to run:
def continuuosDetection(self):
cap = cv2.VideoCapture(-1)
if not cap.isOpened():
print("The camera didn\'t open correctly")
cap.open(-1)
print(cap.isOpened())
ret, frame = cap.read()
cap.release()
if not cap.isOpened():
print("Camera shut properly")
I'm using Python 3.5, and as mentioned camera module is working fine with different function, although I am using PiCamera.capture() method to take images. For the VideoCapture() I used both -1 and 0 as camera IDs.
print(cap.isOpened())
This returns 'True' every single time. So it seems like the camera is opening correctly(?)
print(ret)
print(frame)
These return 'False' and 'None', hence I can't display the capture using cv2.imshow.
I used:
sudo mobprobe bcm2835-v4l2
As I found on one forum, but this doesn't solve my issue.
And suggestions or advices would be highly appreciated.
I am still trying to sort this problem, so if I find the answer, I will include it here. Although so far I've been scrolling google for past few hours trying to find a solution and I'm still in the woods.
Regards,
from VIDIOC_STREAMON: Invalid Argument
No comments:
Post a Comment