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
5e64ac0a
Commit
5e64ac0a
authored
May 20, 2015
by
GilLevi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests and renamed LATCH
parent
f7c30998
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
7 deletions
+83
-7
xfeatures2d.hpp
modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
+2
-2
perf_latch.cpp
modules/xfeatures2d/perf/perf_latch.cpp
+34
-0
latch.cpp
modules/xfeatures2d/src/latch.cpp
+30
-5
test_features2d.cpp
modules/xfeatures2d/test/test_features2d.cpp
+7
-0
test_rotation_and_scale_invariance.cpp
...s/xfeatures2d/test/test_rotation_and_scale_invariance.cpp
+10
-0
No files found.
modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
View file @
5e64ac0a
...
...
@@ -166,10 +166,10 @@ Note: the descriptor can be coupled with any keypoint extractor. The only demand
Note: a complete example can be found under /samples/cpp/tutorial_code/xfeatures2D/latch_match.cpp
*/
class
CV_EXPORTS
LATCH
DescriptorExtractor
:
public
DescriptorExtractor
class
CV_EXPORTS
LATCH
:
public
DescriptorExtractor
{
public
:
static
Ptr
<
LATCH
DescriptorExtractor
>
create
(
int
bytes
=
32
,
bool
rotationInvariance
=
true
,
int
half_ssd_size
=
3
);
static
Ptr
<
LATCH
>
create
(
int
bytes
=
32
,
bool
rotationInvariance
=
true
,
int
half_ssd_size
=
3
);
};
...
...
modules/xfeatures2d/perf/perf_latch.cpp
0 → 100644
View file @
5e64ac0a
#include "perf_precomp.hpp"
using
namespace
std
;
using
namespace
cv
;
using
namespace
cv
::
xfeatures2d
;
using
namespace
perf
;
using
std
::
tr1
::
make_tuple
;
using
std
::
tr1
::
get
;
typedef
perf
::
TestBaseWithParam
<
std
::
string
>
latch
;
#define LATCH_IMAGES \
"cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\
"stitching/a3.png"
PERF_TEST_P
(
latch
,
extract
,
testing
::
Values
(
LATCH_IMAGES
))
{
string
filename
=
getDataPath
(
GetParam
());
Mat
frame
=
imread
(
filename
,
IMREAD_GRAYSCALE
);
ASSERT_FALSE
(
frame
.
empty
())
<<
"Unable to load source image "
<<
filename
;
Mat
mask
;
declare
.
in
(
frame
).
time
(
90
);
Ptr
<
SURF
>
detector
=
SURF
::
create
();
vector
<
KeyPoint
>
points
;
detector
->
detect
(
frame
,
points
,
mask
);
Ptr
<
LATCH
>
descriptor
=
LATCH
::
create
();
vector
<
uchar
>
descriptors
;
TEST_CYCLE
()
descriptor
->
compute
(
frame
,
points
,
descriptors
);
SANITY_CHECK
(
descriptors
,
1e-4
);
}
modules/xfeatures2d/src/latch.cpp
View file @
5e64ac0a
...
...
@@ -58,7 +58,7 @@ namespace cv
/*
* LATCH Descriptor
*/
class
LATCHDescriptorExtractorImpl
:
public
LATCH
DescriptorExtractor
class
LATCHDescriptorExtractorImpl
:
public
LATCH
{
public
:
enum
{
PATCH_SIZE
=
48
};
...
...
@@ -86,7 +86,7 @@ namespace cv
std
::
vector
<
int
>
sampling_points_
;
};
Ptr
<
LATCH
DescriptorExtractor
>
LATCHDescriptorExtractor
::
create
(
int
bytes
,
bool
rotationInvariance
,
int
half_ssd_size
)
Ptr
<
LATCH
>
LATCH
::
create
(
int
bytes
,
bool
rotationInvariance
,
int
half_ssd_size
)
{
return
makePtr
<
LATCHDescriptorExtractorImpl
>
(
bytes
,
rotationInvariance
,
half_ssd_size
);
}
...
...
@@ -488,10 +488,18 @@ namespace cv
fs
<<
"descriptorSize"
<<
bytes_
;
}
void
LATCHDescriptorExtractorImpl
::
compute
(
InputArray
image
,
void
LATCHDescriptorExtractorImpl
::
compute
(
InputArray
_
image
,
std
::
vector
<
KeyPoint
>&
keypoints
,
OutputArray
descriptors
)
OutputArray
_
descriptors
)
{
Mat
image
=
_image
.
getMat
();
if
(
image
.
empty
()
)
return
;
if
(
keypoints
.
empty
()
)
return
;
Mat
grayImage
;
GaussianBlur
(
image
,
grayImage
,
cv
::
Size
(
3
,
3
),
2
,
2
);
...
...
@@ -502,9 +510,26 @@ namespace cv
//Remove keypoints very close to the border
KeyPointsFilter
::
runByImageBorder
(
keypoints
,
image
.
size
(),
PATCH_SIZE
/
2
+
half_ssd_size_
);
bool
_1d
=
false
;
Mat
descriptors
;
_1d
=
_descriptors
.
kind
()
==
_InputArray
::
STD_VECTOR
&&
_descriptors
.
type
()
==
CV_8U
;
if
(
_1d
)
{
_descriptors
.
create
((
int
)
keypoints
.
size
()
*
bytes_
,
1
,
CV_8U
);
descriptors
=
_descriptors
.
getMat
().
reshape
(
1
,
(
int
)
keypoints
.
size
());
}
else
{
_descriptors
.
create
((
int
)
keypoints
.
size
(),
bytes_
,
CV_8U
);
descriptors
=
_descriptors
.
getMat
();
}
//_descriptors.create((int)keypoints.size(), bytes_, CV_8U);
// prepare descriptors as mat
//Mat descriptors = _descriptors.getMat();
descriptors
.
create
((
int
)
keypoints
.
size
(),
bytes_
,
CV_8U
);
test_fn_
(
grayImage
,
keypoints
,
descriptors
,
sampling_points_
,
rotationInvariance_
,
half_ssd_size_
);
}
...
...
modules/xfeatures2d/test/test_features2d.cpp
View file @
5e64ac0a
...
...
@@ -1032,6 +1032,13 @@ TEST( Features2d_DescriptorExtractor_LUCID, regression )
test
.
safe_run
();
}
TEST
(
Features2d_DescriptorExtractor_LATCH
,
regression
)
{
CV_DescriptorExtractorTest
<
Hamming
>
test
(
"descriptor-latch"
,
1
,
LATCH
::
create
()
);
test
.
safe_run
();
}
/*#if CV_SSE2
...
...
modules/xfeatures2d/test/test_rotation_and_scale_invariance.cpp
View file @
5e64ac0a
...
...
@@ -651,6 +651,16 @@ TEST(Features2d_RotationInvariance_Descriptor_SIFT, regression)
test
.
safe_run
();
}
TEST
(
Features2d_RotationInvariance_Descriptor_LATCH
,
regression
)
{
DescriptorRotationInvarianceTest
test
(
SIFT
::
create
(),
LATCH
::
create
(),
NORM_HAMMING
,
0.9999
f
);
test
.
safe_run
();
}
/*
* Detector's scale invariance check
*/
...
...
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