Search code examples
c++opencvvlclibvlc

Error in VLC compilation with opencv support


I am trying to compile VLC 2.0 on Ubuntu 13.10 with opencv support (v. 2.4.6.1). The compilation yields the following errors:

 COMPILE : libopencv_example_plugin_la-opencv_example.lo
opencv_example.c: In function 'Filter':
ERROR   : opencv_example.c:185: 45:  too few arguments to function 'cvHaarDetectObjects'
                                             cvSize(20, 20) );
                                             ^
In file included from /usr/local/include/opencv/cv.h:71:0,
                 from opencv_example.c:41:
/usr/local/include/opencv2/objdetect/objdetect.hpp:139:15: note: declared here
 CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image,
               ^
WARNING : opencv_example.c:210: 57:  assignment discards 'const' qualifier from pointer target type [enabled by default]
             p_sys->event_info.p_region[i].p_description = "Face Detected";
                                                         ^
make: *** [all] Error 2

Has anyone encountered the same problem, or has an idea about how to solve it? Any help would be much appreciated. It seems that opencv support has been buggy in the past, but the problem seems to have been solved. And testing the opencv library with sample code yields satisfactory results, so I guess the problem comes from VLC...


Solution

  • Faced just the same problem today. Open opencv_example.c or writing, find the line of creating cvHaarDetectObjects. It begins with

    CvSeq *faces = cvHaarDetectObjects( p_img[0], ...
    

    Replace the whole declaration of cvHaarDetectObjects with line as following:

    CvSeq *faces = cvHaarDetectObjects( p_img[0], p_sys->p_cascade, p_sys->p_storage,
    1.15, 5, CV_HAAR_DO_CANNY_PRUNING, cvSize(0, 0), cvSize(20,20));
    

    These changes made my opencv_example.c compile well (opencv-2.4.9, vlc-2.0.1, Ubuntu-12.04)