Search code examples
c++opencvlegacyopencv3.1

OpenCV 3.1.0: /usr/local/include/opencv2/legacy/legacy.hpp can't compile


I'm getting loads of errors like

/usr/local/include/opencv2/legacy/legacy.hpp:2994:12: error: 'CvSubdiv2DEdge' does not name a type
/usr/local/include/opencv2/legacy/legacy.hpp:3002:12: error: 'CvSubdiv2DPoint' does not name a type
/usr/local/include/opencv2/legacy/legacy.hpp:1757:36: error: 'cv::EM' has not been declared

With OpenCV 2.4.13 it compiles just fine. It looks like they actually forgot to add some necessary includes into legacy.hpp. What's going on?


Solution

  • Sorry for being misleading, but there's actually NO such header in the standard setup. My setup was mixed up with another, older version of opencv, and it wasn't packed into a deb file, just a bunch of files within /usr/local/. Funny thing is, it was a clean install.

    After reinstalling the OpenCV from scratch and removing those old files, errors changed to legacy.hpp being missing - which is exactly what is required here.

    Here is the proof: http://answers.opencv.org/question/42622/opencv-30-deprecated-opencv_legacy-module/. Also, from OpenCV Transition Guide: "legacy, nonfree modules have been removed. Some algorithms have been moved to different locations and some have been completely rewritten or removed."