Ask Your Question
0

OpenCV Undefined symbols for architecture x86_64: lineDescriptor

asked 2017-06-15 13:00:44 -0600

I built OpenCV from source along with opencv_contrib as well.

For some reason all my attempts to access the classes in lineDescriptor lead to a linker error.

All of these declarations throw a linker error

BinaryDescriptor bsd = BinaryDescriptor();
Ptr<BinaryDescriptor> bsd1 = BinaryDescriptor::createBinaryDescriptor();
Ptr<LSDDetector> lsd1 = LSDDetector::createLSDDetector();

I fully understand what the error means but I don't know why it is thrown in the first place.

I've looked around and tried different solutions; changing the compiler, verified linker flags and linked my libraries, but the error was still getting thrown.

#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/line_descriptor.hpp"

using namespace cv;
using namespace std;
using namespace line_descriptor;

void detectLines(Mat& original, Mat grey)
{
    Ptr<LineSegmentDetector> lsd = createLineSegmentDetector(2);

    vector<Vec4f> lines;

    lsd->detect(grey, lines);

    cout << "Detected " << lines.size() << endl;

    lsd->drawSegments(original, lines);

    // Linker problems galore
//  BinaryDescriptor bsd = BinaryDescriptor();
//  Ptr<BinaryDescriptor> bsd1 = BinaryDescriptor::createBinaryDescriptor();
//  Ptr<LSDDetector> lsd1 = LSDDetector::createLSDDetector();

}

These are my current linker flags

-lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videoio -lopencv_videostab

I personally feel like it has something to do with my flags but I am not sure of the flag that corresponds to the lineDescriptor. Any help will be greatly appreciated!

edit retag flag offensive close merge delete

Comments

Opencv_version ? System ? " throw a linker error" error message is : ?

library for opencv-3.2.0-dev using vs2015 (windows 10) is opencv_line_descriptor320 for mingw-64 it is libopencv_line_descriptor320

LBerger gravatar imageLBerger ( 2017-06-16 02:15:27 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-06-19 07:37:27 -0600

From the README on opencv_contrib's GitHub:

to run, linker flags to contrib modules will need to be added to use them in your code/IDE. For example to use the aruco module, "-lopencv_aruco" flag will be added.

Added a link to the contrib module line_descriptor with the flag

-lopencv_line_descriptor
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-06-15 13:00:44 -0600

Seen: 662 times

Last updated: Jun 19 '17