bonjour jai installé la librairie opencv sous ubuntu et jessai actuellement de compiler quelques petits exemple trouvé sur le net mais jai des erreurs de compilation que je ne comprend pas.
Le premier fichier se compile tres bien et sexecute mais lors de la compilation du second jai les message d'erreur suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
gcc test2.c -o test2 -lcv -lcvaux -lhighgui
Dans le fichier inclus à partir de test2.c:4:
/usr/include/opencv/cvaux.h:45:16: erreur: cv.h : Aucun fichier ou dossier de ce type
In file included from test2.c:5:
/usr/include/opencv/cxmisc.h:239: erreur: expected «;», «,» or «)» before «=» token
/usr/include/opencv/cxmisc.h: Dans la fonction «cvGetMatSize» :
/usr/include/opencv/cxmisc.h:253: erreur: «CvMat» has no member named «width»
/usr/include/opencv/cxmisc.h:253: erreur: «CvMat» has no member named «height»
merci de votre aide

voici le code du second programme :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <opencv/cv.h>
#include <opencv/cxtypes.h>
#include <opencv/highgui.h>
#include <opencv/cvaux.h>
#include <opencv/cxmisc.h>
#include <opencv/cxcore.h>
 
 
int main() //your main program or function
{
     IplImage *originalImage = cvLoadImage("test.jpg",-1);
     IplImage *grayScaleImage;
     grayScaleImage = cvCreateImage(cvSize(originalImage->width,originalImage->height),8,1);
     cvCvtColor(originalImage, grayScaleImage, CV_BGR2GRAY);
     IplImage * edgeImage;
     edgeImage = cvCreateImage(cvSize(320,240), 8, 1);
     cvCanny(grayScaleImage, edgeImage, 0.5, 0.5, 3);
     cvSaveImage("Resultant.jpg",edgeImage);
     cvReleaseImage(&edgeImage);
     cvReleaseImage(&grayScaleImage);
	return 0;
}
Bon alors jai reussi a compiler en utilisant g++ a la place de gcc mais lorsque j'execute le programme jai ces erreurs qui apparaissent :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
OpenCV ERROR: Sizes of input arguments do not match ()
	in function cvCanny, cvcanny.cpp(78)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
	called from cvUnregisterType, cxpersistence.cpp(4933)
Terminating the application...
Cest bon cela semble etre resolu...