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
6960e154
Commit
6960e154
authored
Sep 06, 2010
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GPU module update: _GPU suffix removed, some namespaces renamed, minor refactorings.
parent
a38e5111
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
65 additions
and
71 deletions
+65
-71
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+6
-6
beliefpropagation.cu
modules/gpu/src/cuda/beliefpropagation.cu
+0
-1
bilateral_filter.cu
modules/gpu/src/cuda/bilateral_filter.cu
+0
-1
color.cu
modules/gpu/src/cuda/color.cu
+3
-4
constantspacebp.cu
modules/gpu/src/cuda/constantspacebp.cu
+0
-1
cuda_shared.hpp
modules/gpu/src/cuda/cuda_shared.hpp
+2
-2
imgproc.cu
modules/gpu/src/cuda/imgproc.cu
+4
-4
matrix_operations.cu
modules/gpu/src/cuda/matrix_operations.cu
+2
-2
stereobm.cu
modules/gpu/src/cuda/stereobm.cu
+3
-3
cudastream.cpp
modules/gpu/src/cudastream.cpp
+3
-3
imgproc_gpu.cpp
modules/gpu/src/imgproc_gpu.cpp
+26
-26
matrix_operations.cpp
modules/gpu/src/matrix_operations.cpp
+5
-5
stereobm_gpu.cpp
modules/gpu/src/stereobm_gpu.cpp
+5
-5
meanshift.cpp
tests/gpu/src/meanshift.cpp
+1
-1
stereo_bm.cpp
tests/gpu/src/stereo_bm.cpp
+5
-7
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
6960e154
...
...
@@ -344,10 +344,10 @@ namespace cv
////////////////////////////// Image processing //////////////////////////////
// DST[x,y] = SRC[xmap[x,y],ymap[x,y]] with bilinear interpolation.
// xymap.type() == xymap.type() == CV_32FC1
CV_EXPORTS
void
remap
(
const
GpuMat
&
src
,
const
GpuMat
&
xmap
,
const
GpuMat
&
ymap
,
GpuMat
&
dst
);
CV_EXPORTS
void
remap
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
xmap
,
const
GpuMat
&
ymap
);
// Does mean shift filtering on GPU.
CV_EXPORTS
void
meanShiftFiltering
_GPU
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
sp
,
int
sr
,
CV_EXPORTS
void
meanShiftFiltering
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
sp
,
int
sr
,
TermCriteria
criteria
=
TermCriteria
(
TermCriteria
::
MAX_ITER
+
TermCriteria
::
EPS
,
5
,
1
));
// Does coloring of disparity image: [0..ndisp) -> [0..240, 1, 1] in HSV.
...
...
@@ -362,12 +362,12 @@ namespace cv
// The output is a 4-channel floating-point (CV_32FC4) matrix.
// Each element of this matrix will contain the 3D coordinates of the point (x,y,z,1), computed from the disparity map.
// Q is the 4x4 perspective transformation matrix that can be obtained with cvStereoRectify.
CV_EXPORTS
void
reprojectImageTo3D
_GPU
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
);
CV_EXPORTS
void
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
);
// Acync version
CV_EXPORTS
void
reprojectImageTo3D
_GPU
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
Stream
&
stream
);
CV_EXPORTS
void
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
Stream
&
stream
);
CV_EXPORTS
void
cvtColor
_GPU
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
=
0
);
CV_EXPORTS
void
cvtColor
_GPU
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
,
const
Stream
&
stream
);
CV_EXPORTS
void
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
=
0
);
CV_EXPORTS
void
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
,
const
Stream
&
stream
);
//////////////////////////////// StereoBM_GPU ////////////////////////////////
...
...
modules/gpu/src/cuda/beliefpropagation.cu
View file @
6960e154
...
...
@@ -45,7 +45,6 @@
#include "safe_call.hpp"
using namespace cv::gpu;
using namespace cv::gpu::impl;
#ifndef FLT_MAX
#define FLT_MAX 3.402823466e+38F
...
...
modules/gpu/src/cuda/bilateral_filter.cu
View file @
6960e154
...
...
@@ -45,7 +45,6 @@
#include "safe_call.hpp"
using namespace cv::gpu;
using namespace cv::gpu::impl;
#ifndef FLT_MAX
#define FLT_MAX 3.402823466e+30F
...
...
modules/gpu/src/cuda/color.cu
View file @
6960e154
...
...
@@ -44,7 +44,6 @@
#include "saturate_cast.hpp"
using namespace cv::gpu;
using namespace cv::gpu::impl;
#ifndef CV_DESCALE
#define CV_DESCALE(x,n) (((x) + (1 << ((n)-1))) >> (n))
...
...
@@ -167,7 +166,7 @@ namespace imgproc
}
}
namespace cv { namespace gpu { namespace imp
l
namespace cv { namespace gpu { namespace imp
roc
{
template <typename T>
void RGB2RGB_caller(const DevMem2D_<T>& src, int srccn, const DevMem2D_<T>& dst, int dstcn, int bidx, cudaStream_t stream)
...
...
@@ -377,7 +376,7 @@ namespace imgproc
//};
}
namespace cv { namespace gpu { namespace imp
l
namespace cv { namespace gpu { namespace imp
roc
{
template <typename T>
void Gray2RGB_caller(const DevMem2D_<T>& src, const DevMem2D_<T>& dst, int dstcn, cudaStream_t stream)
...
...
@@ -627,7 +626,7 @@ namespace imgproc
}
}
namespace cv { namespace gpu { namespace imp
l
namespace cv { namespace gpu { namespace imp
roc
{
void RGB2Gray_gpu(const DevMem2D& src, int srccn, const DevMem2D& dst, int bidx, cudaStream_t stream)
{
...
...
modules/gpu/src/cuda/constantspacebp.cu
View file @
6960e154
...
...
@@ -45,7 +45,6 @@
#include "safe_call.hpp"
using namespace cv::gpu;
using namespace cv::gpu::impl;
#ifndef FLT_MAX
#define FLT_MAX 3.402823466e+30F
...
...
modules/gpu/src/cuda/cuda_shared.hpp
View file @
6960e154
...
...
@@ -56,10 +56,10 @@ namespace cv
typedef
unsigned
short
ushort
;
typedef
unsigned
int
uint
;
namespace
impl
{
static
inline
int
divUp
(
int
a
,
int
b
)
{
return
(
a
%
b
==
0
)
?
a
/
b
:
a
/
b
+
1
;
}
namespace
matrix_operations
{
extern
"C"
void
copy_to_with_mask
(
const
DevMem2D
&
src
,
DevMem2D
dst
,
int
depth
,
const
DevMem2D
&
mask
,
int
channels
,
const
cudaStream_t
&
stream
=
0
);
extern
"C"
void
set_to_without_mask
(
DevMem2D
dst
,
int
depth
,
const
double
*
scalar
,
int
channels
,
const
cudaStream_t
&
stream
=
0
);
...
...
modules/gpu/src/cuda/imgproc.cu
View file @
6960e154
...
...
@@ -123,7 +123,7 @@ namespace imgproc
}
}
namespace cv { namespace gpu { namespace imp
l
namespace cv { namespace gpu { namespace imp
roc
{
void remap_gpu_1c(const DevMem2D& src, const DevMem2Df& xmap, const DevMem2Df& ymap, DevMem2D dst)
{
...
...
@@ -231,7 +231,7 @@ namespace imgproc
}
}
namespace cv { namespace gpu { namespace imp
l
namespace cv { namespace gpu { namespace imp
roc
{
extern "C" void meanShiftFiltering_gpu(const DevMem2D& src, DevMem2D dst, int sp, int sr, int maxIter, float eps)
{
...
...
@@ -354,7 +354,7 @@ namespace imgproc
}
}
namespace cv { namespace gpu { namespace imp
l
namespace cv { namespace gpu { namespace imp
roc
{
void drawColorDisp_gpu(const DevMem2D& src, const DevMem2D& dst, int ndisp, const cudaStream_t& stream)
{
...
...
@@ -420,7 +420,7 @@ namespace imgproc
}
}
namespace cv { namespace gpu { namespace imp
l
namespace cv { namespace gpu { namespace imp
roc
{
template <typename T>
inline void reprojectImageTo3D_caller(const DevMem2D_<T>& disp, const DevMem2Df& xyzw, const float* q, const cudaStream_t& stream)
...
...
modules/gpu/src/cuda/matrix_operations.cu
View file @
6960e154
...
...
@@ -47,7 +47,7 @@
#include "saturate_cast.hpp"
using namespace cv::gpu;
using namespace cv::gpu::
impl
;
using namespace cv::gpu::
matrix_operations
;
namespace mat_operators
...
...
@@ -261,7 +261,7 @@ namespace cv
{
namespace gpu
{
namespace
impl
namespace
matrix_operations
{
///////////////////////////////////////////////////////////////////////////
...
...
modules/gpu/src/cuda/stereobm.cu
View file @
6960e154
...
...
@@ -316,7 +316,7 @@ __global__ void stereoKernel(unsigned char *left, unsigned char *right, size_t i
}
namespace cv { namespace gpu { namespace
impl
namespace cv { namespace gpu { namespace
bm
{
template<int RADIUS> void kernel_caller(const DevMem2D& left, const DevMem2D& right, const DevMem2D& disp, int maxdisp, const cudaStream_t & stream)
{
...
...
@@ -408,7 +408,7 @@ extern "C" __global__ void prefilter_kernel(unsigned char *output, size_t step,
}
namespace cv { namespace gpu { namespace
impl
namespace cv { namespace gpu { namespace
bm
{
extern "C" void prefilter_xsobel(const DevMem2D& input, const DevMem2D& output, int prefilterCap)
{
...
...
@@ -530,7 +530,7 @@ extern "C" __global__ void textureness_kernel(unsigned char *disp, size_t disp_s
}
}
namespace cv { namespace gpu { namespace
impl
namespace cv { namespace gpu { namespace
bm
{
extern "C" void postfilter_textureness(const DevMem2D& input, int winsz, float avgTexturenessThreshold, const DevMem2D& disp)
{
...
...
modules/gpu/src/cudastream.cpp
View file @
6960e154
...
...
@@ -158,12 +158,12 @@ void cv::gpu::Stream::enqueueCopy(const GpuMat& src, GpuMat& dst) { devcopy(src,
void
cv
::
gpu
::
Stream
::
enqueueMemSet
(
const
GpuMat
&
src
,
Scalar
val
)
{
impl
::
set_to_without_mask
(
src
,
src
.
depth
(),
val
.
val
,
src
.
channels
(),
impl
->
stream
);
matrix_operations
::
set_to_without_mask
(
src
,
src
.
depth
(),
val
.
val
,
src
.
channels
(),
impl
->
stream
);
}
void
cv
::
gpu
::
Stream
::
enqueueMemSet
(
const
GpuMat
&
src
,
Scalar
val
,
const
GpuMat
&
mask
)
{
impl
::
set_to_with_mask
(
src
,
src
.
depth
(),
val
.
val
,
mask
,
src
.
channels
(),
impl
->
stream
);
matrix_operations
::
set_to_with_mask
(
src
,
src
.
depth
(),
val
.
val
,
mask
,
src
.
channels
(),
impl
->
stream
);
}
void
cv
::
gpu
::
Stream
::
enqueueConvert
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
rtype
,
double
alpha
,
double
beta
)
...
...
@@ -188,7 +188,7 @@ void cv::gpu::Stream::enqueueConvert(const GpuMat& src, GpuMat& dst, int rtype,
psrc
=
&
(
temp
=
src
);
dst
.
create
(
src
.
size
(),
rtype
);
impl
::
convert_to
(
*
psrc
,
sdepth
,
dst
,
ddepth
,
psrc
->
channels
(),
alpha
,
beta
,
impl
->
stream
);
matrix_operations
::
convert_to
(
*
psrc
,
sdepth
,
dst
,
ddepth
,
psrc
->
channels
(),
alpha
,
beta
,
impl
->
stream
);
}
...
...
modules/gpu/src/imgproc_gpu.cpp
View file @
6960e154
...
...
@@ -47,20 +47,20 @@ using namespace cv::gpu;
#if !defined (HAVE_CUDA)
void
cv
::
gpu
::
remap
(
const
GpuMat
&
,
const
GpuMat
&
,
const
GpuMat
&
,
GpuMat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
meanShiftFiltering
_GPU
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
,
TermCriteria
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
remap
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
xmap
,
const
GpuMat
&
ymap
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
meanShiftFiltering
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
,
TermCriteria
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
drawColorDisp
(
const
GpuMat
&
,
GpuMat
&
,
int
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
drawColorDisp
(
const
GpuMat
&
,
GpuMat
&
,
int
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
reprojectImageTo3D
_GPU
(
const
GpuMat
&
,
GpuMat
&
,
const
Mat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
reprojectImageTo3D
_GPU
(
const
GpuMat
&
,
GpuMat
&
,
const
Mat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
cvtColor
_GPU
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
cvtColor
_GPU
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
reprojectImageTo3D
(
const
GpuMat
&
,
GpuMat
&
,
const
Mat
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
reprojectImageTo3D
(
const
GpuMat
&
,
GpuMat
&
,
const
Mat
&
,
const
Stream
&
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
cvtColor
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
)
{
throw_nogpu
();
}
void
cv
::
gpu
::
cvtColor
(
const
GpuMat
&
,
GpuMat
&
,
int
,
int
,
const
Stream
&
)
{
throw_nogpu
();
}
#else
/* !defined (HAVE_CUDA) */
namespace
cv
{
namespace
gpu
{
namespace
imp
l
namespace
imp
roc
{
void
remap_gpu_1c
(
const
DevMem2D
&
src
,
const
DevMem2Df
&
xmap
,
const
DevMem2Df
&
ymap
,
DevMem2D
dst
);
void
remap_gpu_3c
(
const
DevMem2D
&
src
,
const
DevMem2Df
&
xmap
,
const
DevMem2Df
&
ymap
,
DevMem2D
dst
);
...
...
@@ -90,10 +90,10 @@ namespace cv { namespace gpu
////////////////////////////////////////////////////////////////////////
// remap
void
cv
::
gpu
::
remap
(
const
GpuMat
&
src
,
const
GpuMat
&
xmap
,
const
GpuMat
&
ymap
,
GpuMat
&
dst
)
void
cv
::
gpu
::
remap
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
xmap
,
const
GpuMat
&
ymap
)
{
typedef
void
(
*
remap_gpu_t
)(
const
DevMem2D
&
src
,
const
DevMem2Df
&
xmap
,
const
DevMem2Df
&
ymap
,
DevMem2D
dst
);
static
const
remap_gpu_t
callers
[]
=
{
imp
l
::
remap_gpu_1c
,
0
,
impl
::
remap_gpu_3c
};
static
const
remap_gpu_t
callers
[]
=
{
imp
roc
::
remap_gpu_1c
,
0
,
improc
::
remap_gpu_3c
};
CV_Assert
((
src
.
type
()
==
CV_8U
||
src
.
type
()
==
CV_8UC3
)
&&
xmap
.
type
()
==
CV_32F
&&
ymap
.
type
()
==
CV_32F
);
...
...
@@ -111,7 +111,7 @@ void cv::gpu::remap(const GpuMat& src, const GpuMat& xmap, const GpuMat& ymap, G
////////////////////////////////////////////////////////////////////////
// meanShiftFiltering_GPU
void
cv
::
gpu
::
meanShiftFiltering
_GPU
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
sp
,
int
sr
,
TermCriteria
criteria
)
void
cv
::
gpu
::
meanShiftFiltering
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
sp
,
int
sr
,
TermCriteria
criteria
)
{
if
(
src
.
empty
()
)
CV_Error
(
CV_StsBadArg
,
"The input image is empty"
);
...
...
@@ -131,7 +131,7 @@ void cv::gpu::meanShiftFiltering_GPU(const GpuMat& src, GpuMat& dst, int sp, int
eps
=
1.
f
;
eps
=
(
float
)
std
::
max
(
criteria
.
epsilon
,
0.0
);
imp
l
::
meanShiftFiltering_gpu
(
src
,
dst
,
sp
,
sr
,
maxIter
,
eps
);
imp
roc
::
meanShiftFiltering_gpu
(
src
,
dst
,
sp
,
sr
,
maxIter
,
eps
);
}
////////////////////////////////////////////////////////////////////////
...
...
@@ -147,7 +147,7 @@ namespace
out
=
dst
;
out
.
create
(
src
.
size
(),
CV_8UC4
);
imp
l
::
drawColorDisp_gpu
((
DevMem2D_
<
T
>
)
src
,
out
,
ndisp
,
stream
);
imp
roc
::
drawColorDisp_gpu
((
DevMem2D_
<
T
>
)
src
,
out
,
ndisp
,
stream
);
dst
=
out
;
}
...
...
@@ -180,7 +180,7 @@ namespace
void
reprojectImageTo3D_caller
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
cudaStream_t
&
stream
)
{
xyzw
.
create
(
disp
.
rows
,
disp
.
cols
,
CV_32FC4
);
imp
l
::
reprojectImageTo3D_gpu
((
DevMem2D_
<
T
>
)
disp
,
xyzw
,
Q
.
ptr
<
float
>
(),
stream
);
imp
roc
::
reprojectImageTo3D_gpu
((
DevMem2D_
<
T
>
)
disp
,
xyzw
,
Q
.
ptr
<
float
>
(),
stream
);
}
typedef
void
(
*
reprojectImageTo3D_caller_t
)(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
cudaStream_t
&
stream
);
...
...
@@ -188,14 +188,14 @@ namespace
const
reprojectImageTo3D_caller_t
reprojectImageTo3D_callers
[]
=
{
reprojectImageTo3D_caller
<
unsigned
char
>
,
0
,
0
,
reprojectImageTo3D_caller
<
short
>
,
0
,
0
,
0
,
0
};
}
void
cv
::
gpu
::
reprojectImageTo3D
_GPU
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
)
void
cv
::
gpu
::
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
)
{
CV_Assert
((
disp
.
type
()
==
CV_8U
||
disp
.
type
()
==
CV_16S
)
&&
Q
.
type
()
==
CV_32F
&&
Q
.
rows
==
4
&&
Q
.
cols
==
4
);
reprojectImageTo3D_callers
[
disp
.
type
()](
disp
,
xyzw
,
Q
,
0
);
}
void
cv
::
gpu
::
reprojectImageTo3D
_GPU
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
Stream
&
stream
)
void
cv
::
gpu
::
reprojectImageTo3D
(
const
GpuMat
&
disp
,
GpuMat
&
xyzw
,
const
Mat
&
Q
,
const
Stream
&
stream
)
{
CV_Assert
((
disp
.
type
()
==
CV_8U
||
disp
.
type
()
==
CV_16S
)
&&
Q
.
type
()
==
CV_32F
&&
Q
.
rows
==
4
&&
Q
.
cols
==
4
);
...
...
@@ -229,11 +229,11 @@ namespace
out
.
create
(
sz
,
CV_MAKETYPE
(
depth
,
dcn
));
if
(
depth
==
CV_8U
)
imp
l
::
RGB2RGB_gpu
((
DevMem2D
)
src
,
scn
,
(
DevMem2D
)
out
,
dcn
,
bidx
,
stream
);
imp
roc
::
RGB2RGB_gpu
((
DevMem2D
)
src
,
scn
,
(
DevMem2D
)
out
,
dcn
,
bidx
,
stream
);
else
if
(
depth
==
CV_16U
)
imp
l
::
RGB2RGB_gpu
((
DevMem2D_
<
unsigned
short
>
)
src
,
scn
,
(
DevMem2D_
<
unsigned
short
>
)
out
,
dcn
,
bidx
,
stream
);
imp
roc
::
RGB2RGB_gpu
((
DevMem2D_
<
unsigned
short
>
)
src
,
scn
,
(
DevMem2D_
<
unsigned
short
>
)
out
,
dcn
,
bidx
,
stream
);
else
imp
l
::
RGB2RGB_gpu
((
DevMem2Df
)
src
,
scn
,
(
DevMem2Df
)
out
,
dcn
,
bidx
,
stream
);
imp
roc
::
RGB2RGB_gpu
((
DevMem2Df
)
src
,
scn
,
(
DevMem2Df
)
out
,
dcn
,
bidx
,
stream
);
break
;
//case CV_BGR2BGR565: case CV_BGR2BGR555: case CV_RGB2BGR565: case CV_RGB2BGR555:
...
...
@@ -270,11 +270,11 @@ namespace
bidx
=
code
==
CV_BGR2GRAY
||
code
==
CV_BGRA2GRAY
?
0
:
2
;
if
(
depth
==
CV_8U
)
imp
l
::
RGB2Gray_gpu
((
DevMem2D
)
src
,
scn
,
(
DevMem2D
)
out
,
bidx
,
stream
);
imp
roc
::
RGB2Gray_gpu
((
DevMem2D
)
src
,
scn
,
(
DevMem2D
)
out
,
bidx
,
stream
);
else
if
(
depth
==
CV_16U
)
imp
l
::
RGB2Gray_gpu
((
DevMem2D_
<
unsigned
short
>
)
src
,
scn
,
(
DevMem2D_
<
unsigned
short
>
)
out
,
bidx
,
stream
);
imp
roc
::
RGB2Gray_gpu
((
DevMem2D_
<
unsigned
short
>
)
src
,
scn
,
(
DevMem2D_
<
unsigned
short
>
)
out
,
bidx
,
stream
);
else
imp
l
::
RGB2Gray_gpu
((
DevMem2Df
)
src
,
scn
,
(
DevMem2Df
)
out
,
bidx
,
stream
);
imp
roc
::
RGB2Gray_gpu
((
DevMem2Df
)
src
,
scn
,
(
DevMem2Df
)
out
,
bidx
,
stream
);
break
;
//case CV_BGR5652GRAY: case CV_BGR5552GRAY:
...
...
@@ -291,11 +291,11 @@ namespace
out
.
create
(
sz
,
CV_MAKETYPE
(
depth
,
dcn
));
if
(
depth
==
CV_8U
)
imp
l
::
Gray2RGB_gpu
((
DevMem2D
)
src
,
(
DevMem2D
)
out
,
dcn
,
stream
);
imp
roc
::
Gray2RGB_gpu
((
DevMem2D
)
src
,
(
DevMem2D
)
out
,
dcn
,
stream
);
else
if
(
depth
==
CV_16U
)
imp
l
::
Gray2RGB_gpu
((
DevMem2D_
<
unsigned
short
>
)
src
,
(
DevMem2D_
<
unsigned
short
>
)
out
,
dcn
,
stream
);
imp
roc
::
Gray2RGB_gpu
((
DevMem2D_
<
unsigned
short
>
)
src
,
(
DevMem2D_
<
unsigned
short
>
)
out
,
dcn
,
stream
);
else
imp
l
::
Gray2RGB_gpu
((
DevMem2Df
)
src
,
(
DevMem2Df
)
out
,
dcn
,
stream
);
imp
roc
::
Gray2RGB_gpu
((
DevMem2Df
)
src
,
(
DevMem2Df
)
out
,
dcn
,
stream
);
break
;
//case CV_GRAY2BGR565: case CV_GRAY2BGR555:
...
...
@@ -516,12 +516,12 @@ namespace
}
}
void
cv
::
gpu
::
cvtColor
_GPU
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
)
void
cv
::
gpu
::
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
)
{
cvtColor_caller
(
src
,
dst
,
code
,
dcn
,
0
);
}
void
cv
::
gpu
::
cvtColor
_GPU
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
,
const
Stream
&
stream
)
void
cv
::
gpu
::
cvtColor
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
int
code
,
int
dcn
,
const
Stream
&
stream
)
{
cvtColor_caller
(
src
,
dst
,
code
,
dcn
,
StreamAccessor
::
getStream
(
stream
));
}
...
...
modules/gpu/src/matrix_operations.cpp
View file @
6960e154
...
...
@@ -120,7 +120,7 @@ void cv::gpu::GpuMat::copyTo( GpuMat& mat, const GpuMat& mask ) const
else
{
mat
.
create
(
size
(),
type
());
cv
::
gpu
::
impl
::
copy_to_with_mask
(
*
this
,
mat
,
depth
(),
mask
,
channels
());
cv
::
gpu
::
matrix_operations
::
copy_to_with_mask
(
*
this
,
mat
,
depth
(),
mask
,
channels
());
}
}
...
...
@@ -146,12 +146,12 @@ void cv::gpu::GpuMat::convertTo( GpuMat& dst, int rtype, double alpha, double be
psrc
=
&
(
temp
=
*
this
);
dst
.
create
(
size
(),
rtype
);
impl
::
convert_to
(
*
psrc
,
sdepth
,
dst
,
ddepth
,
psrc
->
channels
(),
alpha
,
beta
);
matrix_operations
::
convert_to
(
*
psrc
,
sdepth
,
dst
,
ddepth
,
psrc
->
channels
(),
alpha
,
beta
);
}
GpuMat
&
GpuMat
::
operator
=
(
const
Scalar
&
s
)
{
impl
::
set_to_without_mask
(
*
this
,
depth
(),
s
.
val
,
channels
());
matrix_operations
::
set_to_without_mask
(
*
this
,
depth
(),
s
.
val
,
channels
());
return
*
this
;
}
...
...
@@ -162,9 +162,9 @@ GpuMat& GpuMat::setTo(const Scalar& s, const GpuMat& mask)
CV_DbgAssert
(
!
this
->
empty
());
if
(
mask
.
empty
())
impl
::
set_to_without_mask
(
*
this
,
depth
(),
s
.
val
,
channels
());
matrix_operations
::
set_to_without_mask
(
*
this
,
depth
(),
s
.
val
,
channels
());
else
impl
::
set_to_with_mask
(
*
this
,
depth
(),
s
.
val
,
mask
,
channels
());
matrix_operations
::
set_to_with_mask
(
*
this
,
depth
(),
s
.
val
,
mask
,
channels
());
return
*
this
;
}
...
...
modules/gpu/src/stereobm_gpu.cpp
View file @
6960e154
...
...
@@ -58,7 +58,7 @@ void cv::gpu::StereoBM_GPU::operator() ( const GpuMat&, const GpuMat&, GpuMat&,
namespace
cv
{
namespace
gpu
{
namespace
impl
namespace
bm
{
//extern "C" void stereoBM_GPU(const DevMem2D& left, const DevMem2D& right, const DevMem2D& disp, int ndisp, int winsz, const DevMem2D_<uint>& minSSD_buf);
extern
"C"
void
stereoBM_GPU
(
const
DevMem2D
&
left
,
const
DevMem2D
&
right
,
const
DevMem2D
&
disp
,
int
ndisp
,
int
winsz
,
const
DevMem2D_
<
uint
>&
minSSD_buf
,
const
cudaStream_t
&
stream
);
...
...
@@ -115,17 +115,17 @@ static void stereo_bm_gpu_operator ( GpuMat& minSSD, GpuMat& leBuf, GpuMat& ri
leBuf
.
create
(
left
.
size
(),
left
.
type
());
riBuf
.
create
(
right
.
size
(),
right
.
type
());
impl
::
prefilter_xsobel
(
left
,
leBuf
);
impl
::
prefilter_xsobel
(
right
,
riBuf
);
bm
::
prefilter_xsobel
(
left
,
leBuf
);
bm
::
prefilter_xsobel
(
right
,
riBuf
);
le_for_bm
=
leBuf
;
ri_for_bm
=
riBuf
;
}
impl
::
stereoBM_GPU
(
le_for_bm
,
ri_for_bm
,
disparity
,
ndisp
,
winSize
,
minSSD
,
stream
);
bm
::
stereoBM_GPU
(
le_for_bm
,
ri_for_bm
,
disparity
,
ndisp
,
winSize
,
minSSD
,
stream
);
if
(
avergeTexThreshold
)
impl
::
postfilter_textureness
(
le_for_bm
,
winSize
,
avergeTexThreshold
,
disparity
);
bm
::
postfilter_textureness
(
le_for_bm
,
winSize
,
avergeTexThreshold
,
disparity
);
}
...
...
tests/gpu/src/meanshift.cpp
View file @
6960e154
...
...
@@ -76,7 +76,7 @@ void CV_GpuMeanShiftTest::run(int)
cvtColor
(
img
,
rgba
,
CV_BGR2BGRA
);
cv
::
gpu
::
GpuMat
res
;
cv
::
gpu
::
meanShiftFiltering
_GPU
(
cv
::
gpu
::
GpuMat
(
rgba
),
res
,
spatialRad
,
colorRad
);
cv
::
gpu
::
meanShiftFiltering
(
cv
::
gpu
::
GpuMat
(
rgba
),
res
,
spatialRad
,
colorRad
);
if
(
res
.
type
()
!=
CV_8UC4
)
{
ts
->
set_failed_test_info
(
CvTS
::
FAIL_INVALID_OUTPUT
);
...
...
tests/gpu/src/stereo_bm.cpp
View file @
6960e154
...
...
@@ -51,6 +51,7 @@ class CV_GpuStereoBMTest : public CvTest
{
public
:
CV_GpuStereoBMTest
();
protected
:
void
run
(
int
);
};
...
...
@@ -61,9 +62,9 @@ void CV_GpuStereoBMTest::run(int )
{
cv
::
Mat
img_l
=
cv
::
imread
(
std
::
string
(
ts
->
get_data_path
())
+
"stereobm/aloe-L.png"
,
0
);
cv
::
Mat
img_r
=
cv
::
imread
(
std
::
string
(
ts
->
get_data_path
())
+
"stereobm/aloe-R.png"
,
0
);
cv
::
Mat
img_
templat
e
=
cv
::
imread
(
std
::
string
(
ts
->
get_data_path
())
+
"stereobm/aloe-disp.png"
,
0
);
cv
::
Mat
img_
referenc
e
=
cv
::
imread
(
std
::
string
(
ts
->
get_data_path
())
+
"stereobm/aloe-disp.png"
,
0
);
if
(
img_l
.
empty
()
||
img_r
.
empty
()
||
img_
templat
e
.
empty
())
if
(
img_l
.
empty
()
||
img_r
.
empty
()
||
img_
referenc
e
.
empty
())
{
ts
->
set_failed_test_info
(
CvTS
::
FAIL_MISSING_TEST_DATA
);
return
;
...
...
@@ -71,14 +72,11 @@ void CV_GpuStereoBMTest::run(int )
cv
::
gpu
::
GpuMat
disp
;
cv
::
gpu
::
StereoBM_GPU
bm
(
0
,
128
,
19
);
bm
(
cv
::
gpu
::
GpuMat
(
img_l
),
cv
::
gpu
::
GpuMat
(
img_r
),
disp
);
//cv::imwrite(std::string(ts->get_data_path()) + "stereobm/aloe-disp.png", disp);
disp
.
convertTo
(
disp
,
img_template
.
type
());
disp
.
convertTo
(
disp
,
img_reference
.
type
());
double
norm
=
cv
::
norm
(
disp
,
img_reference
,
cv
::
NORM_INF
);
double
norm
=
cv
::
norm
(
disp
,
img_template
,
cv
::
NORM_INF
);
if
(
norm
>=
100
)
ts
->
printf
(
CvTS
::
CONSOLE
,
"
\n
StereoBM norm = %f
\n
"
,
norm
);
ts
->
set_failed_test_info
((
norm
<
100
)
?
CvTS
::
OK
:
CvTS
::
FAIL_GENERIC
);
...
...
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