share usb device with videocapture
Hi,
On windows with opencv 3.0 I can share same webcam device using VideoCapture. Is it true on linux, android...?
thanks for yours anwers.
int main(int argc, char** argv)
{
VideoCapture vid1;
vid1.open(0); // Open device 0
VideoCapture vid2;
vid2.open(0); // Open device 0
Mat frame1;
Mat frame2;
for (;;) {
vid1 >> frame1;
vid2 >> frame2;
if (frame1.empty())
break;
if (frame2.empty())
break;
imshow("video1", frame1);// Capture with device 0
imshow("video2", frame2);// Capture with device 0
imshow("diff", frame2-frame1);// It's not same frame on windows
char key = (char)waitKey(30);
}
}
i belive there is no difference if we change your code
vid1 >> frame2;
instead ofvid2 >> frame2;
I don't think so because >> means Grabs, decodes and returns the next video frame. PS have you try my software?
maybe this time i will explain myself
No results are similar. As I write s "Grabs, decodes and returns the next video frame" this is relative to real driver. On my PC I 've got only one webcam so vid1and vid2 bind to same driver and for this driver there is only one next frame.
@berak Is it really normal behaviour ?
If I run two python instance I can opened stream 0 but I cannot read it:
i get the same (also from c++)
but it shouldn't be ! (imho)
reading 2nd cam with CAP_MSMF also fails here (but succeeds with CAP_DSHOW)
now I tried video.py 0 and video.py 700 It works ! but video.py 700 twice gives an error AttributeError: 'NoneType' object has no attribute 'read'