Ask Your Question
0

Errors after wrong installation of opencv

asked 2015-08-05 05:04:54 -0600

franken gravatar image

updated 2015-08-05 05:53:12 -0600

Hi , i'm trying to run an example of face detection using opencv , C++ , and QT from here : https://github.com/benhoff/opencv when running make i get the following errors

usr/local/include/opencv2/highgui/highgui.hpp:165:5: note: previous declaration ‘cv::<anonymous enum=""> IMREAD_UNCHANGED’ /usr/local/include/opencv2/imgcodecs.hpp error: redeclaration of ‘IMREAD_GRAYSCALE’ /usr/local/include/opencv2/imgcodecs.hpp error: redeclaration of ‘IMREAD_COLOR’ /usr/local/include/opencv2/imgcodecs.hpp:70:28: error: redeclaration of ‘IMREAD_ANYDEPTH’

...................

there are plenty of them

i think the problem is that i have installed firstly opencv 3.0.0 alpha and i want to change it to opencv 2.4.10 so what i have did is deleting manually all libraries and headers in /usr/local/lib and /usr/local/include (that because i haven't found a tutorial explaining how to properly delete opencv or re-install it) and after that i installed opencv 2.4.10

that's is the source of the error but now how can i solve this ?? solution ;: the code included 2 headers in the same time so i have commented the second line because i have opencv 2.4.10

#include <opencv2/imgproc/imgproc.hpp>  /* for opencv 2.4.10 */
//#include <opencv2/imgcodecs.hpp>       /* for opencv 3.0.0  */

update : here what i get now after make :

here is the error now after make :

faceDetector.cpp: In member function ‘void FaceDetector::process(cv::Mat)’: faceDetector.cpp:76:78: error: no matching function for call to ‘QImage::QImage(const unsigned char*, int&, int&, cv::Mat::MStep&, QImage::Format, void (*)(void*), cv::Mat*)’
                        QImage::Format_RGB888, &matDeleter, new cv::Mat(frame));
                                                                              ^ faceDetector.cpp:76:78: note: candidates are: In file included from /usr/include/qt4/QtGui/QImage:1:0,
                 from faceDetector.h:9,
                 from faceDetector.cpp:1: /usr/include/qt4/QtGui/qimage.h:139:5: note: QImage::QImage(const QImage&)
     QImage(const QImage &);
     ^ /usr/include/qt4/QtGui/qimage.h:139:5: note:   candidate

Any suggestion will be appreciated :)

NB : I'm using ubuntu 14.04 , opencv 2.4.10 , QT 4.8.6

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2015-08-05 05:44:21 -0600

Just start with opening up a command line

  • Erase all opencv installations by doing sudo apt-get purge *opencv*
  • Then redownload the latest OpenCV package or the one you want
  • Do a configuration and a cmake and make command
  • Be sure to do a make install command at the end

Now you can include the OpenCV libs by adding pkg-config opencv --libs to your linker settings.

edit flag offensive delete link more

Comments

solve it now from the previous post .... now i will update my question or just add another post thanks

franken gravatar imagefranken ( 2015-08-05 05:47:59 -0600 )edit

please see the "update section"

franken gravatar imagefranken ( 2015-08-05 05:53:58 -0600 )edit
1

That is no OpenCV error but a problem with your QT source. My guess, your Qt project is not linked correctly.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-05 06:29:05 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-08-05 05:04:54 -0600

Seen: 827 times

Last updated: Aug 05 '15