/EdgesSubPix

Sub-Pixel Edge Detection Using OpenCV

Primary LanguageC++BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Sub-Pixel Edge Detection using OpenCV

Description

  • Edge detection operator return subpixel level edge position.
  • Using Canny filter as differential operator.
  • Implementing according to Carsten Steger's method.
  • Interpolation of second partial derivatives with Facet Model method.

API

struct Contour
{
    std::vector<cv::Point2f> points;  // edge location
    std::vector<float> direction;     // direction of the gradient in edge point, 
                                      // starting from y axis, counter-clockwise
    std::vector<float> response;      // amptitude of the gradient in edge point
};
// gray             - only support 8-bit grayscale
// hierarchy, mode  - have the same meanings as in cv::findContours
CV_EXPORTS void EdgesSubPix(cv::Mat &gray, double alpha, int low, int high,
                            std::vector<Contour> &contours, cv::OutputArray hierarchy,
                            int mode);

// mode = RETR_LIST
CV_EXPORTS void EdgesSubPix(cv::Mat &gray, double alpha, int low, int high, 
                           std::vector<Contour> &contours);

Test

Edge --data=edge.yml avatar.jpg edge.jpg

License

3-clause BSD License