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
f3b4dd1f
Commit
f3b4dd1f
authored
Jul 25, 2014
by
biagio montesano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EDLine porting completed
parent
b2484cfd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
13 deletions
+57
-13
descriptor.hpp
...descriptor/include/opencv2/line_descriptor/descriptor.hpp
+37
-9
ed_line_detector.hpp
...ptor/include/opencv2/line_descriptor/ed_line_detector.hpp
+0
-0
compute_descriptors.cpp
modules/line_descriptor/samples/compute_descriptors.cpp
+17
-2
lines_extraction.cpp
modules/line_descriptor/samples/lines_extraction.cpp
+3
-2
binary_descriptor.cpp
modules/line_descriptor/src/binary_descriptor.cpp
+0
-0
ed_line_detector.cpp
modules/line_descriptor/src/ed_line_detector.cpp
+0
-0
No files found.
modules/line_descriptor/include/opencv2/line_descriptor/descriptor.hpp
View file @
f3b4dd1f
...
...
@@ -123,6 +123,9 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
CV_PROP_RW
int
reductionRatio
;
CV_PROP_RW
int
ksize_
;
/* read parameters from a FileNode object and store them (struct function) */
void
read
(
const
FileNode
&
fn
);
...
...
@@ -131,6 +134,15 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
};
struct
CV_EXPORTS
LineDetectionMode
{
enum
{
LSD_DETECTOR
=
0
,
// detect lines using LSD
EDL_DETECTOR
=
1
// detect lines using EDLines
};
};
/* constructor */
CV_WRAP
BinaryDescriptor
(
const
BinaryDescriptor
::
Params
&
parameters
=
BinaryDescriptor
::
Params
()
);
...
...
@@ -158,18 +170,21 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
/* requires line detection (only one image) */
CV_WRAP
void
detect
(
const
Mat
&
image
,
CV_OUT
std
::
vector
<
KeyLine
>&
keypoints
,
const
Mat
&
mask
=
Mat
()
);
void
detect
(
const
Mat
&
image
,
CV_OUT
std
::
vector
<
KeyLine
>&
keypoints
,
const
Mat
&
mask
=
Mat
()
,
int
flags
=
LineDetectionMode
::
LSD_DETECTOR
);
/* requires line detection (more than one image) */
void
detect
(
const
std
::
vector
<
Mat
>&
images
,
std
::
vector
<
std
::
vector
<
KeyLine
>
>&
keylines
,
const
std
::
vector
<
Mat
>&
masks
=
std
::
vector
<
Mat
>
()
)
const
;
void
detect
(
const
std
::
vector
<
Mat
>&
images
,
std
::
vector
<
std
::
vector
<
KeyLine
>
>&
keylines
,
const
std
::
vector
<
Mat
>&
masks
=
std
::
vector
<
Mat
>
(),
int
flags
=
LineDetectionMode
::
LSD_DETECTOR
)
const
;
/* 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
)
const
;
void
compute
(
const
Mat
&
image
,
CV_OUT
CV_IN_OUT
std
::
vector
<
KeyLine
>&
keylines
,
CV_OUT
Mat
&
descriptors
,
bool
returnFloatDescr
=
false
,
int
flags
=
LineDetectionMode
::
LSD_DETECTOR
)
const
;
/* requires descriptors computation (more than one image) */
void
compute
(
const
std
::
vector
<
Mat
>&
images
,
std
::
vector
<
std
::
vector
<
KeyLine
>
>&
keylines
,
std
::
vector
<
Mat
>&
descriptors
,
bool
returnFloatDescr
=
false
)
const
;
void
compute
(
const
std
::
vector
<
Mat
>&
images
,
std
::
vector
<
std
::
vector
<
KeyLine
>
>&
keylines
,
std
::
vector
<
Mat
>&
descriptors
,
bool
returnFloatDescr
=
false
,
int
flags
=
LineDetectionMode
::
LSD_DETECTOR
)
const
;
/*return descriptor size */
int
descriptorSize
()
const
;
...
...
@@ -186,14 +201,14 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
/* definition of operator () */
CV_WRAP_AS
(
detectAndCompute
)
virtual
void
operator
()(
InputArray
image
,
InputArray
mask
,
CV_OUT
std
::
vector
<
KeyLine
>&
keylines
,
OutputArray
descriptors
,
bool
useProvidedKeyLines
=
false
,
bool
returnFloatDescr
=
false
)
const
;
bool
useProvidedKeyLines
=
false
,
bool
returnFloatDescr
=
false
,
int
flags
=
LineDetectionMode
::
LSD_DETECTOR
)
const
;
protected
:
/* implementation of line detection */
virtual
void
detectImpl
(
const
Mat
&
imageSrc
,
std
::
vector
<
KeyLine
>&
keylines
,
const
Mat
&
mask
=
Mat
()
)
const
;
virtual
void
detectImpl
(
const
Mat
&
imageSrc
,
std
::
vector
<
KeyLine
>&
keylines
,
int
flags
,
const
Mat
&
mask
=
Mat
()
)
const
;
/* implementation of descriptors' computation */
virtual
void
computeImpl
(
const
Mat
&
imageSrc
,
std
::
vector
<
KeyLine
>&
keylines
,
Mat
&
descriptors
,
bool
returnFloatDescr
)
const
;
virtual
void
computeImpl
(
const
Mat
&
imageSrc
,
std
::
vector
<
KeyLine
>&
keylines
,
Mat
&
descriptors
,
bool
returnFloatDescr
,
int
flags
)
const
;
/* function inherited from Algorithm */
AlgorithmInfo
*
info
()
const
;
...
...
@@ -203,7 +218,10 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
unsigned
char
binaryConversion
(
float
*
f1
,
float
*
f2
);
/* compute LBD descriptors */
int
computeLBD
(
ScaleLines
&
keyLines
);
int
computeLBD
(
ScaleLines
&
keyLines
,
int
flags
);
/* compute LBD descriptors using EDLine extractor */
int
computeLBD_EDL
(
ScaleLines
&
keyLines
);
/* compute Gaussian pyramid of input image */
void
computeGaussianPyramid
(
const
Mat
&
image
);
...
...
@@ -212,6 +230,10 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
Each group contains the same line, detected in different octaves */
int
OctaveKeyLines
(
ScaleLines
&
keyLines
);
/* gather lines in groups using EDLine extractor.
Each group contains the same line, detected in different octaves */
int
OctaveKeyLines_EDL
(
cv
::
Mat
&
image
,
ScaleLines
&
keyLines
);
/* get coefficients of line passing by two points (in line_extremes) */
void
getLineParameters
(
cv
::
Vec4i
&
line_extremes
,
cv
::
Vec3i
&
lineParams
);
...
...
@@ -239,6 +261,12 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
/* vector to store the Gaussian pyramid od an input image */
std
::
vector
<
cv
::
Mat
>
octaveImages
;
/*For each octave of image, we define an EDLineDetector, because we can get gradient images (dxImg, dyImg, gImg)
*from the EDLineDetector class without extra computation cost. Another reason is that, if we use
*a single EDLineDetector to detect lines in different octave of images, then we need to allocate and release
*memory for gradient images (dxImg, dyImg, gImg) repeatedly for their varying size*/
std
::
vector
<
EDLineDetector
*>
edLineVec_
;
};
class
CV_EXPORTS_W
BinaryDescriptorMatcher
:
public
Algorithm
...
...
modules/line_descriptor/include/opencv2/line_descriptor/ed_line_detector.hpp
View file @
f3b4dd1f
This diff is collapsed.
Click to expand it.
modules/line_descriptor/samples/compute_descriptors.cpp
View file @
f3b4dd1f
...
...
@@ -61,6 +61,20 @@ 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 */
...
...
@@ -88,7 +102,7 @@ int main( int argc, char** argv )
/* compute lines */
std
::
vector
<
KeyLine
>
keylines
;
bd
->
detect
(
imageMat
,
keylines
,
mask
);
bd
->
detect
(
imageMat
,
keylines
,
mask
,
1
);
/* select only lines from first octave */
std
::
vector
<
KeyLine
>
octave0
;
...
...
@@ -101,6 +115,7 @@ int main( int argc, char** argv )
/* compute descriptors */
cv
::
Mat
descriptors
;
bd
->
compute
(
imageMat
,
octave0
,
descriptors
);
bd
->
compute
(
imageMat
,
octave0
,
descriptors
,
false
,
1
);
writeMat
(
descriptors
,
"bd_descriptors"
,
0
);
}
modules/line_descriptor/samples/lines_extraction.cpp
View file @
f3b4dd1f
...
...
@@ -90,10 +90,11 @@ int main( int argc, char** argv )
vector
<
KeyLine
>
lines
;
/* extract lines */
bd
->
detect
(
imageMat
,
lines
,
mask
);
cv
::
Mat
output
=
imageMat
.
clone
();
bd
->
detect
(
imageMat
,
lines
,
mask
,
1
);
/* draw lines extracted from octave 0 */
cv
::
Mat
output
=
imageMat
.
clone
();
if
(
output
.
channels
()
==
1
)
cvtColor
(
output
,
output
,
COLOR_GRAY2BGR
);
for
(
size_t
i
=
0
;
i
<
lines
.
size
();
i
++
)
...
...
modules/line_descriptor/src/binary_descriptor.cpp
View file @
f3b4dd1f
This diff is collapsed.
Click to expand it.
modules/line_descriptor/src/ed_line_detector.cpp
0 → 100644
View file @
f3b4dd1f
This diff is collapsed.
Click to expand it.
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