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
a7d053f1
Commit
a7d053f1
authored
Sep 26, 2011
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added handling of ROI in stitching features matchers
parent
b053a3b4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
0 deletions
+50
-0
matchers.hpp
...s/stitching/include/opencv2/stitching/detail/matchers.hpp
+1
-0
stitcher.hpp
modules/stitching/include/opencv2/stitching/stitcher.hpp
+2
-0
matchers.cpp
modules/stitching/src/matchers.cpp
+37
-0
stitcher.cpp
modules/stitching/src/stitcher.cpp
+10
-0
No files found.
modules/stitching/include/opencv2/stitching/detail/matchers.hpp
View file @
a7d053f1
...
...
@@ -67,6 +67,7 @@ class CV_EXPORTS FeaturesFinder
public
:
virtual
~
FeaturesFinder
()
{}
void
operator
()(
const
Mat
&
image
,
ImageFeatures
&
features
);
void
operator
()(
const
Mat
&
image
,
ImageFeatures
&
features
,
const
std
::
vector
<
cv
::
Rect
>
&
rois
);
virtual
void
collectGarbage
()
{}
protected
:
...
...
modules/stitching/include/opencv2/stitching/stitcher.hpp
View file @
a7d053f1
...
...
@@ -66,6 +66,7 @@ public:
// Stitches the biggest found pano. Returns status code.
Status
stitch
(
InputArray
imgs
,
OutputArray
pano
);
Status
stitch
(
InputArray
imgs
,
const
std
::
vector
<
std
::
vector
<
cv
::
Rect
>
>
&
rois
,
OutputArray
pano
);
double
registrationResol
()
const
{
return
registr_resol_
;
}
void
setRegistrationResol
(
double
resol_mpx
)
{
registr_resol_
=
resol_mpx
;
}
...
...
@@ -147,6 +148,7 @@ private:
Ptr
<
detail
::
Blender
>
blender_
;
std
::
vector
<
cv
::
Mat
>
imgs_
;
std
::
vector
<
std
::
vector
<
cv
::
Rect
>
>
rois_
;
std
::
vector
<
cv
::
Size
>
full_img_sizes_
;
std
::
vector
<
detail
::
ImageFeatures
>
features_
;
std
::
vector
<
detail
::
MatchesInfo
>
pairwise_matches_
;
...
...
modules/stitching/src/matchers.cpp
View file @
a7d053f1
...
...
@@ -249,10 +249,47 @@ namespace detail {
void
FeaturesFinder
::
operator
()(
const
Mat
&
image
,
ImageFeatures
&
features
)
{
find
(
image
,
features
);
cout
<<
features
.
descriptors
.
cols
<<
" "
<<
features
.
descriptors
.
rows
<<
" "
<<
features
.
descriptors
.
type
()
<<
endl
;
features
.
img_size
=
image
.
size
();
}
// TODO add tests for this function
void
FeaturesFinder
::
operator
()(
const
Mat
&
image
,
ImageFeatures
&
features
,
const
vector
<
Rect
>
&
rois
)
{
vector
<
ImageFeatures
>
roi_features
;
size_t
total_kps_count
=
0
;
int
total_descriptors_width
=
0
;
for
(
size_t
i
=
0
;
i
<
rois
.
size
();
++
i
)
{
find
(
image
(
rois
[
i
]),
roi_features
[
i
]);
total_kps_count
+=
roi_features
[
i
].
keypoints
.
size
();
total_descriptors_width
+=
roi_features
[
i
].
descriptors
.
cols
;
}
features
.
img_size
=
image
.
size
();
features
.
keypoints
.
resize
(
total_kps_count
);
features
.
descriptors
.
create
(
1
,
total_descriptors_width
,
roi_features
[
0
].
descriptors
.
type
());
int
kp_idx
=
0
;
int
descr_offset
=
0
;
for
(
size_t
i
=
0
;
i
<
rois
.
size
();
++
i
)
{
for
(
size_t
j
=
0
;
j
<
features
.
keypoints
.
size
();
++
j
,
++
kp_idx
)
{
features
.
keypoints
[
kp_idx
]
=
roi_features
[
i
].
keypoints
[
j
];
features
.
keypoints
[
kp_idx
].
pt
.
x
+=
(
float
)
rois
[
i
].
x
;
features
.
keypoints
[
kp_idx
].
pt
.
y
+=
(
float
)
rois
[
i
].
y
;
}
Mat
subdescr
=
features
.
descriptors
.
colRange
(
descr_offset
,
descr_offset
+
roi_features
[
i
].
descriptors
.
cols
);
roi_features
[
i
].
descriptors
.
copyTo
(
subdescr
);
descr_offset
+=
roi_features
[
i
].
descriptors
.
cols
;
}
}
SurfFeaturesFinder
::
SurfFeaturesFinder
(
double
hess_thresh
,
int
num_octaves
,
int
num_layers
,
int
num_octaves_descr
,
int
num_layers_descr
)
{
...
...
modules/stitching/src/stitcher.cpp
View file @
a7d053f1
...
...
@@ -100,6 +100,13 @@ Stitcher::Status Stitcher::stitch(InputArray imgs, OutputArray pano)
}
Stitcher
::
Status
Stitcher
::
stitch
(
InputArray
imgs
,
const
vector
<
vector
<
Rect
>
>
&
rois
,
OutputArray
pano
)
{
rois_
=
rois
;
return
stitch
(
imgs
,
pano
);
}
Stitcher
::
Status
Stitcher
::
matchImages
()
{
if
((
int
)
imgs_
.
size
()
<
2
)
...
...
@@ -148,7 +155,10 @@ Stitcher::Status Stitcher::matchImages()
is_seam_scale_set
=
true
;
}
if
(
rois_
.
empty
())
(
*
features_finder_
)(
img
,
features_
[
i
]);
else
(
*
features_finder_
)(
img
,
features_
[
i
],
rois_
[
i
]);
features_
[
i
].
img_idx
=
i
;
LOGLN
(
"Features in image #"
<<
i
+
1
<<
": "
<<
features_
[
i
].
keypoints
.
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