Open Zartris opened 3 years ago
I meet an error when using OpenCV3.14.3
Implementation has been removed due original code license issues in function 'LineSegmentDetectorImp'
This function has been removed in Opencv higher than 3.4 and 4.0. So I use another similar function to replace it.
Some codes should be changed in serval places.
feature_tracker/src/line_descriptor/src/precomp_custom.hpp
, add
#include <opencv2/ximgproc.hpp>
feature_tracker/src/line_descriptor/include/descriptor_custom.hpp
, change LSDOptions as
struct LSDOptions{
int length_threshold;
float distance_threshold;
double canny_th1;
double canny_th2;
int canny_aperture_size;
bool do_merge;
double min_length;
} options;
feature_tracker/src/linefeature_tracker.cpp
, change opt parameters:
opts.length_threshold = 10;
opts.distance_threshold = 1.41421356f;
opts.canny_th1 = 50.0;
opts.canny_th2 = 50.0;
opts.canny_aperture_size = 3;
opts.do_merge = false;
// opts.refine = 1; //1 The way found lines will be refined
// opts.scale = 0.5; //0.8 The scale of the image that will be used to find the lines. Range (0..1].
// opts.sigma_scale = 0.6; //0.6 Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale.
// opts.quant = 2.0; //2.0 Bound to the quantization error on the gradient norm
// opts.ang_th = 22.5; //22.5 Gradient angle tolerance in degrees
// opts.log_eps = 1.0; //0 Detection threshold: -log10(NFA) > log_eps. Used only when advance refinement is chosen
// opts.density_th = 0.6; //0.7 Minimal density of aligned region points in the enclosing rectangle.
// opts.n_bins = 1024; //1024 Number of bins in pseudo-ordering of gradient modulus.
feature_tracker/src/line_descriptor/LSDDetector_custom.cpp
, change all cv::Ptr<cv::LineSegmentDetector> ls = cv::createLineSegmentDetector
into
cv::Ptr<cv::ximgproc::FastLineDetector> ls = cv::ximgproc::createFastLineDetector( opts.length_threshold,
opts.distance_threshold,
opts.canny_th1,
opts.canny_th2,
opts.canny_aperture_size,
opts.do_merge);
I meet an error when using OpenCV3.14.3
Implementation has been removed due original code license issues in function 'LineSegmentDetectorImp'
This function has been removed in Opencv higher than 3.4 and 4.0. So I use another similar function to replace it. Some codes should be changed in serval places.
feature_tracker/src/line_descriptor/src/precomp_custom.hpp
, add#include <opencv2/ximgproc.hpp>
feature_tracker/src/line_descriptor/include/descriptor_custom.hpp
, change LSDOptions asstruct LSDOptions{ int length_threshold; float distance_threshold; double canny_th1; double canny_th2; int canny_aperture_size; bool do_merge; double min_length; } options;
feature_tracker/src/linefeature_tracker.cpp
, change opt parameters:opts.length_threshold = 10; opts.distance_threshold = 1.41421356f; opts.canny_th1 = 50.0; opts.canny_th2 = 50.0; opts.canny_aperture_size = 3; opts.do_merge = false; // opts.refine = 1; //1 The way found lines will be refined // opts.scale = 0.5; //0.8 The scale of the image that will be used to find the lines. Range (0..1]. // opts.sigma_scale = 0.6; //0.6 Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale. // opts.quant = 2.0; //2.0 Bound to the quantization error on the gradient norm // opts.ang_th = 22.5; //22.5 Gradient angle tolerance in degrees // opts.log_eps = 1.0; //0 Detection threshold: -log10(NFA) > log_eps. Used only when advance refinement is chosen // opts.density_th = 0.6; //0.7 Minimal density of aligned region points in the enclosing rectangle. // opts.n_bins = 1024; //1024 Number of bins in pseudo-ordering of gradient modulus.
feature_tracker/src/line_descriptor/LSDDetector_custom.cpp
, change allcv::Ptr<cv::LineSegmentDetector> ls = cv::createLineSegmentDetector
intocv::Ptr<cv::ximgproc::FastLineDetector> ls = cv::ximgproc::createFastLineDetector( opts.length_threshold, opts.distance_threshold, opts.canny_th1, opts.canny_th2, opts.canny_aperture_size, opts.do_merge);
really appreciate, I find it in opencv document
in opencv4 https://docs.opencv.org/4.2.0/dd/d1a/groupimgprocfeature.html#ga6b2ad2353c337c42551b521a73eeae7d
the the Fun createLineSegmentDetector() has been removed due original code license conflict
Sorry for asking, why does it need to be opencv-3.2.0 I'm trying to make it run on ubuntu 20.04, with cuda 11 but I have to change a lot to be able to compile opencv-3.2.0. So would it is easier for me to change the code to work with newer versions of opencv?