simple question:starting with open cv
Hi, I am testing open cv with this simple code:
#include <stdio.h>
// A Simple Camera Capture Framework
int main() {
CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
if ( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}
// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
// Show the image captured from the camera in the window and repeat
while ( 1 ) {
// Get one frame
IplImage* frame = cvQueryFrame( capture );
if ( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;
}
cvShowImage( "mywindow", frame );
// Do not release the frame!
//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
//remove higher bits using AND operator
if ( (cvWaitKey(10) & 255) == 27 ) break;
}
// Release the capture device housekeeping
cvReleaseCapture( &capture );
cvDestroyWindow( "mywindow" );
return 0;
}
I build it, then I get this message:
1> stdafx.cpp 1> aver.cpp 1>aver.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification 1> aver.vcxproj -> C:\Users\user\Documents\Visual Studio 2010\Projects\aver_FULL - copia\Debug\aver.exe ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Then I press F5+Ctrl and the console windows opens, and shows a message: press to continue, I press and it stops... Why is that? Is it a problem with my PC? Thanks!
To format code in ths forum you must use icon 101010.
If you start with opencv you should use last version opencv 3.1 with c++ interface
your "simple code" is unfortunately horribly outdated, opencv moved away from that c-api style in 2010 already.
please throw it all away, and restart by reading current tutorials
OK thank you! Open cv 3 with Ubuntu was great.Now 2.3.1 version with windows, it only gives me one problem after another... The main reason for using that version is because I was working with a code ( Arduino and C++ ) already written on that version. Will keep on trying!