There is something wrong when I read 2+ cameras. [closed]
I have a project recently that I need to read more than 2 cameras using OpenCV. But I am facing a weird problem that I can't solve. When I execute my code step by step, it just OK, but when I run my project automatically, there is something wrong. Here is my code:
while (1)
{
////////////////////////////////////////////////////////////////////////////////
//When I execute the following part step by step, it is just OK
//But when I run the project automatically, there is someting wrong
for (i=0; i<3; i++){
cap = cvCaptureFromCAM(i);
cvGrabFrame(cap);
cam = cvRetrieveFrame(cap);
cvCopy(cam, ImageBuffer[i]);
cvReleaseCapture(&cap);
}
///////////////////////////////////////////////////////////////////////////////
cvGetCols(pairs, &part, 0, 640);
cvCopy(ImageBuffer[0], &part);
cvGetCols(pairs, &part, 640, 640*2);
cvCopy(ImageBuffer[1], &part);
cvGetCols(pairs, &part, 640*2, 640*3);
cvCopy(ImageBuffer[2], &part);
cvShowImage("Pairs", pairs);
if(27==cvWaitKey(10))
break;
}
When I run the project, the error is like that:
So, what is wrong with my code? Can anyone could solve the problem? Thanks In Advance!
the 1st thing you should do is to get rid of the arcane c-api code. opencvc moved to c++ half a decade ago, and so should you.
also, chinese screenshots are not helpful.
Thank you for you suggestion! I will try to use the C++ code. I installed my VS2010 with Chinese language package, so the message box has some Chinese characters. I will try to reinstall my software.
Maybe (probably) it's the same problem as here: http://answers.opencv.org/question/31...
maybe you can just translate the error.