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
bf53ebd5
Commit
bf53ebd5
authored
Jan 31, 2013
by
cuda-geek
Committed by
OpenCV Buildbot
Jan 31, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #381 from vpisarev:surf_fixes
parents
fe30da6e
1f261c2f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
5 deletions
+40
-5
surf.cpp
modules/nonfree/src/surf.cpp
+34
-3
test_features2d.cpp
modules/nonfree/test/test_features2d.cpp
+5
-1
test_rotation_and_scale_invariance.cpp
modules/nonfree/test/test_rotation_and_scale_invariance.cpp
+1
-1
No files found.
modules/nonfree/src/surf.cpp
View file @
bf53ebd5
...
...
@@ -698,11 +698,12 @@ struct SURFInvoker
cvGetQuadrangleSubPix( img, &win, &W );
*/
// Nearest neighbour version (faster)
float
win_offset
=
-
(
float
)(
win_size
-
1
)
/
2
;
float
start_x
=
center
.
x
+
win_offset
*
cos_dir
+
win_offset
*
sin_dir
;
float
start_y
=
center
.
y
-
win_offset
*
sin_dir
+
win_offset
*
cos_dir
;
uchar
*
WIN
=
win
.
data
;
#if 0
// Nearest neighbour version (faster)
for( i = 0; i < win_size; i++, start_x += sin_dir, start_y += cos_dir )
{
float pixel_x = start_x;
...
...
@@ -714,6 +715,36 @@ struct SURFInvoker
WIN[i*win_size + j] = img->at<uchar>(y, x);
}
}
#else
int
ncols1
=
img
->
cols
-
1
,
nrows1
=
img
->
rows
-
1
;
size_t
imgstep
=
img
->
step
;
for
(
i
=
0
;
i
<
win_size
;
i
++
,
start_x
+=
sin_dir
,
start_y
+=
cos_dir
)
{
double
pixel_x
=
start_x
;
double
pixel_y
=
start_y
;
for
(
j
=
0
;
j
<
win_size
;
j
++
,
pixel_x
+=
cos_dir
,
pixel_y
-=
sin_dir
)
{
int
ix
=
cvFloor
(
pixel_x
),
iy
=
cvFloor
(
pixel_y
);
if
(
(
unsigned
)
ix
<
(
unsigned
)
ncols1
&&
(
unsigned
)
iy
<
(
unsigned
)
nrows1
)
{
float
a
=
(
float
)(
pixel_x
-
ix
),
b
=
(
float
)(
pixel_y
-
iy
);
const
uchar
*
imgptr
=
&
img
->
at
<
uchar
>
(
iy
,
ix
);
WIN
[
i
*
win_size
+
j
]
=
(
uchar
)
cvRound
(
imgptr
[
0
]
*
(
1.
f
-
a
)
*
(
1.
f
-
b
)
+
imgptr
[
1
]
*
a
*
(
1.
f
-
b
)
+
imgptr
[
imgstep
]
*
(
1.
f
-
a
)
*
b
+
imgptr
[
imgstep
+
1
]
*
a
*
b
);
}
else
{
int
x
=
std
::
min
(
std
::
max
(
cvRound
(
pixel_x
),
0
),
ncols1
);
int
y
=
std
::
min
(
std
::
max
(
cvRound
(
pixel_y
),
0
),
nrows1
);
WIN
[
i
*
win_size
+
j
]
=
img
->
at
<
uchar
>
(
y
,
x
);
}
}
}
#endif
}
else
{
...
...
@@ -844,10 +875,10 @@ struct SURFInvoker
SURF
::
SURF
()
{
hessianThreshold
=
100
;
extended
=
tru
e
;
extended
=
fals
e
;
upright
=
false
;
nOctaves
=
4
;
nOctaveLayers
=
2
;
nOctaveLayers
=
3
;
}
SURF
::
SURF
(
double
_threshold
,
int
_nOctaves
,
int
_nOctaveLayers
,
bool
_extended
,
bool
_upright
)
...
...
modules/nonfree/test/test_features2d.cpp
View file @
bf53ebd5
...
...
@@ -1114,6 +1114,10 @@ protected:
Mat
d1
,
d2
;
f
->
operator
()(
img1
,
Mat
(),
kpt1
,
d1
);
f
->
operator
()(
img1
,
Mat
(),
kpt2
,
d2
);
for
(
size_t
i
=
0
;
i
<
kpt1
.
size
();
i
++
)
CV_Assert
(
kpt1
[
i
].
response
>
0
);
for
(
size_t
i
=
0
;
i
<
kpt2
.
size
();
i
++
)
CV_Assert
(
kpt2
[
i
].
response
>
0
);
vector
<
DMatch
>
matches
;
BFMatcher
(
NORM_L2
,
true
).
match
(
d1
,
d2
,
matches
);
...
...
@@ -1140,5 +1144,5 @@ protected:
};
TEST
(
Features2d_SIFTHomographyTest
,
regression
)
{
CV_DetectPlanarTest
test
(
"SIFT"
,
80
);
test
.
safe_run
();
}
//
TEST(Features2d_SURFHomographyTest, regression) { CV_DetectPlanarTest test("SURF", 80); test.safe_run(); }
TEST
(
Features2d_SURFHomographyTest
,
regression
)
{
CV_DetectPlanarTest
test
(
"SURF"
,
80
);
test
.
safe_run
();
}
modules/nonfree/test/test_rotation_and_scale_invariance.cpp
View file @
bf53ebd5
...
...
@@ -616,7 +616,7 @@ protected:
TEST
(
Features2d_RotationInvariance_Detector_SURF
,
regression
)
{
DetectorRotationInvarianceTest
test
(
Algorithm
::
create
<
FeatureDetector
>
(
"Feature2D.SURF"
),
0.4
5
f
,
0.4
4
f
,
0.76
f
);
test
.
safe_run
();
}
...
...
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