Skip to content

Commit d4719b2

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents e223e15 + b535c99 commit d4719b2

File tree

2 files changed

+47
-18
lines changed

2 files changed

+47
-18
lines changed

modules/ximgproc/include/opencv2/ximgproc/edge_drawing.hpp

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,50 +25,71 @@ class CV_EXPORTS_W EdgeDrawing : public Algorithm
2525
enum GradientOperator
2626
{
2727
PREWITT = 0,
28-
SOBEL = 1,
29-
SCHARR = 2,
30-
LSD = 3
28+
SOBEL = 1,
29+
SCHARR = 2,
30+
LSD = 3
3131
};
3232

3333
struct CV_EXPORTS_W_SIMPLE Params
3434
{
3535
CV_WRAP Params();
36-
//! Parameter Free mode will be activated when this value is true.
36+
//! Parameter Free mode will be activated when this value is set as true. Default value is false.
3737
CV_PROP_RW bool PFmode;
38-
//! indicates the operator used for gradient calculation.The following operation flags are available(cv::ximgproc::EdgeDrawing::GradientOperator)
38+
/** @brief indicates the operator used for gradient calculation.
39+
40+
one of the flags cv::ximgproc::EdgeDrawing::GradientOperator. Default value is PREWITT
41+
*/
3942
CV_PROP_RW int EdgeDetectionOperator;
40-
//! threshold value used to create gradient image.
43+
//! threshold value of gradiential difference between pixels. Used to create gradient image. Default value is 20
4144
CV_PROP_RW int GradientThresholdValue;
42-
//! threshold value used to create gradient image.
45+
//! threshold value used to select anchor points. Default value is 0
4346
CV_PROP_RW int AnchorThresholdValue;
47+
//! Default value is 1
4448
CV_PROP_RW int ScanInterval;
45-
//! minimun connected pixels length processed to create an edge segment.
49+
/** @brief minimun connected pixels length processed to create an edge segment.
50+
51+
in gradient image, minimum connected pixels length processed to create an edge segment. pixels having upper value than GradientThresholdValue
52+
will be processed. Default value is 10
53+
*/
4654
CV_PROP_RW int MinPathLength;
47-
//! sigma value for internal GaussianBlur() function.
55+
//! sigma value for internal GaussianBlur() function. Default value is 1.0
4856
CV_PROP_RW float Sigma;
4957
CV_PROP_RW bool SumFlag;
50-
//! when this value is true NFA (Number of False Alarms) algorithm will be used for line and ellipse validation.
58+
//! Default value is true. indicates if NFA (Number of False Alarms) algorithm will be used for line and ellipse validation.
5159
CV_PROP_RW bool NFAValidation;
5260
//! minimun line length to detect.
5361
CV_PROP_RW int MinLineLength;
62+
//! Default value is 6.0
5463
CV_PROP_RW double MaxDistanceBetweenTwoLines;
64+
//! Default value is 1.0
5565
CV_PROP_RW double LineFitErrorThreshold;
66+
//! Default value is 1.3
5667
CV_PROP_RW double MaxErrorThreshold;
5768

5869
void read(const FileNode& fn);
5970
void write(FileStorage& fs) const;
6071
};
6172

62-
/** @brief Detects edges and prepares them to detect lines and ellipses.
73+
/** @brief Detects edges in a grayscale image and prepares them to detect lines and ellipses.
6374
64-
@param src input image
75+
@param src 8-bit, single-channel, grayscale input image.
6576
*/
6677
CV_WRAP virtual void detectEdges(InputArray src) = 0;
78+
79+
/** @brief returns Edge Image prepared by detectEdges() function.
80+
81+
@param dst returns 8-bit, single-channel output image.
82+
*/
6783
CV_WRAP virtual void getEdgeImage(OutputArray dst) = 0;
84+
85+
/** @brief returns Gradient Image prepared by detectEdges() function.
86+
87+
@param dst returns 16-bit, single-channel output image.
88+
*/
6889
CV_WRAP virtual void getGradientImage(OutputArray dst) = 0;
6990

7091
/** @brief Returns std::vector<std::vector<Point>> of detected edge segments, see detectEdges()
71-
*/
92+
*/
7293
CV_WRAP virtual std::vector<std::vector<Point> > getSegments() = 0;
7394

7495
/** @brief Returns for each line found in detectLines() its edge segment index in getSegments()
@@ -77,23 +98,24 @@ class CV_EXPORTS_W EdgeDrawing : public Algorithm
7798

7899
/** @brief Detects lines.
79100
80-
@param lines output Vec<4f> contains start point and end point of detected lines.
81-
@note you should call detectEdges() method before call this.
101+
@param lines output Vec<4f> contains the start point and the end point of detected lines.
102+
@note you should call detectEdges() before calling this function.
82103
*/
83104
CV_WRAP virtual void detectLines(OutputArray lines) = 0;
84105

85106
/** @brief Detects circles and ellipses.
86107
87-
@param ellipses output Vec<6d> contains center point and perimeter for circles.
88-
@note you should call detectEdges() method before call this.
108+
@param ellipses output Vec<6d> contains center point and perimeter for circles, center point, axes and angle for ellipses.
109+
@note you should call detectEdges() before calling this function.
89110
*/
90111
CV_WRAP virtual void detectEllipses(OutputArray ellipses) = 0;
91112

92113
CV_WRAP Params params;
93114

94115
/** @brief sets parameters.
95116
96-
this function is meant to be used for parameter setting in other languages than c++.
117+
this function is meant to be used for parameter setting in other languages than c++ like python.
118+
@param parameters
97119
*/
98120
CV_WRAP void setParams(const EdgeDrawing::Params& parameters);
99121
virtual ~EdgeDrawing() { }

modules/ximgproc/src/edge_drawing.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class EdgeDrawingImpl : public EdgeDrawing
113113
void detectLines(OutputArray lines) CV_OVERRIDE;
114114
void detectEllipses(OutputArray ellipses) CV_OVERRIDE;
115115

116+
virtual String getDefaultName() const CV_OVERRIDE;
116117
virtual void read(const FileNode& fn) CV_OVERRIDE;
117118
virtual void write(FileStorage& fs) const CV_OVERRIDE;
118119

@@ -317,6 +318,11 @@ void EdgeDrawing::Params::write(cv::FileStorage& fs) const
317318
fs << "MaxErrorThreshold" << MaxErrorThreshold;
318319
}
319320

321+
String EdgeDrawingImpl::getDefaultName() const
322+
{
323+
return String("EdgeDrawing");
324+
}
325+
320326
void EdgeDrawingImpl::read(const cv::FileNode& fn)
321327
{
322328
params.read(fn);
@@ -345,6 +351,7 @@ EdgeDrawingImpl::~EdgeDrawingImpl()
345351

346352
void EdgeDrawingImpl::detectEdges(InputArray src)
347353
{
354+
CV_Assert(!src.empty() && src.type() == CV_8UC1);
348355
gradThresh = params.GradientThresholdValue;
349356
anchorThresh = params.AnchorThresholdValue;
350357
op = params.EdgeDetectionOperator;

0 commit comments

Comments
 (0)