Salve sto cercando di compilare un programma in c/c++ che sfrutta le opencv, ma mi da il seguente errore:
rrobotics@rrobotics-q1:~/Scrivania$ g++ catturaimmagine.cpp -o immcatt
catturaimmagine.cpp:1:16: error: cv.h: Nessun file o directory
catturaimmagine.cpp:2:21: error: highgui.h: Nessun file o directory
catturaimmagine.cpp: In function ‘int main()’:
catturaimmagine.cpp:8: error: ‘CvCapture’ was not declared in this scope
catturaimmagine.cpp:8: error: ‘capture’ was not declared in this scope
catturaimmagine.cpp:8: error: ‘CV_CAP_ANY’ was not declared in this scope
catturaimmagine.cpp:8: error: ‘cvCaptureFromCAM’ was not declared in this scope
catturaimmagine.cpp:16: error: ‘CV_WINDOW_AUTOSIZE’ was not declared in this scope
catturaimmagine.cpp:16: error: ‘cvNamedWindow’ was not declared in this scope
catturaimmagine.cpp:21: error: ‘IplImage’ was not declared in this scope
catturaimmagine.cpp:21: error: ‘frame’ was not declared in this scope
catturaimmagine.cpp:21: error: ‘cvQueryFrame’ was not declared in this scope
catturaimmagine.cpp:28: error: ‘cvShowImage’ was not declared in this scope
catturaimmagine.cpp:33: error: ‘cvWaitKey’ was not declared in this scope
catturaimmagine.cpp:37: error: ‘cvReleaseCapture’ was not declared in this scope
catturaimmagine.cpp:38: error: ‘cvDestroyWindow’ was not declared in this scope
il codice del programma è questo:
#include "cv.h"
#include "highgui.h"
#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;
}
e per compilarlo ho fatto cosi in ubuntu: g++ catturaimmagine.cpp -o cattura
Devo per caso mettere il file in una cartella specifica o mettere delle opzioni particolari nella compilazione?
Grazie mille...