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
a9b8fb83
Commit
a9b8fb83
authored
Oct 20, 2017
by
Vitaly Tuzov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GaussianBlur of the source image for LATCH descriptor made optional
parent
0bd061f0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
xfeatures2d.hpp
modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
+2
-1
latch.cpp
modules/xfeatures2d/src/latch.cpp
+22
-9
No files found.
modules/xfeatures2d/include/opencv2/xfeatures2d.hpp
View file @
a9b8fb83
...
...
@@ -160,6 +160,7 @@ LATCH is a binary descriptor based on learned comparisons of triplets of image p
* rotationInvariance - whether or not the descriptor should compansate for orientation changes.
* half_ssd_size - the size of half of the mini-patches size. For example, if we would like to compare triplets of patches of size 7x7x
then the half_ssd_size should be (7-1)/2 = 3.
* sigma - sigma value for GaussianBlur smoothing of the source image. Source image will be used without smoothing in case sigma value is 0.
Note: the descriptor can be coupled with any keypoint extractor. The only demand is that if you use set rotationInvariance = True then
you will have to use an extractor which estimates the patch orientation (in degrees). Examples for such extractors are ORB and SIFT.
...
...
@@ -170,7 +171,7 @@ Note: a complete example can be found under /samples/cpp/tutorial_code/xfeatures
class
CV_EXPORTS_W
LATCH
:
public
Feature2D
{
public
:
CV_WRAP
static
Ptr
<
LATCH
>
create
(
int
bytes
=
32
,
bool
rotationInvariance
=
true
,
int
half_ssd_size
=
3
);
CV_WRAP
static
Ptr
<
LATCH
>
create
(
int
bytes
=
32
,
bool
rotationInvariance
=
true
,
int
half_ssd_size
=
3
,
double
sigma
=
2.0
);
};
/** @brief Class implementing DAISY descriptor, described in @cite Tola10
...
...
modules/xfeatures2d/src/latch.cpp
View file @
a9b8fb83
...
...
@@ -63,7 +63,7 @@ namespace cv
public
:
enum
{
PATCH_SIZE
=
48
};
LATCHDescriptorExtractorImpl
(
int
bytes
=
32
,
bool
rotationInvariance
=
true
,
int
half_ssd_size
=
3
);
LATCHDescriptorExtractorImpl
(
int
bytes
=
32
,
bool
rotationInvariance
=
true
,
int
half_ssd_size
=
3
,
double
sigma
=
2.0
);
virtual
void
read
(
const
FileNode
&
);
virtual
void
write
(
FileStorage
&
)
const
;
...
...
@@ -81,14 +81,15 @@ namespace cv
PixelTestFn
test_fn_
;
bool
rotationInvariance_
;
int
half_ssd_size_
;
double
sigma_
;
std
::
vector
<
int
>
sampling_points_
;
};
Ptr
<
LATCH
>
LATCH
::
create
(
int
bytes
,
bool
rotationInvariance
,
int
half_ssd_size
)
Ptr
<
LATCH
>
LATCH
::
create
(
int
bytes
,
bool
rotationInvariance
,
int
half_ssd_size
,
double
sigma
)
{
return
makePtr
<
LATCHDescriptorExtractorImpl
>
(
bytes
,
rotationInvariance
,
half_ssd_size
);
return
makePtr
<
LATCHDescriptorExtractorImpl
>
(
bytes
,
rotationInvariance
,
half_ssd_size
,
sigma
);
}
void
CalcuateSums
(
int
count
,
const
std
::
vector
<
int
>
&
points
,
bool
rotationInvariance
,
const
Mat
&
grayImage
,
const
KeyPoint
&
pt
,
int
&
suma
,
int
&
sumc
,
float
cos_theta
,
float
sin_theta
,
int
half_ssd_size
);
...
...
@@ -403,8 +404,8 @@ namespace cv
LATCHDescriptorExtractorImpl
::
LATCHDescriptorExtractorImpl
(
int
bytes
,
bool
rotationInvariance
,
int
half_ssd_size
)
:
bytes_
(
bytes
),
test_fn_
(
NULL
),
rotationInvariance_
(
rotationInvariance
),
half_ssd_size_
(
half_ssd_size
)
LATCHDescriptorExtractorImpl
::
LATCHDescriptorExtractorImpl
(
int
bytes
,
bool
rotationInvariance
,
int
half_ssd_size
,
double
sigma
)
:
bytes_
(
bytes
),
test_fn_
(
NULL
),
rotationInvariance_
(
rotationInvariance
),
half_ssd_size_
(
half_ssd_size
)
,
sigma_
(
sigma
)
{
switch
(
bytes
)
{
...
...
@@ -502,11 +503,23 @@ namespace cv
Mat
grayImage
;
GaussianBlur
(
image
,
grayImage
,
cv
::
Size
(
3
,
3
),
2
,
2
);
if
(
image
.
type
()
!=
CV_8U
)
cvtColor
(
image
,
grayImage
,
COLOR_BGR2GRAY
);
switch
(
image
.
type
())
{
case
CV_8UC1
:
grayImage
=
image
;
break
;
case
CV_8UC3
:
cvtColor
(
image
,
grayImage
,
COLOR_BGR2GRAY
);
break
;
case
CV_8UC4
:
cvtColor
(
image
,
grayImage
,
COLOR_BGRA2GRAY
);
break
;
default
:
CV_Error
(
Error
::
StsBadArg
,
"Image should be 8UC1, 8UC3 or 8UC4"
);
}
if
(
sigma_
!=
0.
)
GaussianBlur
(
grayImage
,
grayImage
,
cv
::
Size
(
3
,
3
),
sigma_
,
sigma_
);
//Remove keypoints very close to the border
KeyPointsFilter
::
runByImageBorder
(
keypoints
,
image
.
size
(),
PATCH_SIZE
/
2
+
half_ssd_size_
);
...
...
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