Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
184ae873
Commit
184ae873
authored
Oct 01, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Oct 01, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1526 from vpisarev:linedetector_python
parents
8717281e
bc1f9d62
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
23 deletions
+24
-23
feature_detection.rst
modules/imgproc/doc/feature_detection.rst
+3
-3
imgproc.hpp
modules/imgproc/include/opencv2/imgproc.hpp
+5
-5
lsd.cpp
modules/imgproc/src/lsd.cpp
+1
-1
test_lsd.cpp
modules/imgproc/test/test_lsd.cpp
+12
-12
cv2.cpp
modules/python/src2/cv2.cpp
+1
-0
lsd_lines.cpp
samples/cpp/lsd_lines.cpp
+2
-2
No files found.
modules/imgproc/doc/feature_detection.rst
View file @
184ae873
...
...
@@ -509,11 +509,11 @@ Line segment detector class, following the algorithm described at [Rafael12]_.
.. ocv:class:: LineSegmentDetector : public Algorithm
createLineSegmentDetector
Ptr
-------------------------
---
createLineSegmentDetector
-------------------------
Creates a smart pointer to a LineSegmentDetector object and initializes it.
.. ocv:function:: Ptr<LineSegmentDetector> createLineSegmentDetector
Ptr
(int _refine = LSD_REFINE_STD, double _scale = 0.8, double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5, double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024)
.. ocv:function:: Ptr<LineSegmentDetector> createLineSegmentDetector(int _refine = LSD_REFINE_STD, double _scale = 0.8, double _sigma_scale = 0.6, double _quant = 2.0, double _ang_th = 22.5, double _log_eps = 0, double _density_th = 0.7, int _n_bins = 1024)
:param _refine: The way found lines will be refined:
...
...
modules/imgproc/include/opencv2/imgproc.hpp
View file @
184ae873
...
...
@@ -904,7 +904,7 @@ protected:
Point2f
bottomRight
;
};
class
LineSegmentDetector
:
public
Algorithm
class
CV_EXPORTS_W
LineSegmentDetector
:
public
Algorithm
{
public
:
/**
...
...
@@ -926,7 +926,7 @@ public:
* * 1 corresponds to 0.1 mean false alarms
* This vector will be calculated _only_ when the objects type is REFINE_ADV
*/
virtual
void
detect
(
InputArray
_image
,
OutputArray
_lines
,
CV_WRAP
virtual
void
detect
(
InputArray
_image
,
OutputArray
_lines
,
OutputArray
width
=
noArray
(),
OutputArray
prec
=
noArray
(),
OutputArray
nfa
=
noArray
())
=
0
;
...
...
@@ -937,7 +937,7 @@ public:
* Should have the size of the image, where the lines were found
* @param lines The lines that need to be drawn
*/
virtual
void
drawSegments
(
InputOutputArray
_image
,
InputArray
lines
)
=
0
;
CV_WRAP
virtual
void
drawSegments
(
InputOutputArray
_image
,
InputArray
lines
)
=
0
;
/**
* Draw both vectors on the image canvas. Uses blue for lines 1 and red for lines 2.
...
...
@@ -949,13 +949,13 @@ public:
* Should have the size of the image, where the lines were found
* @return The number of mismatching pixels between lines1 and lines2.
*/
virtual
int
compareSegments
(
const
Size
&
size
,
InputArray
lines1
,
InputArray
lines2
,
InputOutputArray
_image
=
noArray
())
=
0
;
CV_WRAP
virtual
int
compareSegments
(
const
Size
&
size
,
InputArray
lines1
,
InputArray
lines2
,
InputOutputArray
_image
=
noArray
())
=
0
;
virtual
~
LineSegmentDetector
()
{};
};
//! Returns a pointer to a LineSegmentDetector class.
CV_EXPORTS
Ptr
<
LineSegmentDetector
>
createLineSegmentDetectorPt
r
(
CV_EXPORTS
_W
Ptr
<
LineSegmentDetector
>
createLineSegmentDetecto
r
(
int
_refine
=
LSD_REFINE_STD
,
double
_scale
=
0.8
,
double
_sigma_scale
=
0.6
,
double
_quant
=
2.0
,
double
_ang_th
=
22.5
,
double
_log_eps
=
0
,
double
_density_th
=
0.7
,
int
_n_bins
=
1024
);
...
...
modules/imgproc/src/lsd.cpp
View file @
184ae873
...
...
@@ -388,7 +388,7 @@ private:
/////////////////////////////////////////////////////////////////////////////////////////
CV_EXPORTS
Ptr
<
LineSegmentDetector
>
createLineSegmentDetector
Ptr
(
CV_EXPORTS
Ptr
<
LineSegmentDetector
>
createLineSegmentDetector
(
int
_refine
,
double
_scale
,
double
_sigma_scale
,
double
_quant
,
double
_ang_th
,
double
_log_eps
,
double
_density_th
,
int
_n_bins
)
{
...
...
modules/imgproc/test/test_lsd.cpp
View file @
184ae873
...
...
@@ -110,7 +110,7 @@ TEST_F(Imgproc_LSD_ADV, whiteNoise)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateWhiteNoise
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_ADV
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_ADV
);
detector
->
detect
(
test_image
,
lines
);
if
(
40u
>=
lines
.
size
())
++
passedtests
;
...
...
@@ -123,7 +123,7 @@ TEST_F(Imgproc_LSD_ADV, constColor)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateConstColor
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_ADV
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_ADV
);
detector
->
detect
(
test_image
,
lines
);
if
(
0u
==
lines
.
size
())
++
passedtests
;
...
...
@@ -137,7 +137,7 @@ TEST_F(Imgproc_LSD_ADV, lines)
{
const
unsigned
int
numOfLines
=
1
;
GenerateLines
(
test_image
,
numOfLines
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_ADV
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_ADV
);
detector
->
detect
(
test_image
,
lines
);
if
(
numOfLines
*
2
==
lines
.
size
())
++
passedtests
;
// * 2 because of Gibbs effect
...
...
@@ -150,7 +150,7 @@ TEST_F(Imgproc_LSD_ADV, rotatedRect)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateRotatedRect
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_ADV
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_ADV
);
detector
->
detect
(
test_image
,
lines
);
if
(
2u
<=
lines
.
size
())
++
passedtests
;
...
...
@@ -163,7 +163,7 @@ TEST_F(Imgproc_LSD_STD, whiteNoise)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateWhiteNoise
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_STD
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_STD
);
detector
->
detect
(
test_image
,
lines
);
if
(
50u
>=
lines
.
size
())
++
passedtests
;
...
...
@@ -176,7 +176,7 @@ TEST_F(Imgproc_LSD_STD, constColor)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateConstColor
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_STD
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_STD
);
detector
->
detect
(
test_image
,
lines
);
if
(
0u
==
lines
.
size
())
++
passedtests
;
...
...
@@ -190,7 +190,7 @@ TEST_F(Imgproc_LSD_STD, lines)
{
const
unsigned
int
numOfLines
=
1
;
GenerateLines
(
test_image
,
numOfLines
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_STD
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_STD
);
detector
->
detect
(
test_image
,
lines
);
if
(
numOfLines
*
2
==
lines
.
size
())
++
passedtests
;
// * 2 because of Gibbs effect
...
...
@@ -203,7 +203,7 @@ TEST_F(Imgproc_LSD_STD, rotatedRect)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateRotatedRect
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_STD
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_STD
);
detector
->
detect
(
test_image
,
lines
);
if
(
4u
<=
lines
.
size
())
++
passedtests
;
...
...
@@ -216,7 +216,7 @@ TEST_F(Imgproc_LSD_NONE, whiteNoise)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateWhiteNoise
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_STD
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_STD
);
detector
->
detect
(
test_image
,
lines
);
if
(
50u
>=
lines
.
size
())
++
passedtests
;
...
...
@@ -229,7 +229,7 @@ TEST_F(Imgproc_LSD_NONE, constColor)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateConstColor
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_NONE
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_NONE
);
detector
->
detect
(
test_image
,
lines
);
if
(
0u
==
lines
.
size
())
++
passedtests
;
...
...
@@ -243,7 +243,7 @@ TEST_F(Imgproc_LSD_NONE, lines)
{
const
unsigned
int
numOfLines
=
1
;
GenerateLines
(
test_image
,
numOfLines
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_NONE
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_NONE
);
detector
->
detect
(
test_image
,
lines
);
if
(
numOfLines
*
2
==
lines
.
size
())
++
passedtests
;
// * 2 because of Gibbs effect
...
...
@@ -256,7 +256,7 @@ TEST_F(Imgproc_LSD_NONE, rotatedRect)
for
(
int
i
=
0
;
i
<
EPOCHS
;
++
i
)
{
GenerateRotatedRect
(
test_image
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_NONE
);
Ptr
<
LineSegmentDetector
>
detector
=
createLineSegmentDetector
(
LSD_REFINE_NONE
);
detector
->
detect
(
test_image
,
lines
);
if
(
8u
<=
lines
.
size
())
++
passedtests
;
...
...
modules/python/src2/cv2.cpp
View file @
184ae873
...
...
@@ -137,6 +137,7 @@ typedef Ptr<StereoSGBM> Ptr_StereoSGBM;
typedef
Ptr
<
cv
::
softcascade
::
ChannelFeatureBuilder
>
Ptr_ChannelFeatureBuilder
;
typedef
Ptr
<
CLAHE
>
Ptr_CLAHE
;
typedef
Ptr
<
LineSegmentDetector
>
Ptr_LineSegmentDetector
;
typedef
SimpleBlobDetector
::
Params
SimpleBlobDetector_Params
;
...
...
samples/cpp/lsd_lines.cpp
View file @
184ae873
...
...
@@ -30,9 +30,9 @@ int main(int argc, char** argv)
// Create and LSD detector with standard or no refinement.
#if 1
Ptr
<
LineSegmentDetector
>
ls
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_STD
);
Ptr
<
LineSegmentDetector
>
ls
=
createLineSegmentDetector
(
LSD_REFINE_STD
);
#else
Ptr
<
LineSegmentDetector
>
ls
=
createLineSegmentDetector
Ptr
(
LSD_REFINE_NONE
);
Ptr
<
LineSegmentDetector
>
ls
=
createLineSegmentDetector
(
LSD_REFINE_NONE
);
#endif
double
start
=
double
(
getTickCount
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment