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
9342c4b0
Commit
9342c4b0
authored
Mar 17, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added upright parameter to SURF_GPU
parent
b6eb12c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+5
-3
surf.cpp
modules/gpu/src/surf.cpp
+19
-5
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
9342c4b0
...
...
@@ -1545,7 +1545,7 @@ namespace cv
SURF_GPU
();
//! the full constructor taking all the necessary parameters
explicit
SURF_GPU
(
double
_hessianThreshold
,
int
_nOctaves
=
4
,
int
_nOctaveLayers
=
2
,
bool
_extended
=
false
,
float
_keypointsRatio
=
0.01
f
);
int
_nOctaveLayers
=
2
,
bool
_extended
=
false
,
float
_keypointsRatio
=
0.01
f
,
bool
_upright
=
false
);
//! returns the descriptor size in float's (64 or 128)
int
descriptorSize
()
const
;
...
...
@@ -1568,17 +1568,19 @@ namespace cv
//! Optionally it can compute descriptors for the user-provided keypoints and recompute keypoints direction
void
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
GpuMat
&
keypoints
,
GpuMat
&
descriptors
,
bool
useProvidedKeypoints
=
false
);
void
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
std
::
vector
<
KeyPoint
>&
keypoints
);
void
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
std
::
vector
<
KeyPoint
>&
keypoints
,
GpuMat
&
descriptors
,
bool
useProvidedKeypoints
=
false
);
void
operator
()(
const
GpuMat
&
img
,
const
GpuMat
&
mask
,
std
::
vector
<
KeyPoint
>&
keypoints
,
std
::
vector
<
float
>&
descriptors
,
bool
useProvidedKeypoints
=
false
);
//! max keypoints = keypointsRatio * img.size().area()
float
keypointsRatio
;
bool
upright
;
GpuMat
sum
,
mask1
,
maskSum
,
intBuffer
;
GpuMat
det
,
trace
;
...
...
modules/gpu/src/surf.cpp
View file @
9342c4b0
...
...
@@ -49,7 +49,7 @@ using namespace std;
#if !defined (HAVE_CUDA)
cv
::
gpu
::
SURF_GPU
::
SURF_GPU
()
{
throw_nogpu
();
}
cv
::
gpu
::
SURF_GPU
::
SURF_GPU
(
double
,
int
,
int
,
bool
,
float
)
{
throw_nogpu
();
}
cv
::
gpu
::
SURF_GPU
::
SURF_GPU
(
double
,
int
,
int
,
bool
,
float
,
bool
)
{
throw_nogpu
();
}
int
cv
::
gpu
::
SURF_GPU
::
descriptorSize
()
const
{
throw_nogpu
();
return
0
;}
void
cv
::
gpu
::
SURF_GPU
::
uploadKeypoints
(
const
vector
<
KeyPoint
>&
,
GpuMat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
SURF_GPU
::
downloadKeypoints
(
const
GpuMat
&
,
vector
<
KeyPoint
>&
)
{
throw_nogpu
();
}
...
...
@@ -92,7 +92,9 @@ namespace
img_cols
(
img
.
cols
),
img_rows
(
img
.
rows
),
use_mask
(
!
mask
.
empty
())
use_mask
(
!
mask
.
empty
()),
upright
(
surf
.
upright
)
{
CV_Assert
(
!
img
.
empty
()
&&
img
.
type
()
==
CV_8UC1
);
CV_Assert
(
mask
.
empty
()
||
(
mask
.
size
()
==
img
.
size
()
&&
mask
.
type
()
==
CV_8UC1
));
...
...
@@ -176,7 +178,15 @@ namespace
cudaSafeCall
(
cudaMemcpy
(
&
featureCounter
,
d_counters
,
sizeof
(
unsigned
int
),
cudaMemcpyDeviceToHost
)
);
featureCounter
=
std
::
min
(
featureCounter
,
static_cast
<
unsigned
int
>
(
maxFeatures
));
findOrientation
(
featuresBuffer
.
colRange
(
0
,
featureCounter
),
keypoints
);
if
(
!
upright
)
findOrientation
(
featuresBuffer
.
colRange
(
0
,
featureCounter
),
keypoints
);
else
{
if
(
featureCounter
>
0
)
featuresBuffer
.
colRange
(
0
,
featureCounter
).
copyTo
(
keypoints
);
else
keypoints
.
release
();
}
}
void
findOrientation
(
const
GpuMat
&
features
,
GpuMat
&
keypoints
)
...
...
@@ -225,6 +235,8 @@ namespace
bool
use_mask
;
bool
upright
;
int
maxCandidates
;
int
maxFeatures
;
int
maxKeypoints
;
...
...
@@ -240,15 +252,17 @@ cv::gpu::SURF_GPU::SURF_GPU()
nOctaves
=
4
;
nOctaveLayers
=
2
;
keypointsRatio
=
0.01
f
;
upright
=
false
;
}
cv
::
gpu
::
SURF_GPU
::
SURF_GPU
(
double
_threshold
,
int
_nOctaves
,
int
_nOctaveLayers
,
bool
_extended
,
float
_keypointsRatio
)
cv
::
gpu
::
SURF_GPU
::
SURF_GPU
(
double
_threshold
,
int
_nOctaves
,
int
_nOctaveLayers
,
bool
_extended
,
float
_keypointsRatio
,
bool
_upright
)
{
hessianThreshold
=
_threshold
;
extended
=
_extended
;
nOctaves
=
_nOctaves
;
nOctaveLayers
=
_nOctaveLayers
;
keypointsRatio
=
_keypointsRatio
;
upright
=
_upright
;
}
int
cv
::
gpu
::
SURF_GPU
::
descriptorSize
()
const
...
...
@@ -387,7 +401,7 @@ void cv::gpu::SURF_GPU::operator()(const GpuMat& img, const GpuMat& mask, GpuMat
if
(
!
useProvidedKeypoints
)
surf
.
detectKeypoints
(
keypoints
);
else
else
if
(
!
upright
)
{
GpuMat
keypointsBuf
;
surf
.
findOrientation
(
keypoints
,
keypointsBuf
);
...
...
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