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
9399394e
Commit
9399394e
authored
May 31, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #1996
parent
1a572c8e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
15 deletions
+63
-15
fast.cpp
modules/features2d/src/fast.cpp
+0
-0
orb.cpp
modules/features2d/src/orb.cpp
+14
-15
test_features2d.cpp
modules/features2d/test/test_features2d.cpp
+49
-0
No files found.
modules/features2d/src/fast.cpp
View file @
9399394e
modules/features2d/src/orb.cpp
View file @
9399394e
...
...
@@ -778,36 +778,35 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
{
if
(
level
<
firstLevel
)
{
resize
(
image
,
imagePyramid
[
level
],
sz
,
scale
,
scale
,
INTER_LINEAR
);
resize
(
image
,
imagePyramid
[
level
],
sz
,
0
,
0
,
INTER_LINEAR
);
if
(
!
mask
.
empty
())
resize
(
mask
,
maskPyramid
[
level
],
sz
,
scale
,
scale
,
INTER_LINEAR
);
copyMakeBorder
(
imagePyramid
[
level
],
temp
,
border
,
border
,
border
,
border
,
BORDER_REFLECT_101
+
BORDER_ISOLATED
);
resize
(
mask
,
maskPyramid
[
level
],
sz
,
0
,
0
,
INTER_LINEAR
);
}
else
{
resize
(
imagePyramid
[
level
-
1
],
imagePyramid
[
level
],
sz
,
1.
/
scaleFactor
,
1.
/
scaleFactor
,
INTER_LINEAR
);
resize
(
imagePyramid
[
level
-
1
],
imagePyramid
[
level
],
sz
,
0
,
0
,
INTER_LINEAR
);
if
(
!
mask
.
empty
())
resize
(
maskPyramid
[
level
-
1
],
maskPyramid
[
level
],
sz
,
1.
/
scaleFactor
,
1.
/
scaleFactor
,
INTER_LINEAR
);
{
resize
(
maskPyramid
[
level
-
1
],
maskPyramid
[
level
],
sz
,
0
,
0
,
INTER_LINEAR
);
threshold
(
maskPyramid
[
level
],
maskPyramid
[
level
],
254
,
0
,
THRESH_TOZERO
);
}
}
copyMakeBorder
(
imagePyramid
[
level
],
temp
,
border
,
border
,
border
,
border
,
BORDER_REFLECT_101
+
BORDER_ISOLATED
);
}
if
(
!
mask
.
empty
())
copyMakeBorder
(
maskPyramid
[
level
],
masktemp
,
border
,
border
,
border
,
border
,
BORDER_CONSTANT
+
BORDER_ISOLATED
);
}
else
{
copyMakeBorder
(
image
,
temp
,
border
,
border
,
border
,
border
,
BORDER_REFLECT_101
);
image
.
copyTo
(
imagePyramid
[
level
]);
if
(
!
mask
.
empty
()
)
mask
.
copyTo
(
maskPyramid
[
level
]);
}
if
(
!
mask
.
empty
()
)
copyMakeBorder
(
maskPyramid
[
level
],
masktemp
,
border
,
border
,
border
,
border
,
copyMakeBorder
(
mask
,
masktemp
,
border
,
border
,
border
,
border
,
BORDER_CONSTANT
+
BORDER_ISOLATED
);
}
}
// Pre-compute the keypoints (we keep the best over all scales, so this has to be done beforehand
vector
<
vector
<
KeyPoint
>
>
allKeypoints
;
...
...
modules/features2d/test/test_features2d.cpp
View file @
9399394e
...
...
@@ -1091,3 +1091,51 @@ TEST( Features2d_DescriptorMatcher_FlannBased, regression )
CV_DescriptorMatcherTest
test
(
"descriptor-matcher-flann-based"
,
new
FlannBasedMatcher
,
0.04
f
);
test
.
safe_run
();
}
TEST
(
Features2D_ORB
,
_1996
)
{
cv
::
Ptr
<
cv
::
FeatureDetector
>
fd
=
cv
::
FeatureDetector
::
create
(
"ORB"
);
cv
::
Ptr
<
cv
::
DescriptorExtractor
>
de
=
cv
::
DescriptorExtractor
::
create
(
"ORB"
);
Mat
image
=
cv
::
imread
(
string
(
cvtest
::
TS
::
ptr
()
->
get_data_path
())
+
"shared/lena.jpg"
);
ASSERT_FALSE
(
image
.
empty
());
Mat
roi
(
image
.
size
(),
CV_8UC1
,
Scalar
(
0
));
Point
poly
[]
=
{
Point
(
100
,
20
),
Point
(
300
,
50
),
Point
(
400
,
200
),
Point
(
10
,
500
)};
fillConvexPoly
(
roi
,
poly
,
int
(
sizeof
(
poly
)
/
sizeof
(
poly
[
0
])),
Scalar
(
255
));
std
::
vector
<
cv
::
KeyPoint
>
keypoints
;
fd
->
detect
(
image
,
keypoints
,
roi
);
cv
::
Mat
descriptors
;
de
->
compute
(
image
,
keypoints
,
descriptors
);
//image.setTo(Scalar(255,255,255), roi);
int
roiViolations
=
0
;
for
(
std
::
vector
<
cv
::
KeyPoint
>::
const_iterator
kp
=
keypoints
.
begin
();
kp
!=
keypoints
.
end
();
++
kp
)
{
int
x
=
cvRound
(
kp
->
pt
.
x
);
int
y
=
cvRound
(
kp
->
pt
.
y
);
ASSERT_LE
(
0
,
x
);
ASSERT_LE
(
0
,
y
);
ASSERT_GT
(
image
.
cols
,
x
);
ASSERT_GT
(
image
.
rows
,
y
);
// if (!roi.at<uchar>(y,x))
// {
// roiViolations++;
// circle(image, kp->pt, 3, Scalar(0,0,255));
// }
}
// if(roiViolations)
// {
// imshow("img", image);
// waitKey();
// }
ASSERT_EQ
(
0
,
roiViolations
);
}
\ No newline at end of file
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