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
21a4a06d
Commit
21a4a06d
authored
Oct 21, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug in KeyPointsFilter::runByImageBorder; added ROI adjustment to ORB
parent
e8032fa8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
6 deletions
+47
-6
keypoint.cpp
modules/features2d/src/keypoint.cpp
+7
-4
orb.cpp
modules/features2d/src/orb.cpp
+40
-2
No files found.
modules/features2d/src/keypoint.cpp
View file @
21a4a06d
...
...
@@ -183,10 +183,13 @@ void KeyPointsFilter::runByImageBorder( vector<KeyPoint>& keypoints, Size imageS
{
if
(
borderSize
>
0
)
{
keypoints
.
erase
(
remove_if
(
keypoints
.
begin
(),
keypoints
.
end
(),
RoiPredicate
(
Rect
(
Point
(
borderSize
,
borderSize
),
Point
(
imageSize
.
width
-
borderSize
,
imageSize
.
height
-
borderSize
)))),
keypoints
.
end
()
);
if
(
imageSize
.
height
<=
borderSize
*
2
||
imageSize
.
width
<=
borderSize
*
2
)
keypoints
.
clear
();
else
keypoints
.
erase
(
remove_if
(
keypoints
.
begin
(),
keypoints
.
end
(),
RoiPredicate
(
Rect
(
Point
(
borderSize
,
borderSize
),
Point
(
imageSize
.
width
-
borderSize
,
imageSize
.
height
-
borderSize
)))),
keypoints
.
end
()
);
}
}
...
...
modules/features2d/src/orb.cpp
View file @
21a4a06d
...
...
@@ -530,12 +530,40 @@ void ORB::operator()(const cv::Mat &image, const cv::Mat &mask, std::vector<cv::
* @param do_keypoints if true, the keypoints are computed, otherwise used as an input
* @param do_descriptors if true, also computes the descriptors
*/
void
ORB
::
operator
()(
const
cv
::
Mat
&
image_in
,
const
cv
::
Mat
&
mask
,
std
::
vector
<
cv
::
KeyPoint
>
&
keypoints_in_out
,
void
ORB
::
operator
()(
const
cv
::
Mat
&
_image_in
,
const
cv
::
Mat
&
_
mask
,
std
::
vector
<
cv
::
KeyPoint
>
&
keypoints_in_out
,
cv
::
Mat
&
descriptors
,
bool
do_keypoints
,
bool
do_descriptors
)
{
if
(((
!
do_keypoints
)
&&
(
!
do_descriptors
))
||
(
image_in
.
empty
()))
if
(((
!
do_keypoints
)
&&
(
!
do_descriptors
))
||
(
_
image_in
.
empty
()))
return
;
//ROI handling
cv
::
Mat
image_in
(
_image_in
);
cv
::
Mat
mask
(
_mask
);
Point
image_in_roi_offset
(
0
,
0
);
if
(
image_in
.
isSubmatrix
())
{
Size
image_in_size
;
image_in
.
locateROI
(
image_in_size
,
image_in_roi_offset
);
image_in_roi_offset
.
x
=
image_in_roi_offset
.
x
-
std
::
max
(
0
,
image_in_roi_offset
.
x
-
params_
.
edge_threshold_
);
image_in_roi_offset
.
y
=
image_in_roi_offset
.
y
-
std
::
max
(
0
,
image_in_roi_offset
.
y
-
params_
.
edge_threshold_
);
image_in
.
adjustROI
(
params_
.
edge_threshold_
,
params_
.
edge_threshold_
,
params_
.
edge_threshold_
,
params_
.
edge_threshold_
);
if
(
!
do_keypoints
&&
image_in_roi_offset
!=
Point
(
0
,
0
))
{
for
(
std
::
vector
<
cv
::
KeyPoint
>::
iterator
kp
=
keypoints_in_out
.
begin
();
kp
!=
keypoints_in_out
.
end
();
++
kp
)
{
kp
->
pt
.
x
+=
image_in_roi_offset
.
x
;
kp
->
pt
.
y
+=
image_in_roi_offset
.
y
;
}
}
if
(
!
mask
.
empty
())
copyMakeBorder
(
_mask
,
mask
,
image_in_roi_offset
.
y
,
image_in
.
rows
-
image_in_roi_offset
.
y
-
mask
.
rows
,
image_in_roi_offset
.
x
,
image_in
.
cols
-
image_in_roi_offset
.
x
-
mask
.
cols
,
cv
::
BORDER_CONSTANT
,
Scalar
::
all
(
0
));
}
cv
::
Mat
image
;
if
(
image_in
.
type
()
!=
CV_8UC1
)
cvtColor
(
image_in
,
image
,
CV_BGR2GRAY
);
...
...
@@ -635,6 +663,16 @@ void ORB::operator()(const cv::Mat &image_in, const cv::Mat &mask, std::vector<c
descriptors
.
push_back
(
desc
);
}
}
//fix ROI offset
if
(
image_in_roi_offset
!=
Point
(
0
,
0
))
{
for
(
std
::
vector
<
cv
::
KeyPoint
>::
iterator
kp
=
keypoints_in_out
.
begin
();
kp
!=
keypoints_in_out
.
end
();
++
kp
)
{
kp
->
pt
.
x
-=
image_in_roi_offset
.
x
;
kp
->
pt
.
y
-=
image_in_roi_offset
.
y
;
}
}
}
//takes keypoints and culls them by the response
...
...
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