Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version of opencv #10

Open
Zartris opened this issue Feb 11, 2021 · 2 comments
Open

Version of opencv #10

Zartris opened this issue Feb 11, 2021 · 2 comments

Comments

@Zartris
Copy link

Zartris commented Feb 11, 2021

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?

@Fatcat3Z
Copy link

Fatcat3Z commented Jul 10, 2021

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.

  1. feature_tracker/src/line_descriptor/src/precomp_custom.hpp, add
    #include <opencv2/ximgproc.hpp>
  2. 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;
  1. 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.  
  1. 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);

@githubwys
Copy link

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.

  1. feature_tracker/src/line_descriptor/src/precomp_custom.hpp, add
    #include <opencv2/ximgproc.hpp>
  2. 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;
  1. 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.  
  1. 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);

really appreciate, I find it in opencv document

image

in opencv4 https://docs.opencv.org/4.2.0/dd/d1a/group__imgproc__feature.html#ga6b2ad2353c337c42551b521a73eeae7d

the the Fun createLineSegmentDetector() has been removed due original code license conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants