R6010 abort () called:When accessing my web cam

asked 2014-03-15 05:57:10 -0600

nagaraju gravatar image

updated 2015-10-10 18:33:29 -0600

Hi... I try to access webcam from my system. But it throws an error "R6010 abort () called" But the same code working perfectly in my laptop I am using logitech webcam in my system. The sample code also provided here. Please Help me in this regard.

int main(int argc, char** argv) {

cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
CvCapture* capture;
if (argc == 1) {
    capture = cvCreateCameraCapture(0);
}
else {
    capture = cvCreateFileCapture(argv[1]);
}
assert(capture != NULL);
IplImage* frame;
while (1) {
    frame = cvQueryFrame(capture);
    if (!frame) break;
    cvShowImage("Example2", frame);
    char c = cvWaitKey(33);
    if (c == 27) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Example2");

}

edit retag flag offensive close merge delete

Comments

ahh, please avoid the outdated c-api

berak gravatar imageberak ( 2014-03-15 06:02:23 -0600 )edit

Actually i am new to opencv what are the new api's ?? i got this basic example from O'Rilly OpenCV book

nagaraju gravatar imagenagaraju ( 2014-03-15 06:46:52 -0600 )edit
1

ok. book is still nice, unfortunately the code never got updated.

they moved to c++ some years ago, so cv::Mat instead of IplImage, cv::VideoCapture instead of cvCreateCameraCapture, etc. have a look at the docs and the tutorials .

berak gravatar imageberak ( 2014-03-15 06:55:58 -0600 )edit