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
5a730d09
Commit
5a730d09
authored
Oct 15, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix binary compatibility of opencv_features2d
parent
88e9a072
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
18 deletions
+52
-18
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+4
-5
perf_fast.cpp
modules/features2d/perf/perf_fast.cpp
+5
-2
brisk.cpp
modules/features2d/src/brisk.cpp
+3
-3
fast.cpp
modules/features2d/src/fast.cpp
+19
-6
fast_score.hpp
modules/features2d/src/fast_score.hpp
+13
-0
features2d_init.cpp
modules/features2d/src/features2d_init.cpp
+6
-0
test_fast.cpp
modules/features2d/test/test_fast.cpp
+2
-2
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
5a730d09
...
...
@@ -566,19 +566,19 @@ protected:
CV_EXPORTS
void
FAST
(
InputArray
image
,
CV_OUT
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmaxSupression
=
true
);
CV_EXPORTS
void
FAST
(
InputArray
image
,
CV_OUT
vector
<
KeyPoint
>&
keypoints
,
CV_EXPORTS
void
FAST
X
(
InputArray
image
,
CV_OUT
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmaxSupression
,
int
type
);
class
CV_EXPORTS_W
FastFeatureDetector
:
public
FeatureDetector
{
public
:
enum
{
{
// Define it in old class to simplify migration to 2.5
TYPE_5_8
=
0
,
TYPE_7_12
=
1
,
TYPE_9_16
=
2
};
CV_WRAP
FastFeatureDetector
(
int
threshold
=
10
,
bool
nonmaxSuppression
=
true
);
CV_WRAP
FastFeatureDetector
(
int
threshold
,
bool
nonmaxSuppression
,
int
type
);
CV_WRAP
FastFeatureDetector
(
int
threshold
=
10
,
bool
nonmaxSuppression
=
true
);
AlgorithmInfo
*
info
()
const
;
protected
:
...
...
@@ -586,7 +586,6 @@ protected:
int
threshold
;
bool
nonmaxSuppression
;
short
type
;
};
...
...
modules/features2d/perf/perf_fast.cpp
View file @
5a730d09
...
...
@@ -30,10 +30,13 @@ PERF_TEST_P(fast, detect, testing::Combine(
declare
.
in
(
frame
);
FastFeatureDetector
fd
(
20
,
true
,
type
);
Ptr
<
FeatureDetector
>
fd
=
Algorithm
::
create
<
FeatureDetector
>
(
"Feature2D.FASTX"
);
fd
->
set
(
"threshold"
,
20
);
fd
->
set
(
"nonmaxSuppression"
,
true
);
fd
->
set
(
"type"
,
type
);
vector
<
KeyPoint
>
points
;
TEST_CYCLE
()
fd
.
detect
(
frame
,
points
);
TEST_CYCLE
()
fd
->
detect
(
frame
,
points
);
SANITY_CHECK_KEYPOINTS
(
points
);
}
...
...
modules/features2d/src/brisk.cpp
View file @
5a730d09
...
...
@@ -121,7 +121,7 @@ private:
float
scale_
;
float
offset_
;
// agast
cv
::
Ptr
<
cv
::
FastFeatureDetector
>
fast_9_16_
;
cv
::
Ptr
<
cv
::
FastFeatureDetector
2
>
fast_9_16_
;
int
pixel_5_8_
[
25
];
int
pixel_9_16_
[
25
];
};
...
...
@@ -2000,7 +2000,7 @@ BriskLayer::BriskLayer(const cv::Mat& img_in, float scale_in, float offset_in)
scale_
=
scale_in
;
offset_
=
offset_in
;
// create an agast detector
fast_9_16_
=
new
FastFeatureDetector
(
1
,
true
,
FastFeatureDetector
::
TYPE_9_16
);
fast_9_16_
=
new
FastFeatureDetector
2
(
1
,
true
,
FastFeatureDetector
::
TYPE_9_16
);
makeOffsets
(
pixel_5_8_
,
(
int
)
img_
.
step
,
8
);
makeOffsets
(
pixel_9_16_
,
(
int
)
img_
.
step
,
16
);
}
...
...
@@ -2022,7 +2022,7 @@ BriskLayer::BriskLayer(const BriskLayer& layer, int mode)
offset_
=
0.5
f
*
scale_
-
0.5
f
;
}
scores_
=
cv
::
Mat
::
zeros
(
img_
.
rows
,
img_
.
cols
,
CV_8U
);
fast_9_16_
=
new
FastFeatureDetector
(
1
,
false
,
FastFeatureDetector
::
TYPE_9_16
);
fast_9_16_
=
new
FastFeatureDetector
2
(
1
,
false
,
FastFeatureDetector
::
TYPE_9_16
);
makeOffsets
(
pixel_5_8_
,
(
int
)
img_
.
step
,
8
);
makeOffsets
(
pixel_9_16_
,
(
int
)
img_
.
step
,
16
);
}
...
...
modules/features2d/src/fast.cpp
View file @
5a730d09
...
...
@@ -245,7 +245,7 @@ void FAST_t(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bo
}
}
void
FAST
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmax_suppression
,
int
type
)
void
FAST
X
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmax_suppression
,
int
type
)
{
switch
(
type
)
{
case
FastFeatureDetector
:
:
TYPE_5_8
:
...
...
@@ -262,24 +262,37 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
void
FAST
(
InputArray
_img
,
std
::
vector
<
KeyPoint
>&
keypoints
,
int
threshold
,
bool
nonmax_suppression
)
{
FAST
(
_img
,
keypoints
,
threshold
,
nonmax_suppression
,
FastFeatureDetector
::
TYPE_9_16
);
FAST
X
(
_img
,
keypoints
,
threshold
,
nonmax_suppression
,
FastFeatureDetector
::
TYPE_9_16
);
}
/*
* FastFeatureDetector
*/
FastFeatureDetector
::
FastFeatureDetector
(
int
_threshold
,
bool
_nonmaxSuppression
)
:
threshold
(
_threshold
),
nonmaxSuppression
(
_nonmaxSuppression
),
type
(
FastFeatureDetector
::
TYPE_9_16
)
:
threshold
(
_threshold
),
nonmaxSuppression
(
_nonmaxSuppression
)
{}
FastFeatureDetector2
::
FastFeatureDetector2
(
int
_threshold
,
bool
_nonmaxSuppression
)
:
FastFeatureDetector
(
_threshold
,
_nonmaxSuppression
),
type
(
FastFeatureDetector
::
TYPE_9_16
)
{}
FastFeatureDetector
::
FastFeatureDetector
(
int
_threshold
,
bool
_nonmaxSuppression
,
int
_type
)
:
threshold
(
_threshold
),
nonmaxSuppression
(
_nonmaxSuppression
),
type
((
short
)
_type
)
FastFeatureDetector
2
::
FastFeatureDetector2
(
int
_threshold
,
bool
_nonmaxSuppression
,
int
_type
)
:
FastFeatureDetector
(
_threshold
,
_nonmaxSuppression
),
type
((
short
)
_type
)
{}
void
FastFeatureDetector
::
detectImpl
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
,
const
Mat
&
mask
)
const
{
Mat
grayImage
=
image
;
if
(
image
.
type
()
!=
CV_8U
)
cvtColor
(
image
,
grayImage
,
CV_BGR2GRAY
);
FAST
(
grayImage
,
keypoints
,
threshold
,
nonmaxSuppression
,
type
);
FAST
(
grayImage
,
keypoints
,
threshold
,
nonmaxSuppression
);
KeyPointsFilter
::
runByPixelsMask
(
keypoints
,
mask
);
}
void
FastFeatureDetector2
::
detectImpl
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
,
const
Mat
&
mask
)
const
{
Mat
grayImage
=
image
;
if
(
image
.
type
()
!=
CV_8U
)
cvtColor
(
image
,
grayImage
,
CV_BGR2GRAY
);
FASTX
(
grayImage
,
keypoints
,
threshold
,
nonmaxSuppression
,
type
);
KeyPointsFilter
::
runByPixelsMask
(
keypoints
,
mask
);
}
...
...
modules/features2d/src/fast_score.hpp
View file @
5a730d09
...
...
@@ -56,6 +56,19 @@ void makeOffsets(int pixel[25], int row_stride, int patternSize);
template
<
int
patternSize
>
int
cornerScore
(
const
uchar
*
ptr
,
const
int
pixel
[],
int
threshold
);
class
FastFeatureDetector2
:
public
FastFeatureDetector
{
public
:
CV_WRAP
FastFeatureDetector2
(
int
threshold
=
10
,
bool
nonmaxSuppression
=
true
);
CV_WRAP
FastFeatureDetector2
(
int
threshold
,
bool
nonmaxSuppression
,
int
type
);
AlgorithmInfo
*
info
()
const
;
protected
:
virtual
void
detectImpl
(
const
Mat
&
image
,
vector
<
KeyPoint
>&
keypoints
,
const
Mat
&
mask
=
Mat
()
)
const
;
short
type
;
};
}
#endif
...
...
modules/features2d/src/features2d_init.cpp
View file @
5a730d09
...
...
@@ -41,6 +41,7 @@
//M*/
#include "precomp.hpp"
#include "fast_score.hpp"
using
namespace
cv
;
...
...
@@ -68,6 +69,10 @@ CV_INIT_ALGORITHM(BriefDescriptorExtractor, "Feature2D.BRIEF",
///////////////////////////////////////////////////////////////////////////////////////////////////////////
CV_INIT_ALGORITHM
(
FastFeatureDetector
,
"Feature2D.FAST"
,
obj
.
info
()
->
addParam
(
obj
,
"threshold"
,
obj
.
threshold
);
obj
.
info
()
->
addParam
(
obj
,
"nonmaxSuppression"
,
obj
.
nonmaxSuppression
));
CV_INIT_ALGORITHM
(
FastFeatureDetector2
,
"Feature2D.FASTX"
,
obj
.
info
()
->
addParam
(
obj
,
"threshold"
,
obj
.
threshold
);
obj
.
info
()
->
addParam
(
obj
,
"nonmaxSuppression"
,
obj
.
nonmaxSuppression
);
obj
.
info
()
->
addParam
(
obj
,
"type"
,
obj
.
type
));
...
...
@@ -167,6 +172,7 @@ bool cv::initModule_features2d(void)
all
&=
!
BriefDescriptorExtractor_info_auto
.
name
().
empty
();
all
&=
!
BRISK_info_auto
.
name
().
empty
();
all
&=
!
FastFeatureDetector_info_auto
.
name
().
empty
();
all
&=
!
FastFeatureDetector2_info_auto
.
name
().
empty
();
all
&=
!
StarDetector_info_auto
.
name
().
empty
();
all
&=
!
MSER_info_auto
.
name
().
empty
();
all
&=
!
FREAK_info_auto
.
name
().
empty
();
...
...
modules/features2d/test/test_fast.cpp
View file @
5a730d09
...
...
@@ -75,8 +75,8 @@ void CV_FastTest::run( int )
vector
<
KeyPoint
>
keypoints1
;
vector
<
KeyPoint
>
keypoints2
;
FAST
(
gray1
,
keypoints1
,
30
,
true
,
type
);
FAST
(
gray2
,
keypoints2
,
(
type
>
0
?
30
:
20
),
true
,
type
);
FAST
X
(
gray1
,
keypoints1
,
30
,
true
,
type
);
FAST
X
(
gray2
,
keypoints2
,
(
type
>
0
?
30
:
20
),
true
,
type
);
for
(
size_t
i
=
0
;
i
<
keypoints1
.
size
();
++
i
)
{
...
...
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