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
94f72ae8
Commit
94f72ae8
authored
Oct 21, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stitching: added grid option to OrbFeaturesFinder
parent
21a4a06d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
4 deletions
+35
-4
matchers.hpp
...s/stitching/include/opencv2/stitching/detail/matchers.hpp
+2
-1
matchers.cpp
modules/stitching/src/matchers.cpp
+33
-3
No files found.
modules/stitching/include/opencv2/stitching/detail/matchers.hpp
View file @
94f72ae8
...
...
@@ -92,12 +92,13 @@ private:
class
CV_EXPORTS
OrbFeaturesFinder
:
public
FeaturesFinder
{
public
:
OrbFeaturesFinder
(
size_t
n_features
=
1500
,
const
ORB
::
CommonParams
&
detector_params
=
ORB
::
CommonParams
(
1.3
,
5
));
OrbFeaturesFinder
(
Size
_grid_size
=
Size
(
4
,
4
),
size_t
n_features
=
1500
,
const
ORB
::
CommonParams
&
detector_params
=
ORB
::
CommonParams
(
1.3
,
5
));
private
:
void
find
(
const
Mat
&
image
,
ImageFeatures
&
features
);
Ptr
<
ORB
>
orb
;
Size
grid_size
;
};
...
...
modules/stitching/src/matchers.cpp
View file @
94f72ae8
...
...
@@ -337,9 +337,10 @@ void SurfFeaturesFinder::find(const Mat &image, ImageFeatures &features)
}
}
OrbFeaturesFinder
::
OrbFeaturesFinder
(
size_t
n_features
,
const
ORB
::
CommonParams
&
detector_params
)
OrbFeaturesFinder
::
OrbFeaturesFinder
(
Size
_grid_size
,
size_t
n_features
,
const
ORB
::
CommonParams
&
detector_params
)
{
orb
=
new
ORB
(
n_features
,
detector_params
);
grid_size
=
_grid_size
;
orb
=
new
ORB
(
n_features
*
(
99
+
grid_size
.
area
())
/
100
/
grid_size
.
area
(),
detector_params
);
}
void
OrbFeaturesFinder
::
find
(
const
Mat
&
image
,
ImageFeatures
&
features
)
...
...
@@ -348,7 +349,36 @@ void OrbFeaturesFinder::find(const Mat &image, ImageFeatures &features)
CV_Assert
(
image
.
type
()
==
CV_8UC3
);
cvtColor
(
image
,
gray_image
,
CV_BGR2GRAY
);
(
*
orb
)(
gray_image
,
Mat
(),
features
.
keypoints
,
features
.
descriptors
);
if
(
grid_size
.
area
()
==
1
)
(
*
orb
)(
gray_image
,
Mat
(),
features
.
keypoints
,
features
.
descriptors
);
else
{
features
.
keypoints
.
clear
();
features
.
descriptors
.
release
();
std
::
vector
<
KeyPoint
>
points
;
Mat
descriptors
;
for
(
int
r
=
0
;
r
<
grid_size
.
height
;
++
r
)
for
(
int
c
=
0
;
c
<
grid_size
.
width
;
++
c
)
{
int
xl
=
c
*
gray_image
.
cols
/
grid_size
.
width
;
int
yl
=
r
*
gray_image
.
rows
/
grid_size
.
height
;
int
xr
=
(
c
+
1
)
*
gray_image
.
cols
/
grid_size
.
width
;
int
yr
=
(
r
+
1
)
*
gray_image
.
rows
/
grid_size
.
height
;
(
*
orb
)(
gray_image
(
Range
(
yl
,
yr
),
Range
(
xl
,
xr
)),
Mat
(),
points
,
descriptors
);
features
.
keypoints
.
reserve
(
features
.
keypoints
.
size
()
+
points
.
size
());
for
(
std
::
vector
<
KeyPoint
>::
iterator
kp
=
points
.
begin
();
kp
!=
points
.
end
();
++
kp
)
{
kp
->
pt
.
x
+=
xl
;
kp
->
pt
.
y
+=
yl
;
features
.
keypoints
.
push_back
(
*
kp
);
}
features
.
descriptors
.
push_back
(
descriptors
);
}
}
}
#ifndef ANDROID
...
...
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