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
98763247
Commit
98763247
authored
Sep 24, 2010
by
Maria Dimashova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added DenseFeatureDetector
parent
a5910ac0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
35 deletions
+89
-35
features2d.hpp
modules/features2d/include/opencv2/features2d/features2d.hpp
+26
-0
detectors.cpp
modules/features2d/src/detectors.cpp
+63
-35
No files found.
modules/features2d/include/opencv2/features2d/features2d.hpp
View file @
98763247
...
...
@@ -1356,6 +1356,32 @@ protected:
CV_EXPORTS
Ptr
<
FeatureDetector
>
createFeatureDetector
(
const
string
&
detectorType
);
class
DenseFeatureDetector
:
public
FeatureDetector
{
public
:
DenseFeatureDetector
()
:
initFeatureScale
(
1
),
featureScaleLevels
(
1
),
featureScaleMul
(
0.1
f
),
initXyStep
(
6
),
initImgBound
(
0
),
varyXyStepWithScale
(
true
),
varyImgBoundWithScale
(
false
)
{}
DenseFeatureDetector
(
float
_initFeatureScale
,
int
_featureScaleLevels
=
1
,
float
_featureScaleMul
=
0.1
f
,
int
_initXyStep
=
6
,
int
_initImgBound
=
0
,
bool
_varyXyStepWithScale
=
true
,
bool
_varyImgBoundWithScale
=
false
)
:
initFeatureScale
(
_initFeatureScale
),
featureScaleLevels
(
_featureScaleLevels
),
featureScaleMul
(
_featureScaleMul
),
initXyStep
(
_initXyStep
),
initImgBound
(
_initImgBound
),
varyXyStepWithScale
(
_varyXyStepWithScale
),
varyImgBoundWithScale
(
_varyImgBoundWithScale
)
{}
protected
:
virtual
void
detectImpl
(
const
Mat
&
image
,
const
Mat
&
mask
,
vector
<
KeyPoint
>&
keypoints
)
const
=
0
;
float
initFeatureScale
;
int
featureScaleLevels
;
float
featureScaleMul
;
int
initXyStep
;
int
initImgBound
;
bool
varyXyStepWithScale
;
bool
varyImgBoundWithScale
;
};
/*
* Adapts a detector to partition the source image into a grid and detect
* points in each cell.
...
...
modules/features2d/src/detectors.cpp
View file @
98763247
...
...
@@ -334,44 +334,32 @@ void SurfFeatureDetector::detectImpl( const Mat& image, const Mat& mask,
surf
(
grayImage
,
mask
,
keypoints
);
}
Ptr
<
FeatureDetector
>
createFeatureDetector
(
const
string
&
detectorType
)
/*
* GridAdaptedFeatureDetector
*/
void
DenseFeatureDetector
::
detectImpl
(
const
Mat
&
image
,
const
Mat
&
mask
,
vector
<
KeyPoint
>&
keypoints
)
const
{
FeatureDetector
*
fd
=
0
;
if
(
!
detectorType
.
compare
(
"FAST"
)
)
{
fd
=
new
FastFeatureDetector
(
10
/*threshold*/
,
true
/*nonmax_suppression*/
);
}
else
if
(
!
detectorType
.
compare
(
"STAR"
)
)
{
fd
=
new
StarFeatureDetector
(
16
/*max_size*/
,
5
/*response_threshold*/
,
10
/*line_threshold_projected*/
,
8
/*line_threshold_binarized*/
,
5
/*suppress_nonmax_size*/
);
}
else
if
(
!
detectorType
.
compare
(
"SIFT"
)
)
{
fd
=
new
SiftFeatureDetector
(
SIFT
::
DetectorParams
::
GET_DEFAULT_THRESHOLD
(),
SIFT
::
DetectorParams
::
GET_DEFAULT_EDGE_THRESHOLD
());
}
else
if
(
!
detectorType
.
compare
(
"SURF"
)
)
{
fd
=
new
SurfFeatureDetector
(
400.
/*hessian_threshold*/
,
3
/*octaves*/
,
4
/*octave_layers*/
);
}
else
if
(
!
detectorType
.
compare
(
"MSER"
)
)
{
fd
=
new
MserFeatureDetector
(
5
/*delta*/
,
60
/*min_area*/
,
14400
/*_max_area*/
,
0.25
f
/*max_variation*/
,
0.2
/*min_diversity*/
,
200
/*max_evolution*/
,
1.01
/*area_threshold*/
,
0.003
/*min_margin*/
,
5
/*edge_blur_size*/
);
}
else
if
(
!
detectorType
.
compare
(
"GFTT"
)
)
{
fd
=
new
GoodFeaturesToTrackDetector
(
1000
/*maxCorners*/
,
0.01
/*qualityLevel*/
,
1.
/*minDistance*/
,
3
/*int _blockSize*/
,
false
/*useHarrisDetector*/
,
0.04
/*k*/
);
}
else
if
(
!
detectorType
.
compare
(
"HARRIS"
)
)
keypoints
.
clear
();
float
curScale
=
initFeatureScale
;
int
curStep
=
initXyStep
;
int
curBound
=
initImgBound
;
for
(
int
curLevel
=
0
;
curLevel
<
featureScaleLevels
;
curLevel
++
)
{
fd
=
new
GoodFeaturesToTrackDetector
(
1000
/*maxCorners*/
,
0.01
/*qualityLevel*/
,
1.
/*minDistance*/
,
3
/*int _blockSize*/
,
true
/*useHarrisDetector*/
,
0.04
/*k*/
);
for
(
int
x
=
curBound
;
x
<
image
.
cols
-
curBound
;
x
+=
curStep
)
{
for
(
int
y
=
curBound
;
y
<
image
.
rows
-
curBound
;
y
+=
curStep
)
{
keypoints
.
push_back
(
KeyPoint
(
static_cast
<
float
>
(
x
),
static_cast
<
float
>
(
y
),
curScale
)
);
}
}
curScale
=
curScale
*
featureScaleMul
;
if
(
varyXyStepWithScale
)
curStep
=
static_cast
<
int
>
(
curStep
*
featureScaleMul
+
0.5
f
);
if
(
varyImgBoundWithScale
)
curBound
=
static_cast
<
int
>
(
curBound
*
featureScaleMul
+
0.5
f
);
}
return
fd
;
removeInvalidPoints
(
mask
,
keypoints
);
}
/*
...
...
@@ -468,4 +456,44 @@ void PyramidAdaptedFeatureDetector::detectImpl( const Mat& image, const Mat& mas
}
}
Ptr
<
FeatureDetector
>
createFeatureDetector
(
const
string
&
detectorType
)
{
FeatureDetector
*
fd
=
0
;
if
(
!
detectorType
.
compare
(
"FAST"
)
)
{
fd
=
new
FastFeatureDetector
(
10
/*threshold*/
,
true
/*nonmax_suppression*/
);
}
else
if
(
!
detectorType
.
compare
(
"STAR"
)
)
{
fd
=
new
StarFeatureDetector
(
16
/*max_size*/
,
5
/*response_threshold*/
,
10
/*line_threshold_projected*/
,
8
/*line_threshold_binarized*/
,
5
/*suppress_nonmax_size*/
);
}
else
if
(
!
detectorType
.
compare
(
"SIFT"
)
)
{
fd
=
new
SiftFeatureDetector
(
SIFT
::
DetectorParams
::
GET_DEFAULT_THRESHOLD
(),
SIFT
::
DetectorParams
::
GET_DEFAULT_EDGE_THRESHOLD
());
}
else
if
(
!
detectorType
.
compare
(
"SURF"
)
)
{
fd
=
new
SurfFeatureDetector
(
400.
/*hessian_threshold*/
,
3
/*octaves*/
,
4
/*octave_layers*/
);
}
else
if
(
!
detectorType
.
compare
(
"MSER"
)
)
{
fd
=
new
MserFeatureDetector
(
5
/*delta*/
,
60
/*min_area*/
,
14400
/*_max_area*/
,
0.25
f
/*max_variation*/
,
0.2
/*min_diversity*/
,
200
/*max_evolution*/
,
1.01
/*area_threshold*/
,
0.003
/*min_margin*/
,
5
/*edge_blur_size*/
);
}
else
if
(
!
detectorType
.
compare
(
"GFTT"
)
)
{
fd
=
new
GoodFeaturesToTrackDetector
(
1000
/*maxCorners*/
,
0.01
/*qualityLevel*/
,
1.
/*minDistance*/
,
3
/*int _blockSize*/
,
false
/*useHarrisDetector*/
,
0.04
/*k*/
);
}
else
if
(
!
detectorType
.
compare
(
"HARRIS"
)
)
{
fd
=
new
GoodFeaturesToTrackDetector
(
1000
/*maxCorners*/
,
0.01
/*qualityLevel*/
,
1.
/*minDistance*/
,
3
/*int _blockSize*/
,
true
/*useHarrisDetector*/
,
0.04
/*k*/
);
}
return
fd
;
}
}
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