Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
1c246d47
Commit
1c246d47
authored
Aug 09, 2014
by
biagio montesano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detection test, smoothed removal, setter modified, samples corrected
parent
97854e2b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
175 additions
and
87 deletions
+175
-87
descriptor.hpp
...descriptor/include/opencv2/line_descriptor/descriptor.hpp
+2
-4
ed_line_detector.hpp
...ptor/include/opencv2/line_descriptor/ed_line_detector.hpp
+3
-5
compute_descriptors.cpp
modules/line_descriptor/samples/compute_descriptors.cpp
+0
-22
knn_matching.cpp
modules/line_descriptor/samples/knn_matching.cpp
+3
-0
matching.cpp
modules/line_descriptor/samples/matching.cpp
+58
-30
LSDDetector.cpp
modules/line_descriptor/src/LSDDetector.cpp
+1
-1
binary_descriptor.cpp
modules/line_descriptor/src/binary_descriptor.cpp
+59
-7
draw.cpp
modules/line_descriptor/src/draw.cpp
+17
-7
ed_line_detector.cpp
modules/line_descriptor/src/ed_line_detector.cpp
+5
-11
test_detector_regression.cpp
modules/line_descriptor/test/test_detector_regression.cpp
+0
-0
test_main.cpp
modules/line_descriptor/test/test_main.cpp
+3
-0
test_precomp.hpp
modules/line_descriptor/test/test_precomp.hpp
+24
-0
No files found.
modules/line_descriptor/include/opencv2/line_descriptor/descriptor.hpp
View file @
1c246d47
...
...
@@ -190,14 +190,12 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
/* requires descriptors computation (only one image) */
CV_WRAP
void
compute
(
const
Mat
&
image
,
CV_OUT
CV_IN_OUT
std
::
vector
<
KeyLine
>&
keylines
,
CV_OUT
Mat
&
descriptors
,
bool
returnFloatDescr
=
false
,
bool
useDetectionData
=
false
)
const
;
void
compute
(
const
Mat
&
image
,
CV_OUT
CV_IN_OUT
std
::
vector
<
KeyLine
>&
keylines
,
CV_OUT
Mat
&
descriptors
,
bool
returnFloatDescr
=
false
)
const
;
/* requires descriptors computation (more than one image) */
CV_WRAP
void
compute
(
const
std
::
vector
<
Mat
>&
images
,
std
::
vector
<
std
::
vector
<
KeyLine
>
>&
keylines
,
std
::
vector
<
Mat
>&
descriptors
,
bool
returnFloatDescr
=
false
,
bool
useDetectionData
=
false
)
const
;
false
)
const
;
/* returns descriptor size */
CV_WRAP
...
...
modules/line_descriptor/include/opencv2/line_descriptor/ed_line_detector.hpp
View file @
1c246d47
...
...
@@ -106,21 +106,19 @@ class EDLineDetector
/*extract edges from image
*image: In, gray image;
*edges: Out, store the edges, each edge is a pixel chain
*smoothed: In, flag to mark whether the image has already been smoothed by Gaussian filter.
*return -1: error happen
*/
int
EdgeDrawing
(
cv
::
Mat
&
image
,
EdgeChains
&
edgeChains
,
bool
smoothed
);
int
EdgeDrawing
(
cv
::
Mat
&
image
,
EdgeChains
&
edgeChains
);
/*extract lines from image
*image: In, gray image;
*lines: Out, store the extracted lines,
*smoothed: In, flag to mark whether the image has already been smoothed by Gaussian filter.
*return -1: error happen
*/
int
EDline
(
cv
::
Mat
&
image
,
LineChains
&
lines
,
bool
smoothed
);
int
EDline
(
cv
::
Mat
&
image
,
LineChains
&
lines
);
/* extract line from image, and store them */
int
EDline
(
cv
::
Mat
&
image
,
bool
smoothed
);
int
EDline
(
cv
::
Mat
&
image
);
cv
::
Mat
dxImg_
;
//store the dxImg;
...
...
modules/line_descriptor/samples/compute_descriptors.cpp
View file @
1c246d47
...
...
@@ -61,19 +61,6 @@ static void help()
<<
std
::
endl
;
}
inline
void
writeMat
(
cv
::
Mat
m
,
std
::
string
name
,
int
n
)
{
std
::
stringstream
ss
;
std
::
string
s
;
ss
<<
n
;
ss
>>
s
;
std
::
string
fileNameConf
=
name
+
s
;
cv
::
FileStorage
fsConf
(
fileNameConf
,
cv
::
FileStorage
::
WRITE
);
fsConf
<<
"m"
<<
m
;
fsConf
.
release
();
}
int
main
(
int
argc
,
char
**
argv
)
{
/* get parameters from command line */
...
...
@@ -103,18 +90,9 @@ int main( int argc, char** argv )
std
::
vector
<
KeyLine
>
keylines
;
bd
->
detect
(
imageMat
,
keylines
,
mask
);
/* select only lines from first octave */
/*std::vector<KeyLine> octave0;
for ( size_t i = 0; i < keylines.size(); i++ )
{
if( keylines[i].octave == 0 )
octave0.push_back( keylines[i] );
}*/
/* compute descriptors */
cv
::
Mat
descriptors
;
bd
->
compute
(
imageMat
,
keylines
,
descriptors
);
writeMat
(
descriptors
,
"bd_descriptors"
,
1
);
}
modules/line_descriptor/samples/knn_matching.cpp
View file @
1c246d47
...
...
@@ -192,5 +192,8 @@ int main( int argc, char** argv )
/* require knn match */
bdm
->
knnMatch
(
descr1
,
descr2
,
matches
,
6
);
}
modules/line_descriptor/samples/matching.cpp
View file @
1c246d47
...
...
@@ -92,7 +92,7 @@ int main( int argc, char** argv )
cv
::
Mat
mask2
=
Mat
::
ones
(
imageMat2
.
size
(),
CV_8UC1
);
/* create a pointer to a BinaryDescriptor object with default parameters */
Ptr
<
BinaryDescriptor
>
bd
=
BinaryDescriptor
::
createBinaryDescriptor
();
Ptr
<
BinaryDescriptor
>
bd
=
BinaryDescriptor
::
createBinaryDescriptor
(
);
/* compute lines and descriptors */
std
::
vector
<
KeyLine
>
keylines1
,
keylines2
;
...
...
@@ -101,27 +101,48 @@ int main( int argc, char** argv )
(
*
bd
)(
imageMat1
,
mask1
,
keylines1
,
descr1
,
false
,
false
);
(
*
bd
)(
imageMat2
,
mask2
,
keylines2
,
descr2
,
false
,
false
);
/* select keylines from first octave and their descriptors */
std
::
vector
<
KeyLine
>
lbd_octave1
,
lbd_octave2
;
Mat
left_lbd
,
right_lbd
;
for
(
int
i
=
0
;
i
<
(
int
)
keylines1
.
size
();
i
++
)
{
if
(
keylines1
[
i
].
octave
==
0
)
{
lbd_octave1
.
push_back
(
keylines1
[
i
]
);
left_lbd
.
push_back
(
descr1
.
row
(
i
)
);
}
}
for
(
int
j
=
0
;
j
<
(
int
)
keylines2
.
size
();
j
++
)
{
if
(
keylines2
[
j
].
octave
==
0
)
{
lbd_octave2
.
push_back
(
keylines2
[
j
]
);
right_lbd
.
push_back
(
descr2
.
row
(
j
)
);
}
}
/* create a BinaryDescriptorMatcher object */
Ptr
<
BinaryDescriptorMatcher
>
bdm
=
BinaryDescriptorMatcher
::
createBinaryDescriptorMatcher
();
/* require match */
std
::
vector
<
DMatch
>
matches
;
bdm
->
match
(
descr1
,
descr2
,
matches
);
bdm
->
match
(
left_lbd
,
right_lbd
,
matches
);
/* select best matches */
std
::
vector
<
DMatch
>
good_matches
;
for
(
int
i
=
0
;
i
<
(
int
)
matches
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
matches
.
size
();
i
++
)
{
if
(
matches
[
i
].
distance
<
MATCHES_DIST_THRESHOLD
)
good_matches
.
push_back
(
matches
[
i
]
);
if
(
matches
[
i
].
distance
<
MATCHES_DIST_THRESHOLD
)
good_matches
.
push_back
(
matches
[
i
]
);
}
/* plot matches */
cv
::
Mat
outImg
;
cv
::
Mat
scaled1
,
scaled2
;
std
::
vector
<
char
>
mask
(
matches
.
size
(),
1
);
drawLineMatches
(
imageMat1
,
keylines1
,
imageMat2
,
keylines2
,
good_matches
,
outImg
,
Scalar
::
all
(
-
1
),
Scalar
::
all
(
-
1
),
mask
,
DrawLinesMatchesFlags
::
DEFAULT
);
drawLineMatches
(
imageMat1
,
lbd_octave1
,
imageMat2
,
lbd_octave2
,
good_matches
,
outImg
,
Scalar
::
all
(
-
1
),
Scalar
::
all
(
-
1
),
mask
,
DrawLinesMatchesFlags
::
DEFAULT
);
imshow
(
"Matches"
,
outImg
);
waitKey
();
...
...
@@ -132,48 +153,55 @@ int main( int argc, char** argv )
/* detect lines */
std
::
vector
<
KeyLine
>
klsd1
,
klsd2
;
Mat
lsd_descr1
,
lsd_descr2
;
lsd
->
detect
(
imageMat1
,
klsd1
,
2
,
2
,
mask1
);
lsd
->
detect
(
imageMat2
,
klsd2
,
2
,
2
,
mask2
);
lsd
->
detect
(
imageMat1
,
klsd1
,
2
,
2
,
mask1
);
lsd
->
detect
(
imageMat2
,
klsd2
,
2
,
2
,
mask2
);
/* compute descriptors for lines from first octave */
bd
->
compute
(
imageMat1
,
klsd1
,
lsd_descr1
);
bd
->
compute
(
imageMat2
,
klsd2
,
lsd_descr2
);
/* select lines from first octave */
/* select lines
and descriptors
from first octave */
std
::
vector
<
KeyLine
>
octave0_1
,
octave0_2
;
for
(
int
i
=
0
;
i
<
(
int
)
klsd1
.
size
();
i
++
)
Mat
leftDEscr
,
rightDescr
;
for
(
int
i
=
0
;
i
<
(
int
)
klsd1
.
size
();
i
++
)
{
if
(
klsd1
[
i
].
octave
==
0
)
octave0_1
.
push_back
(
klsd1
[
i
]);
if
(
klsd1
[
i
].
octave
==
1
)
{
octave0_1
.
push_back
(
klsd1
[
i
]
);
leftDEscr
.
push_back
(
lsd_descr1
.
row
(
i
)
);
}
}
for
(
int
j
=
0
;
j
<
(
int
)
klsd1
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
(
int
)
klsd2
.
size
();
j
++
)
{
if
(
klsd2
[
j
].
octave
==
1
)
{
if
(
klsd2
[
j
].
octave
==
0
)
octave0_2
.
push_back
(
klsd2
[
j
]
);
octave0_2
.
push_back
(
klsd2
[
j
]
);
rightDescr
.
push_back
(
lsd_descr2
.
row
(
j
)
);
}
/* compute descriptors for lines from first octave */
bd
->
compute
(
imageMat1
,
octave0_1
,
lsd_descr1
);
bd
->
compute
(
imageMat2
,
octave0_2
,
lsd_descr2
);
}
/* compute matches */
std
::
vector
<
DMatch
>
lsd_matches
;
bdm
->
match
(
l
sd_descr1
,
lsd_descr2
,
lsd_matches
);
bdm
->
match
(
l
eftDEscr
,
rightDescr
,
lsd_matches
);
/* select best matches */
good_matches
.
clear
();
for
(
int
i
=
0
;
i
<
(
int
)
lsd_matches
.
size
();
i
++
)
{
if
(
lsd_matches
[
i
].
distance
<
MATCHES_DIST_THRESHOLD
)
good_matches
.
push_back
(
lsd_matches
[
i
]);
}
for
(
int
i
=
0
;
i
<
(
int
)
lsd_matches
.
size
();
i
++
)
{
if
(
lsd_matches
[
i
].
distance
<
MATCHES_DIST_THRESHOLD
)
good_matches
.
push_back
(
lsd_matches
[
i
]
);
}
/* plot matches */
cv
::
Mat
lsd_outImg
;
resize
(
imageMat1
,
imageMat1
,
Size
(
imageMat1
.
cols
/
2
,
imageMat1
.
rows
/
2
)
);
resize
(
imageMat2
,
imageMat2
,
Size
(
imageMat2
.
cols
/
2
,
imageMat2
.
rows
/
2
)
);
std
::
vector
<
char
>
lsd_mask
(
matches
.
size
(),
1
);
drawLineMatches
(
imageMat1
,
octave0_1
,
imageMat2
,
octave0_2
,
good_matches
,
lsd_outImg
,
Scalar
::
all
(
-
1
),
Scalar
::
all
(
-
1
),
lsd_mask
,
drawLineMatches
(
imageMat1
,
octave0_1
,
imageMat2
,
octave0_2
,
good_matches
,
lsd_outImg
,
Scalar
::
all
(
-
1
),
Scalar
::
all
(
-
1
),
lsd_mask
,
DrawLinesMatchesFlags
::
DEFAULT
);
imshow
(
"LSD matches"
,
lsd_outImg
);
imshow
(
"LSD matches"
,
lsd_outImg
);
waitKey
();
}
modules/line_descriptor/src/LSDDetector.cpp
View file @
1c246d47
...
...
@@ -56,7 +56,7 @@ void LSDDetector::computeGaussianPyramid( const Mat& image, int numOctaves, int
/* insert input image into pyramid */
cv
::
Mat
currentMat
=
image
.
clone
();
cv
::
GaussianBlur
(
currentMat
,
currentMat
,
cv
::
Size
(
5
,
5
),
1
);
//
cv::GaussianBlur( currentMat, currentMat, cv::Size( 5, 5 ), 1 );
gaussianPyrs
.
push_back
(
currentMat
);
/* fill Gaussian pyramid */
...
...
modules/line_descriptor/src/binary_descriptor.cpp
View file @
1c246d47
...
...
@@ -111,6 +111,46 @@ int BinaryDescriptor::getWidthOfBand()
void
BinaryDescriptor
::
setWidthOfBand
(
int
width
)
{
params
.
widthOfBand_
=
width
;
/* reserve enough space for EDLine objects and images in Gaussian pyramid */
edLineVec_
.
resize
(
params
.
numOfOctave_
);
images_sizes
.
resize
(
params
.
numOfOctave_
);
for
(
int
i
=
0
;
i
<
params
.
numOfOctave_
;
i
++
)
edLineVec_
[
i
]
=
Ptr
<
EDLineDetector
>
(
new
EDLineDetector
()
);
/* prepare a vector to host local weights F_l*/
gaussCoefL_
.
resize
(
params
.
widthOfBand_
*
3
);
/* compute center of central band (every computation involves 2-3 bands) */
double
u
=
(
params
.
widthOfBand_
*
3
-
1
)
/
2
;
/* compute exponential part of F_l */
double
sigma
=
(
params
.
widthOfBand_
*
2
+
1
)
/
2
;
// (widthOfBand_*2+1)/2;
double
invsigma2
=
-
1
/
(
2
*
sigma
*
sigma
);
/* compute all local weights */
double
dis
;
for
(
int
i
=
0
;
i
<
params
.
widthOfBand_
*
3
;
i
++
)
{
dis
=
i
-
u
;
gaussCoefL_
[
i
]
=
exp
(
dis
*
dis
*
invsigma2
);
}
/* prepare a vector for global weights F_g*/
gaussCoefG_
.
resize
(
NUM_OF_BANDS
*
params
.
widthOfBand_
);
/* compute center of LSR */
u
=
(
NUM_OF_BANDS
*
params
.
widthOfBand_
-
1
)
/
2
;
/* compute exponential part of F_g */
sigma
=
u
;
invsigma2
=
-
1
/
(
2
*
sigma
*
sigma
);
for
(
int
i
=
0
;
i
<
NUM_OF_BANDS
*
params
.
widthOfBand_
;
i
++
)
{
dis
=
i
-
u
;
gaussCoefG_
[
i
]
=
exp
(
dis
*
dis
*
invsigma2
);
}
}
int
BinaryDescriptor
::
getReductionRatio
()
...
...
@@ -351,6 +391,12 @@ unsigned char BinaryDescriptor::binaryConversion( float* f1, float* f2 )
/* requires line detection (only one image) */
void
BinaryDescriptor
::
detect
(
const
Mat
&
image
,
CV_OUT
std
::
vector
<
KeyLine
>&
keylines
,
const
Mat
&
mask
)
{
if
(
image
.
data
==
NULL
)
{
std
::
cout
<<
"Error: input image for detection is empty"
<<
std
::
endl
;
return
;
}
if
(
mask
.
data
!=
NULL
&&
(
mask
.
size
()
!=
image
.
size
()
||
mask
.
type
()
!=
CV_8UC1
)
)
throw
std
::
runtime_error
(
"Mask error while detecting lines: please check its dimensions and that data type is CV_8UC1"
);
...
...
@@ -361,6 +407,13 @@ void BinaryDescriptor::detect( const Mat& image, CV_OUT std::vector<KeyLine>& ke
/* requires line detection (more than one image) */
void
BinaryDescriptor
::
detect
(
const
std
::
vector
<
Mat
>&
images
,
std
::
vector
<
std
::
vector
<
KeyLine
>
>&
keylines
,
const
std
::
vector
<
Mat
>&
masks
)
const
{
if
(
images
.
size
()
==
0
)
{
std
::
cout
<<
"Error: input image for detection is empty"
<<
std
::
endl
;
return
;
}
/* detect lines from each image */
for
(
size_t
counter
=
0
;
counter
<
images
.
size
();
counter
++
)
{
...
...
@@ -444,18 +497,18 @@ void BinaryDescriptor::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& ke
}
/* requires descriptors computation (only one image) */
void
BinaryDescriptor
::
compute
(
const
Mat
&
image
,
CV_OUT
CV_IN_OUT
std
::
vector
<
KeyLine
>&
keylines
,
CV_OUT
Mat
&
descriptors
,
bool
returnFloatDescr
,
bool
useDetectionData
)
const
void
BinaryDescriptor
::
compute
(
const
Mat
&
image
,
CV_OUT
CV_IN_OUT
std
::
vector
<
KeyLine
>&
keylines
,
CV_OUT
Mat
&
descriptors
,
bool
returnFloatDescr
)
const
{
computeImpl
(
image
,
keylines
,
descriptors
,
returnFloatDescr
,
useDetectionData
);
computeImpl
(
image
,
keylines
,
descriptors
,
returnFloatDescr
,
false
);
}
/* requires descriptors computation (more than one image) */
void
BinaryDescriptor
::
compute
(
const
std
::
vector
<
Mat
>&
images
,
std
::
vector
<
std
::
vector
<
KeyLine
>
>&
keylines
,
std
::
vector
<
Mat
>&
descriptors
,
bool
returnFloatDescr
,
bool
useDetectionData
)
const
bool
returnFloatDescr
)
const
{
for
(
size_t
i
=
0
;
i
<
images
.
size
();
i
++
)
computeImpl
(
images
[
i
],
keylines
[
i
],
descriptors
[
i
],
returnFloatDescr
,
useDetectionData
);
computeImpl
(
images
[
i
],
keylines
[
i
],
descriptors
[
i
],
returnFloatDescr
,
false
);
}
/* implementation of descriptors computation */
...
...
@@ -621,7 +674,6 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines )
/* loop over number of octaves */
for
(
int
octaveCount
=
0
;
octaveCount
<
params
.
numOfOctave_
;
octaveCount
++
)
{
/* matrix storing results from blurring processes */
cv
::
Mat
blur
;
...
...
@@ -631,7 +683,7 @@ int BinaryDescriptor::OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines )
images_sizes
[
octaveCount
]
=
blur
.
size
();
/* for current octave, extract lines */
if
(
(
edLineVec_
[
octaveCount
]
->
EDline
(
blur
,
true
)
)
!=
1
)
if
(
(
edLineVec_
[
octaveCount
]
->
EDline
(
blur
)
)
!=
1
)
{
return
-
1
;
}
...
...
modules/line_descriptor/src/draw.cpp
View file @
1c246d47
...
...
@@ -97,13 +97,15 @@ void drawLineMatches( const Mat& img1, const std::vector<KeyLine>& keylines1, co
for
(
size_t
i
=
0
;
i
<
keylines1
.
size
();
i
++
)
{
KeyLine
k1
=
keylines1
[
i
];
line
(
outImg
,
Point2f
(
k1
.
startPointX
,
k1
.
startPointY
),
Point2f
(
k1
.
endPointX
,
k1
.
endPointY
),
singleLineColorRGB
,
2
);
//line( outImg, Point2f( k1.startPointX, k1.startPointY ), Point2f( k1.endPointX, k1.endPointY ), singleLineColorRGB, 2 );
line
(
outImg
,
Point2f
(
k1
.
sPointInOctaveX
,
k1
.
sPointInOctaveY
),
Point2f
(
k1
.
ePointInOctaveX
,
k1
.
ePointInOctaveY
),
singleLineColorRGB
,
2
);
}
for
(
size_t
j
=
0
;
j
<
keylines2
.
size
();
j
++
)
{
KeyLine
k2
=
keylines2
[
j
];
line
(
outImg
,
Point2f
(
k2
.
s
tartPointX
+
offset
,
k2
.
startPointY
),
Point2f
(
k2
.
endPointX
+
offset
,
k2
.
endPoint
Y
),
singleLineColorRGB
,
2
);
line
(
outImg
,
Point2f
(
k2
.
s
PointInOctaveX
+
offset
,
k2
.
sPointInOctaveY
),
Point2f
(
k2
.
ePointInOctaveX
+
offset
,
k2
.
ePointInOctave
Y
),
singleLineColorRGB
,
2
);
}
}
...
...
@@ -133,13 +135,21 @@ void drawLineMatches( const Mat& img1, const std::vector<KeyLine>& keylines1, co
matchColorRGB
=
matchColor
;
/* draw lines if necessary */
line
(
outImg
,
Point2f
(
left
.
startPointX
,
left
.
startPointY
),
Point2f
(
left
.
endPointX
,
left
.
endPointY
),
singleLineColorRGB
,
2
);
// line( outImg, Point2f( left.startPointX, left.startPointY ), Point2f( left.endPointX, left.endPointY ), singleLineColorRGB, 2 );
//
// line( outImg, Point2f( right.startPointX + offset, right.startPointY ), Point2f( right.endPointX + offset, right.endPointY ), singleLineColorRGB,
// 2 );
//
// /* link correspondent lines */
// line( outImg, Point2f( left.startPointX, left.startPointY ), Point2f( right.startPointX + offset, right.startPointY ), matchColorRGB, 1 );
line
(
outImg
,
Point2f
(
left
.
sPointInOctaveX
,
left
.
sPointInOctaveY
),
Point2f
(
left
.
ePointInOctaveX
,
left
.
ePointInOctaveY
),
singleLineColorRGB
,
2
);
line
(
outImg
,
Point2f
(
right
.
startPointX
+
offset
,
right
.
startPointY
),
Point2f
(
right
.
endPointX
+
offset
,
right
.
endPoint
Y
),
singleLineColorRGB
,
2
);
line
(
outImg
,
Point2f
(
right
.
sPointInOctaveX
+
offset
,
right
.
sPointInOctaveY
),
Point2f
(
right
.
ePointInOctaveX
+
offset
,
right
.
ePointInOctave
Y
),
singleLineColorRGB
,
2
);
/* link correspondent lines */
line
(
outImg
,
Point2f
(
left
.
startPointX
,
left
.
startPointY
),
Point2f
(
right
.
startPointX
+
offset
,
right
.
startPoint
Y
),
matchColorRGB
,
1
);
/* link correspondent lines */
line
(
outImg
,
Point2f
(
left
.
sPointInOctaveX
,
left
.
sPointInOctaveY
),
Point2f
(
right
.
sPointInOctaveX
+
offset
,
right
.
sPointInOctave
Y
),
matchColorRGB
,
1
);
}
}
}
...
...
modules/line_descriptor/src/ed_line_detector.cpp
View file @
1c246d47
...
...
@@ -117,18 +117,12 @@ EDLineDetector::~EDLineDetector()
}
}
int
EDLineDetector
::
EdgeDrawing
(
cv
::
Mat
&
image
,
EdgeChains
&
edgeChains
,
bool
smoothed
)
int
EDLineDetector
::
EdgeDrawing
(
cv
::
Mat
&
image
,
EdgeChains
&
edgeChains
)
{
imageWidth
=
image
.
cols
;
imageHeight
=
image
.
rows
;
unsigned
int
pixelNum
=
imageWidth
*
imageHeight
;
/*if( !smoothed )
{ //input image hasn't been smoothed.
cv::Mat InImage = image.clone();
cv::GaussianBlur( InImage, image, cv::Size( ksize_, ksize_ ), sigma_ );
}*/
unsigned
int
edgePixelArraySize
=
pixelNum
/
5
;
unsigned
int
maxNumOfEdge
=
edgePixelArraySize
/
20
;
//compute dx, dy images
...
...
@@ -925,12 +919,12 @@ int EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &edgeChains, bool sm
return
1
;
}
int
EDLineDetector
::
EDline
(
cv
::
Mat
&
image
,
LineChains
&
lines
,
bool
smoothed
)
int
EDLineDetector
::
EDline
(
cv
::
Mat
&
image
,
LineChains
&
lines
)
{
//first, call EdgeDrawing function to extract edges
EdgeChains
edges
;
if
(
(
EdgeDrawing
(
image
,
edges
,
smoothed
)
)
!=
1
)
if
(
(
EdgeDrawing
(
image
,
edges
)
)
!=
1
)
{
cout
<<
"Line Detection not finished"
<<
endl
;
return
-
1
;
...
...
@@ -1411,9 +1405,9 @@ bool EDLineDetector::LineValidation_( unsigned int *xCors, unsigned int *yCors,
}
}
int
EDLineDetector
::
EDline
(
cv
::
Mat
&
image
,
bool
smoothed
)
int
EDLineDetector
::
EDline
(
cv
::
Mat
&
image
)
{
if
(
(
EDline
(
image
,
lines_
,
smoothed
)
)
!=
1
)
if
(
(
EDline
(
image
,
lines_
/*, smoothed*/
)
)
!=
1
)
{
return
-
1
;
}
...
...
modules/line_descriptor/test/test_detector_regression.cpp
0 → 100644
View file @
1c246d47
This diff is collapsed.
Click to expand it.
modules/line_descriptor/test/test_main.cpp
0 → 100644
View file @
1c246d47
#include "test_precomp.hpp"
CV_TEST_MAIN
(
"cv"
)
modules/line_descriptor/test/test_precomp.hpp
0 → 100644
View file @
1c246d47
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations"
# if defined __clang__ || defined __APPLE__
# pragma GCC diagnostic ignored "-Wmissing-prototypes"
# pragma GCC diagnostic ignored "-Wextra"
# endif
#endif
#ifndef __OPENCV_TEST_PRECOMP_HPP__
#define __OPENCV_TEST_PRECOMP_HPP__
#include "opencv2/opencv.hpp"
#include "opencv2/ts.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/line_descriptor.hpp"
#include <opencv2/core.hpp>
#include <iostream>
#include <string.h>
#endif
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