Quantcast
Channel: 2 webcam feed doesn't work opencv - Stack Overflow
Viewing all articles
Browse latest Browse all 3

2 webcam feed doesn't work opencv

$
0
0

I'm using ubuntu 13.10 along with opencv 2.4.9 with python 2.7.I have written the following code but it seems to fails on runtime.

  import cv2  c1=cv2.VideoCapture(2) #camera id  c2=cv2.VideoCapture(1) #camera id  while(True):      ret,frame = c1.read()      ret,frame2 = c2.read()      frame = cv2.cvtColor(frame,0)      frame2 = cv2.cvtColor(frame2,0)      cv2.imshow('frame',frame)      cv2.imshow('frame2',frame2)      if cv2.waitKey(1) & 0xFF == ord('q'):            break  c1.release()  c2.release()  cv2.destroyAllWindows()

But on running this in Ubuntu i get the following error :

  VIDIOC_QUERYMENU: Invalid argument  libv4l2: error turning on stream: Invalid argument  VIDIOC_STREAMON: Invalid argument  OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file     /build/buildd/opencv-2.4.5+dfsg/modules/imgproc/src/color.cpp, line 3358  Traceback (most recent call last):  File "/home/bini/KV/IP_Proj/webcam basics opencv.py", line 8, in <module>  frame2 = cv2.cvtColor(frame2,0)   cv2.error: /build/buildd/opencv-2.4.5+dfsg/modules/imgproc/src/color.cpp:3358: error:        (-215) scn == 3 || scn == 4 in function cvtColor

The same code used to work fine on windows.Can someone help me please as to why is this occuring..??? i have on idea.

Thanks in advance


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles



Latest Images