rotating_image
rotating_image

Reputation: 3076

Error compiling private.hpp OpenCV 3.0.0-rc1

I downloaded OpenCV 3.0.0-rc1 and build it using CMAKE-gui 3.2.2 using VS2012 Win64 compiler. Binaries and libraries got generated and I set it up with Qt 64 bit. All programs are working fine except when I try to use the feature cv::LineSegmentDetector it shows a compile error in private.hpp file. The error says

unexpected end-of-line

My code is as follows

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgcodecs/imgcodecs.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/private.hpp>
#include <opencv2/core/utility.hpp>

using namespace std;

int main()
{
    cv::Mat image = cv::imread("C:\\Users\\IMAGE\\Desktop\\PROJ\\SAMPLE.png");
    cv::imshow("TEST",image);
    cv::waitKey();

    cv::LineSegmentDetector lsd;

    return 0;
}

And on following the error I found the 2nd line of the following part of the code in private.hpp as error highlighted.

#ifdef HAVE_EIGEN
#  if defined __GNUC__ && defined __APPLE__
#    pragma GCC diagnostic ignored "-Wshadow"
#  endif
#  include <Eigen/Core>
#  include "opencv2/core/eigen.hpp"
#endif    

# if defined __GNUC__ && defined __APPLE__

Please let me know if I am doing some implementation mistake or some changes in the private.hpp can fix this error. I am using windows 8 64 bit.

Upvotes: 0

Views: 1055

Answers (1)

berak
berak

Reputation: 39786

oh, never try to use something, that is called "private", i guess...

#include <opencv2/opencv.hpp>       // includes all others
#include <opencv2/core/utility.hpp> // getTickCount, etc.

int main()
{
    // LineSegmentDetector is an abstract class, you can't create an
    // instance on the stack, but need to use Ptr and factory:
    cv::Ptr<cv::LineSegmentDetector> lsd = cv::createLineSegmentDetector();
    return 0;
}

Upvotes: 1

Related Questions