J'ai installe opencv 2.4.1 sous ubuntu. Je travaille avec QT creator. Mon probleme est au niveau de compilation. Lorsque je compile j'avais 22 errors: j,ai essaye beaucoup mais pas de nouveau merci de m'aider.
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
code.cpp
 
 
 #include<opencv/cv.h>
#include<opencv/highgui.h>
#include<iostream>
using namespace std;
using namespace cv;
int main()
{ // cvZero(mat);// mat[0][0]=1;
    IplImage* img=cvLoadImage("image1.jpg");
    IplImage* img1=cvLoadImage("image1.jpg");
    //cout<<img->nChannels;
    // CvArr* mat=cvCreateMat(img->height,img->width,CV_32FC3);
    // cvZero(mat);cvNamedWindow("source");cvNamedWindow("dest");
    cvCanny(img,img1,10,50,3);
    cvShowImage("source",img);
    cvShowImage("dest",img1);
    cvWaitKey();
    return 0;
}
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
23
24
25
  code.pro
 
TEMPLATE = app
CONFIG += console
CONFIG -= qt
 
SOURCES += main.cpp
 
#SOURCES += \webcam.cpp
INCLUDEPATH += -I/usr/local/include/
 
LIBS += -L/usr/local/lib\
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_ml \
-lopencv_video \
-lopencv_features2d \
-lopencv_calib3d \
-lopencv_objdetect \
-lopencv_contrib \
-lopencv_legacy \
-lopencv_flann\
-lavcodec\
-lavformat\

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
23
24
25
26
27
28
29
30
31
32
33
34
error
 
23:12:59: Exécution des étapes de compilation pour le projet projet1...
23:12:59: Configuration inchangée, étape QMake sautée.
23:12:59: Débute : "/usr/bin/make" -w
make: Entering directory `/home/rafik/traitement_image_opencv/projet1'
g++ -Wl,-O1 -o projet1 main.o     -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann -lavcodec -lavformat 
/usr/local/lib/libavcodec.so: undefined reference to `av_bprint_finalize@LIBAVUTIL_51'
make: Leaving directory `/home/rafik/traitement_image_opencv/projet1'
/usr/local/lib/libavformat.so: undefined reference to `av_timecode_make_smpte_tc_string@LIBAVUTIL_51'
/usr/local/lib/libavformat.so: undefined reference to `av_timecode_make_string@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_realloc_f@LIBAVUTIL_51'
/usr/local/lib/libavformat.so: undefined reference to `av_timecode_get_smpte_from_framenum@LIBAVUTIL_51'
/usr/local/lib/libavformat.so: undefined reference to `av_timecode_init@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_samples_set_silence@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_calloc@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_get_media_type_string@LIBAVUTIL_51'
/usr/local/lib/libavformat.so: undefined reference to `av_dynarray_add@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_bprint_init@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_asprintf@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_timecode_make_mpeg_tc_string@LIBAVUTIL_51'
/usr/local/lib/libavformat.so: undefined reference to `av_rescale_q_rnd@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_bprintf@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_samples_copy@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_get_default_channel_layout@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_timecode_init_from_string@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_bprint_chars@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_timecode_adjust_ntsc_framenum@LIBAVUTIL_51'
/usr/local/lib/libavcodec.so: undefined reference to `av_tempfile@LIBAVUTIL_51'
collect2: ld returned 1 exit status
make: *** [projet1] Error 1
23:12:59: Le processus "/usr/bin/make" s'est terminé avec le code 2.
Erreur à la compilation du projet projet1 (cible : Desktop)
Lors de l'exécution de l'étape "Make"