Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
fcfa7208
O
Opencv
项目概览
Greenplum
/
Opencv
11 个月 前同步成功
通知
7
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Opencv
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fcfa7208
编写于
11月 09, 2011
作者:
V
Vladislav Vinogradov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
moved GpuMat and DevMem2D to core module, some code refactoring
上级
8a148e39
变更
93
展开全部
隐藏空白更改
内联
并排
Showing
93 changed file
with
17806 addition
and
16397 deletion
+17806
-16397
modules/core/include/opencv2/core/core.hpp
modules/core/include/opencv2/core/core.hpp
+8
-0
modules/core/include/opencv2/core/devmem2d.hpp
modules/core/include/opencv2/core/devmem2d.hpp
+157
-0
modules/core/include/opencv2/core/gpumat.hpp
modules/core/include/opencv2/core/gpumat.hpp
+471
-0
modules/core/src/gpumat.cpp
modules/core/src/gpumat.cpp
+460
-0
modules/gpu/CMakeLists.txt
modules/gpu/CMakeLists.txt
+17
-13
modules/gpu/include/opencv2/gpu/devmem2d.hpp
modules/gpu/include/opencv2/gpu/devmem2d.hpp
+1
-119
modules/gpu/include/opencv2/gpu/gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+1415
-1405
modules/gpu/include/opencv2/gpu/gpumat.hpp
modules/gpu/include/opencv2/gpu/gpumat.hpp
+1
-424
modules/gpu/perf/perf_arithm.cpp
modules/gpu/perf/perf_arithm.cpp
+21
-21
modules/gpu/perf/perf_calib3d.cpp
modules/gpu/perf/perf_calib3d.cpp
+2
-2
modules/gpu/perf/perf_filters.cpp
modules/gpu/perf/perf_filters.cpp
+4
-4
modules/gpu/perf/perf_imgproc.cpp
modules/gpu/perf/perf_imgproc.cpp
+4
-4
modules/gpu/perf/perf_matop.cpp
modules/gpu/perf/perf_matop.cpp
+5
-5
modules/gpu/src/arithm.cpp
modules/gpu/src/arithm.cpp
+19
-12
modules/gpu/src/bilateral_filter.cpp
modules/gpu/src/bilateral_filter.cpp
+13
-7
modules/gpu/src/blend.cpp
modules/gpu/src/blend.cpp
+10
-6
modules/gpu/src/brute_force_matcher.cpp
modules/gpu/src/brute_force_matcher.cpp
+36
-32
modules/gpu/src/calib3d.cpp
modules/gpu/src/calib3d.cpp
+28
-23
modules/gpu/src/cascadeclassifier.cpp
modules/gpu/src/cascadeclassifier.cpp
+0
-1
modules/gpu/src/color.cpp
modules/gpu/src/color.cpp
+152
-149
modules/gpu/src/cuda/bf_knnmatch.cu
modules/gpu/src/cuda/bf_knnmatch.cu
+847
-845
modules/gpu/src/cuda/bf_match.cu
modules/gpu/src/cuda/bf_match.cu
+563
-561
modules/gpu/src/cuda/bf_radius_match.cu
modules/gpu/src/cuda/bf_radius_match.cu
+333
-331
modules/gpu/src/cuda/bilateral_filter.cu
modules/gpu/src/cuda/bilateral_filter.cu
+141
-146
modules/gpu/src/cuda/blend.cu
modules/gpu/src/cuda/blend.cu
+58
-62
modules/gpu/src/cuda/calib3d.cu
modules/gpu/src/cuda/calib3d.cu
+120
-124
modules/gpu/src/cuda/canny.cu
modules/gpu/src/cuda/canny.cu
+320
-317
modules/gpu/src/cuda/color.cu
modules/gpu/src/cuda/color.cu
+334
-333
modules/gpu/src/cuda/column_filter.cu
modules/gpu/src/cuda/column_filter.cu
+168
-169
modules/gpu/src/cuda/copy_make_border.cu
modules/gpu/src/cuda/copy_make_border.cu
+70
-68
modules/gpu/src/cuda/element_operations.cu
modules/gpu/src/cuda/element_operations.cu
+1828
-1827
modules/gpu/src/cuda/hist.cu
modules/gpu/src/cuda/hist.cu
+118
-117
modules/gpu/src/cuda/hog.cu
modules/gpu/src/cuda/hog.cu
+38
-34
modules/gpu/src/cuda/imgproc.cu
modules/gpu/src/cuda/imgproc.cu
+747
-749
modules/gpu/src/cuda/internal_shared.hpp
modules/gpu/src/cuda/internal_shared.hpp
+146
-130
modules/gpu/src/cuda/match_template.cu
modules/gpu/src/cuda/match_template.cu
+10
-8
modules/gpu/src/cuda/mathfunc.cu
modules/gpu/src/cuda/mathfunc.cu
+130
-134
modules/gpu/src/cuda/matrix_operations.cu
modules/gpu/src/cuda/matrix_operations.cu
+247
-245
modules/gpu/src/cuda/matrix_reductions.cu
modules/gpu/src/cuda/matrix_reductions.cu
+317
-333
modules/gpu/src/cuda/pyr_down.cu
modules/gpu/src/cuda/pyr_down.cu
+119
-117
modules/gpu/src/cuda/pyr_up.cu
modules/gpu/src/cuda/pyr_up.cu
+102
-100
modules/gpu/src/cuda/remap.cu
modules/gpu/src/cuda/remap.cu
+146
-145
modules/gpu/src/cuda/resize.cu
modules/gpu/src/cuda/resize.cu
+153
-152
modules/gpu/src/cuda/row_filter.cu
modules/gpu/src/cuda/row_filter.cu
+183
-184
modules/gpu/src/cuda/safe_call.hpp
modules/gpu/src/cuda/safe_call.hpp
+36
-38
modules/gpu/src/cuda/split_merge.cu
modules/gpu/src/cuda/split_merge.cu
+419
-417
modules/gpu/src/cuda/stereobm.cu
modules/gpu/src/cuda/stereobm.cu
+16
-19
modules/gpu/src/cuda/stereobp.cu
modules/gpu/src/cuda/stereobp.cu
+357
-352
modules/gpu/src/cuda/stereocsbp.cu
modules/gpu/src/cuda/stereocsbp.cu
+616
-616
modules/gpu/src/cuda/surf.cu
modules/gpu/src/cuda/surf.cu
+768
-747
modules/gpu/src/cudastream.cpp
modules/gpu/src/cudastream.cpp
+15
-11
modules/gpu/src/element_operations.cpp
modules/gpu/src/element_operations.cpp
+181
-158
modules/gpu/src/filtering.cpp
modules/gpu/src/filtering.cpp
+27
-16
modules/gpu/src/hog.cpp
modules/gpu/src/hog.cpp
+35
-31
modules/gpu/src/imgproc.cpp
modules/gpu/src/imgproc.cpp
+173
-75
modules/gpu/src/initialization.cpp
modules/gpu/src/initialization.cpp
+375
-0
modules/gpu/src/match_template.cpp
modules/gpu/src/match_template.cpp
+30
-28
modules/gpu/src/matrix_operations.cpp
modules/gpu/src/matrix_operations.cpp
+133
-0
modules/gpu/src/matrix_reductions.cpp
modules/gpu/src/matrix_reductions.cpp
+181
-145
modules/gpu/src/mssegmentation.cpp
modules/gpu/src/mssegmentation.cpp
+5
-5
modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp
modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp
+572
-570
modules/gpu/src/opencv2/gpu/device/color.hpp
modules/gpu/src/opencv2/gpu/device/color.hpp
+126
-124
modules/gpu/src/opencv2/gpu/device/datamov_utils.hpp
modules/gpu/src/opencv2/gpu/device/datamov_utils.hpp
+4
-3
modules/gpu/src/opencv2/gpu/device/detail/color_detail.hpp
modules/gpu/src/opencv2/gpu/device/detail/color_detail.hpp
+862
-860
modules/gpu/src/opencv2/gpu/device/detail/transform_detail.hpp
...es/gpu/src/opencv2/gpu/device/detail/transform_detail.hpp
+292
-291
modules/gpu/src/opencv2/gpu/device/detail/type_traits_detail.hpp
.../gpu/src/opencv2/gpu/device/detail/type_traits_detail.hpp
+130
-128
modules/gpu/src/opencv2/gpu/device/detail/utility_detail.hpp
modules/gpu/src/opencv2/gpu/device/detail/utility_detail.hpp
+630
-627
modules/gpu/src/opencv2/gpu/device/detail/vec_distance_detail.hpp
...gpu/src/opencv2/gpu/device/detail/vec_distance_detail.hpp
+53
-51
modules/gpu/src/opencv2/gpu/device/dynamic_smem.hpp
modules/gpu/src/opencv2/gpu/device/dynamic_smem.hpp
+31
-28
modules/gpu/src/opencv2/gpu/device/emulation.hpp
modules/gpu/src/opencv2/gpu/device/emulation.hpp
+14
-15
modules/gpu/src/opencv2/gpu/device/filters.hpp
modules/gpu/src/opencv2/gpu/device/filters.hpp
+66
-64
modules/gpu/src/opencv2/gpu/device/funcattrib.hpp
modules/gpu/src/opencv2/gpu/device/funcattrib.hpp
+21
-25
modules/gpu/src/opencv2/gpu/device/functional.hpp
modules/gpu/src/opencv2/gpu/device/functional.hpp
+372
-368
modules/gpu/src/opencv2/gpu/device/limits.hpp
modules/gpu/src/opencv2/gpu/device/limits.hpp
+187
-184
modules/gpu/src/opencv2/gpu/device/saturate_cast.hpp
modules/gpu/src/opencv2/gpu/device/saturate_cast.hpp
+160
-109
modules/gpu/src/opencv2/gpu/device/transform.hpp
modules/gpu/src/opencv2/gpu/device/transform.hpp
+25
-23
modules/gpu/src/opencv2/gpu/device/type_traits.hpp
modules/gpu/src/opencv2/gpu/device/type_traits.hpp
+28
-26
modules/gpu/src/opencv2/gpu/device/utility.hpp
modules/gpu/src/opencv2/gpu/device/utility.hpp
+124
-108
modules/gpu/src/opencv2/gpu/device/vec_distance.hpp
modules/gpu/src/opencv2/gpu/device/vec_distance.hpp
+131
-131
modules/gpu/src/opencv2/gpu/device/vec_math.hpp
modules/gpu/src/opencv2/gpu/device/vec_math.hpp
+120
-119
modules/gpu/src/opencv2/gpu/device/vec_traits.hpp
modules/gpu/src/opencv2/gpu/device/vec_traits.hpp
+158
-157
modules/gpu/src/opencv2/gpu/device/warp.hpp
modules/gpu/src/opencv2/gpu/device/warp.hpp
+60
-63
modules/gpu/src/opencv2/gpu/device/warp_reduce.hpp
modules/gpu/src/opencv2/gpu/device/warp_reduce.hpp
+22
-23
modules/gpu/src/split_merge.cpp
modules/gpu/src/split_merge.cpp
+22
-32
modules/gpu/src/stereobm.cpp
modules/gpu/src/stereobm.cpp
+38
-31
modules/gpu/src/stereobp.cpp
modules/gpu/src/stereobp.cpp
+13
-10
modules/gpu/src/stereocsbp.cpp
modules/gpu/src/stereocsbp.cpp
+20
-16
modules/gpu/src/surf.cpp
modules/gpu/src/surf.cpp
+20
-19
modules/gpu/test/test_filters.cpp
modules/gpu/test/test_filters.cpp
+2
-2
modules/gpu/test/test_hog.cpp
modules/gpu/test/test_hog.cpp
+8
-8
modules/gpu/test/test_imgproc.cpp
modules/gpu/test/test_imgproc.cpp
+1
-1
samples/gpu/stereo_match.cpp
samples/gpu/stereo_match.cpp
+1
-1
samples/gpu/surf_keypoint_matcher.cpp
samples/gpu/surf_keypoint_matcher.cpp
+64
-64
未找到文件。
modules/core/include/opencv2/core/core.hpp
浏览文件 @
fcfa7208
...
...
@@ -90,6 +90,10 @@ class Mat;
class
SparseMat
;
typedef
Mat
MatND
;
namespace
gpu
{
class
GpuMat
;
}
class
CV_EXPORTS
MatExpr
;
class
CV_EXPORTS
MatOp_Base
;
class
CV_EXPORTS
MatArg
;
...
...
@@ -1627,6 +1631,10 @@ public:
template
<
typename
_Tp
>
explicit
Mat
(
const
Point3_
<
_Tp
>&
pt
,
bool
copyData
=
true
);
//! builds matrix from comma initializer
template
<
typename
_Tp
>
explicit
Mat
(
const
MatCommaInitializer_
<
_Tp
>&
commaInitializer
);
//! download data from GpuMat
explicit
Mat
(
const
gpu
::
GpuMat
&
m
);
//! destructor - calls release()
~
Mat
();
//! assignment operators
...
...
modules/
gpu/include/opencv2/gpu/matrix_operations
.hpp
→
modules/
core/include/opencv2/core/devmem2d
.hpp
浏览文件 @
fcfa7208
...
...
@@ -40,103 +40,118 @@
//
//M*/
#ifndef __OPENCV_
GPU_MATRIX_OPERATIONS
_HPP__
#define __OPENCV_
GPU_MATRIX_OPERATIONS
_HPP__
#ifndef __OPENCV_
CORE_DevMem2D
_HPP__
#define __OPENCV_
CORE_DevMem2D
_HPP__
namespace
cv
{
namespace
gpu
{
///////////////////////////////////////////////////////////////////////
//////////////////////////////// CudaMem ////////////////////////////////
///////////////////////////////////////////////////////////////////////
inline
CudaMem
::
CudaMem
()
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
),
alloc_type
(
0
)
{}
inline
CudaMem
::
CudaMem
(
int
_rows
,
int
_cols
,
int
_type
,
int
_alloc_type
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
),
alloc_type
(
0
)
{
if
(
_rows
>
0
&&
_cols
>
0
)
create
(
_rows
,
_cols
,
_type
,
_alloc_type
);
}
inline
CudaMem
::
CudaMem
(
Size
_size
,
int
_type
,
int
_alloc_type
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
),
alloc_type
(
0
)
{
if
(
_size
.
height
>
0
&&
_size
.
width
>
0
)
create
(
_size
.
height
,
_size
.
width
,
_type
,
_alloc_type
);
}
inline
CudaMem
::
CudaMem
(
const
CudaMem
&
m
)
:
flags
(
m
.
flags
),
rows
(
m
.
rows
),
cols
(
m
.
cols
),
step
(
m
.
step
),
data
(
m
.
data
),
refcount
(
m
.
refcount
),
datastart
(
m
.
datastart
),
dataend
(
m
.
dataend
),
alloc_type
(
m
.
alloc_type
)
{
if
(
refcount
)
CV_XADD
(
refcount
,
1
);
}
inline
CudaMem
::
CudaMem
(
const
Mat
&
m
,
int
_alloc_type
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
),
alloc_type
(
0
)
{
if
(
m
.
rows
>
0
&&
m
.
cols
>
0
)
create
(
m
.
size
(),
m
.
type
(),
_alloc_type
);
Mat
tmp
=
createMatHeader
();
m
.
copyTo
(
tmp
);
}
inline
CudaMem
::~
CudaMem
()
{
release
();
}
#ifdef __CUDACC__
#define __CV_GPU_HOST_DEVICE__ __host__ __device__ __forceinline__
#else
#define __CV_GPU_HOST_DEVICE__
#endif
inline
CudaMem
&
CudaMem
::
operator
=
(
const
CudaMem
&
m
)
{
if
(
this
!=
&
m
)
namespace
cv
{
namespace
gpu
{
if
(
m
.
refcount
)
CV_XADD
(
m
.
refcount
,
1
);
release
();
flags
=
m
.
flags
;
rows
=
m
.
rows
;
cols
=
m
.
cols
;
step
=
m
.
step
;
data
=
m
.
data
;
datastart
=
m
.
datastart
;
dataend
=
m
.
dataend
;
refcount
=
m
.
refcount
;
alloc_type
=
m
.
alloc_type
;
}
return
*
this
;
}
inline
CudaMem
CudaMem
::
clone
()
const
{
CudaMem
m
(
size
(),
type
(),
alloc_type
);
Mat
to
=
m
;
Mat
from
=
*
this
;
from
.
copyTo
(
to
);
return
m
;
// Simple lightweight structures that encapsulates information about an image on device.
// It is intended to pass to nvcc-compiled code. GpuMat depends on headers that nvcc can't compile
template
<
bool
expr
>
struct
StaticAssert
;
template
<
>
struct
StaticAssert
<
true
>
{
static
__CV_GPU_HOST_DEVICE__
void
check
(){}};
template
<
typename
T
>
struct
DevPtr
{
typedef
T
elem_type
;
typedef
int
index_type
;
enum
{
elem_size
=
sizeof
(
elem_type
)
};
T
*
data
;
__CV_GPU_HOST_DEVICE__
DevPtr
()
:
data
(
0
)
{}
__CV_GPU_HOST_DEVICE__
DevPtr
(
T
*
data_
)
:
data
(
data_
)
{}
__CV_GPU_HOST_DEVICE__
size_t
elemSize
()
const
{
return
elem_size
;
}
__CV_GPU_HOST_DEVICE__
operator
T
*
()
{
return
data
;
}
__CV_GPU_HOST_DEVICE__
operator
const
T
*
()
const
{
return
data
;
}
};
template
<
typename
T
>
struct
PtrSz
:
public
DevPtr
<
T
>
{
__CV_GPU_HOST_DEVICE__
PtrSz
()
:
size
(
0
)
{}
__CV_GPU_HOST_DEVICE__
PtrSz
(
T
*
data_
,
size_t
size_
)
:
DevPtr
<
T
>
(
data_
),
size
(
size_
)
{}
size_t
size
;
};
template
<
typename
T
>
struct
PtrStep
:
public
DevPtr
<
T
>
{
__CV_GPU_HOST_DEVICE__
PtrStep
()
:
step
(
0
)
{}
__CV_GPU_HOST_DEVICE__
PtrStep
(
T
*
data_
,
size_t
step_
)
:
DevPtr
<
T
>
(
data_
),
step
(
step_
)
{}
/** \brief stride between two consecutive rows in bytes. Step is stored always and everywhere in bytes!!! */
size_t
step
;
__CV_GPU_HOST_DEVICE__
T
*
ptr
(
int
y
=
0
)
{
return
(
T
*
)(
(
char
*
)
DevPtr
<
T
>::
data
+
y
*
step
);
}
__CV_GPU_HOST_DEVICE__
const
T
*
ptr
(
int
y
=
0
)
const
{
return
(
const
T
*
)(
(
const
char
*
)
DevPtr
<
T
>::
data
+
y
*
step
);
}
__CV_GPU_HOST_DEVICE__
T
&
operator
()(
int
y
,
int
x
)
{
return
ptr
(
y
)[
x
];
}
__CV_GPU_HOST_DEVICE__
const
T
&
operator
()(
int
y
,
int
x
)
const
{
return
ptr
(
y
)[
x
];
}
};
template
<
typename
T
>
struct
PtrStepSz
:
public
PtrStep
<
T
>
{
__CV_GPU_HOST_DEVICE__
PtrStepSz
()
:
cols
(
0
),
rows
(
0
)
{}
__CV_GPU_HOST_DEVICE__
PtrStepSz
(
int
rows_
,
int
cols_
,
T
*
data_
,
size_t
step_
)
:
PtrStep
<
T
>
(
data_
,
step_
),
cols
(
cols_
),
rows
(
rows_
)
{}
int
cols
;
int
rows
;
};
template
<
typename
T
>
struct
DevMem2D_
:
public
PtrStepSz
<
T
>
{
DevMem2D_
()
{}
DevMem2D_
(
int
rows_
,
int
cols_
,
T
*
data_
,
size_t
step_
)
:
PtrStepSz
<
T
>
(
rows_
,
cols_
,
data_
,
step_
)
{}
template
<
typename
U
>
explicit
DevMem2D_
(
const
DevMem2D_
<
U
>&
d
)
:
PtrStepSz
<
T
>
(
d
.
rows
,
d
.
cols
,
(
T
*
)
d
.
data
,
d
.
step
)
{}
};
template
<
typename
T
>
struct
PtrElemStep_
:
public
PtrStep
<
T
>
{
PtrElemStep_
(
const
DevMem2D_
<
T
>&
mem
)
:
PtrStep
<
T
>
(
mem
.
data
,
mem
.
step
)
{
StaticAssert
<
256
%
sizeof
(
T
)
==
0
>::
check
();
PtrStep
<
T
>::
step
/=
PtrStep
<
T
>::
elem_size
;
}
__CV_GPU_HOST_DEVICE__
T
*
ptr
(
int
y
=
0
)
{
return
PtrStep
<
T
>::
data
+
y
*
PtrStep
<
T
>::
step
;
}
__CV_GPU_HOST_DEVICE__
const
T
*
ptr
(
int
y
=
0
)
const
{
return
PtrStep
<
T
>::
data
+
y
*
PtrStep
<
T
>::
step
;
}
__CV_GPU_HOST_DEVICE__
T
&
operator
()(
int
y
,
int
x
)
{
return
ptr
(
y
)[
x
];
}
__CV_GPU_HOST_DEVICE__
const
T
&
operator
()(
int
y
,
int
x
)
const
{
return
ptr
(
y
)[
x
];
}
};
template
<
typename
T
>
struct
PtrStep_
:
public
PtrStep
<
T
>
{
PtrStep_
()
{}
PtrStep_
(
const
DevMem2D_
<
T
>&
mem
)
:
PtrStep
<
T
>
(
mem
.
data
,
mem
.
step
)
{}
};
typedef
DevMem2D_
<
unsigned
char
>
DevMem2Db
;
typedef
DevMem2Db
DevMem2D
;
typedef
DevMem2D_
<
float
>
DevMem2Df
;
typedef
DevMem2D_
<
int
>
DevMem2Di
;
typedef
PtrStep
<
unsigned
char
>
PtrStepb
;
typedef
PtrStep
<
float
>
PtrStepf
;
typedef
PtrStep
<
int
>
PtrStepi
;
typedef
PtrElemStep_
<
unsigned
char
>
PtrElemStep
;
typedef
PtrElemStep_
<
float
>
PtrElemStepf
;
typedef
PtrElemStep_
<
int
>
PtrElemStepi
;
}
}
inline
void
CudaMem
::
create
(
Size
_size
,
int
_type
,
int
_alloc_type
)
{
create
(
_size
.
height
,
_size
.
width
,
_type
,
_alloc_type
);
}
//CCP void CudaMem::create(int _rows, int _cols, int _type, int _alloc_type);
//CPP void CudaMem::release();
inline
Mat
CudaMem
::
createMatHeader
()
const
{
return
Mat
(
size
(),
type
(),
data
,
step
);
}
inline
CudaMem
::
operator
Mat
()
const
{
return
createMatHeader
();
}
inline
CudaMem
::
operator
GpuMat
()
const
{
return
createGpuMatHeader
();
}
//CPP GpuMat CudaMem::createGpuMatHeader() const;
inline
bool
CudaMem
::
isContinuous
()
const
{
return
(
flags
&
Mat
::
CONTINUOUS_FLAG
)
!=
0
;
}
inline
size_t
CudaMem
::
elemSize
()
const
{
return
CV_ELEM_SIZE
(
flags
);
}
inline
size_t
CudaMem
::
elemSize1
()
const
{
return
CV_ELEM_SIZE1
(
flags
);
}
inline
int
CudaMem
::
type
()
const
{
return
CV_MAT_TYPE
(
flags
);
}
inline
int
CudaMem
::
depth
()
const
{
return
CV_MAT_DEPTH
(
flags
);
}
inline
int
CudaMem
::
channels
()
const
{
return
CV_MAT_CN
(
flags
);
}
inline
size_t
CudaMem
::
step1
()
const
{
return
step
/
elemSize1
();
}
inline
Size
CudaMem
::
size
()
const
{
return
Size
(
cols
,
rows
);
}
inline
bool
CudaMem
::
empty
()
const
{
return
data
==
0
;
}
}
/* end of namespace gpu */
}
/* end of namespace cv */
#endif
/* __OPENCV_GPU_MATRIX_OPERATIONS_HPP__ */
#endif
/* __OPENCV_GPU_DevMem2D_HPP__ */
modules/core/include/opencv2/core/gpumat.hpp
0 → 100644
浏览文件 @
fcfa7208
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other GpuMaterials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_GPUMAT_HPP__
#define __OPENCV_GPUMAT_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/core/devmem2d.hpp"
namespace
cv
{
namespace
gpu
{
//! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.
class
CV_EXPORTS
GpuMat
{
public:
//! default constructor
GpuMat
();
//! constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
GpuMat
(
int
rows
,
int
cols
,
int
type
);
GpuMat
(
Size
size
,
int
type
);
//! constucts GpuMatrix and fills it with the specified value _s.
GpuMat
(
int
rows
,
int
cols
,
int
type
,
Scalar
s
);
GpuMat
(
Size
size
,
int
type
,
Scalar
s
);
//! copy constructor
GpuMat
(
const
GpuMat
&
m
);
//! constructor for GpuMatrix headers pointing to user-allocated data
GpuMat
(
int
rows
,
int
cols
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
GpuMat
(
Size
size
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
//! creates a matrix header for a part of the bigger matrix
GpuMat
(
const
GpuMat
&
m
,
Range
rowRange
,
Range
colRange
);
GpuMat
(
const
GpuMat
&
m
,
Rect
roi
);
//! builds GpuMat from Mat. Perfom blocking upload to device.
explicit
GpuMat
(
const
Mat
&
m
);
//! destructor - calls release()
~
GpuMat
();
//! assignment operators
GpuMat
&
operator
=
(
const
GpuMat
&
m
);
//! pefroms blocking upload data to GpuMat.
void
upload
(
const
Mat
&
m
);
//! downloads data from device to host memory. Blocking calls.
void
download
(
Mat
&
m
)
const
;
//! returns a new GpuMatrix header for the specified row
GpuMat
row
(
int
y
)
const
;
//! returns a new GpuMatrix header for the specified column
GpuMat
col
(
int
x
)
const
;
//! ... for the specified row span
GpuMat
rowRange
(
int
startrow
,
int
endrow
)
const
;
GpuMat
rowRange
(
Range
r
)
const
;
//! ... for the specified column span
GpuMat
colRange
(
int
startcol
,
int
endcol
)
const
;
GpuMat
colRange
(
Range
r
)
const
;
//! returns deep copy of the GpuMatrix, i.e. the data is copied
GpuMat
clone
()
const
;
//! copies the GpuMatrix content to "m".
// It calls m.create(this->size(), this->type()).
void
copyTo
(
GpuMat
&
m
)
const
;
//! copies those GpuMatrix elements to "m" that are marked with non-zero mask elements.
void
copyTo
(
GpuMat
&
m
,
const
GpuMat
&
mask
)
const
;
//! converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.
void
convertTo
(
GpuMat
&
m
,
int
rtype
,
double
alpha
=
1
,
double
beta
=
0
)
const
;
void
assignTo
(
GpuMat
&
m
,
int
type
=-
1
)
const
;
//! sets every GpuMatrix element to s
GpuMat
&
operator
=
(
Scalar
s
);
//! sets some of the GpuMatrix elements to s, according to the mask
GpuMat
&
setTo
(
Scalar
s
,
const
GpuMat
&
mask
=
GpuMat
());
//! creates alternative GpuMatrix header for the same data, with different
// number of channels and/or different number of rows. see cvReshape.
GpuMat
reshape
(
int
cn
,
int
rows
=
0
)
const
;
//! allocates new GpuMatrix data unless the GpuMatrix already has specified size and type.
// previous data is unreferenced if needed.
void
create
(
int
rows
,
int
cols
,
int
type
);
void
create
(
Size
size
,
int
type
);
//! decreases reference counter;
// deallocate the data when reference counter reaches 0.
void
release
();
//! swaps with other smart pointer
void
swap
(
GpuMat
&
mat
);
//! locates GpuMatrix header within a parent GpuMatrix. See below
void
locateROI
(
Size
&
wholeSize
,
Point
&
ofs
)
const
;
//! moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix.
GpuMat
&
adjustROI
(
int
dtop
,
int
dbottom
,
int
dleft
,
int
dright
);
//! extracts a rectangular sub-GpuMatrix
// (this is a generalized form of row, rowRange etc.)
GpuMat
operator
()(
Range
rowRange
,
Range
colRange
)
const
;
GpuMat
operator
()(
Rect
roi
)
const
;
//! returns true iff the GpuMatrix data is continuous
// (i.e. when there are no gaps between successive rows).
// similar to CV_IS_GpuMat_CONT(cvGpuMat->type)
bool
isContinuous
()
const
;
//! returns element size in bytes,
// similar to CV_ELEM_SIZE(cvMat->type)
size_t
elemSize
()
const
;
//! returns the size of element channel in bytes.
size_t
elemSize1
()
const
;
//! returns element type, similar to CV_MAT_TYPE(cvMat->type)
int
type
()
const
;
//! returns element type, similar to CV_MAT_DEPTH(cvMat->type)
int
depth
()
const
;
//! returns element type, similar to CV_MAT_CN(cvMat->type)
int
channels
()
const
;
//! returns step/elemSize1()
size_t
step1
()
const
;
//! returns GpuMatrix size:
// width == number of columns, height == number of rows
Size
size
()
const
;
//! returns true if GpuMatrix data is NULL
bool
empty
()
const
;
//! returns pointer to y-th row
uchar
*
ptr
(
int
y
=
0
);
const
uchar
*
ptr
(
int
y
=
0
)
const
;
//! template version of the above method
template
<
typename
_Tp
>
_Tp
*
ptr
(
int
y
=
0
);
template
<
typename
_Tp
>
const
_Tp
*
ptr
(
int
y
=
0
)
const
;
template
<
typename
_Tp
>
operator
DevMem2D_
<
_Tp
>
()
const
;
template
<
typename
_Tp
>
operator
PtrStep_
<
_Tp
>
()
const
;
/*! includes several bit-fields:
- the magic signature
- continuity flag
- depth
- number of channels
*/
int
flags
;
//! the number of rows and columns
int
rows
,
cols
;
//! a distance between successive rows in bytes; includes the gap if any
size_t
step
;
//! pointer to the data
uchar
*
data
;
//! pointer to the reference counter;
// when GpuMatrix points to user-allocated data, the pointer is NULL
int
*
refcount
;
//! helper fields used in locateROI and adjustROI
uchar
*
datastart
;
uchar
*
dataend
;
};
//! Creates continuous GPU matrix
CV_EXPORTS
void
createContinuous
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
createContinuous
(
int
rows
,
int
cols
,
int
type
);
CV_EXPORTS
void
createContinuous
(
Size
size
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
createContinuous
(
Size
size
,
int
type
);
//! Ensures that size of the given matrix is not less than (rows, cols) size
//! and matrix type is match specified one too
CV_EXPORTS
void
ensureSizeIsEnough
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
void
ensureSizeIsEnough
(
Size
size
,
int
type
,
GpuMat
&
m
);
class
CV_EXPORTS
GpuFuncTable
{
public:
virtual
~
GpuFuncTable
()
{}
virtual
void
copy
(
const
Mat
&
src
,
GpuMat
&
dst
)
const
=
0
;
virtual
void
copy
(
const
GpuMat
&
src
,
Mat
&
dst
)
const
=
0
;
virtual
void
copy
(
const
GpuMat
&
src
,
GpuMat
&
dst
)
const
=
0
;
virtual
void
copyWithMask
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
const
GpuMat
&
mask
)
const
=
0
;
virtual
void
convert
(
const
GpuMat
&
src
,
GpuMat
&
dst
)
const
=
0
;
virtual
void
convert
(
const
GpuMat
&
src
,
GpuMat
&
dst
,
double
alpha
,
double
beta
)
const
=
0
;
virtual
void
setTo
(
GpuMat
&
m
,
Scalar
s
,
const
GpuMat
&
mask
)
const
=
0
;
virtual
void
mallocPitch
(
void
**
devPtr
,
size_t
*
step
,
size_t
width
,
size_t
height
)
const
=
0
;
virtual
void
free
(
void
*
devPtr
)
const
=
0
;
};
CV_EXPORTS
void
setGpuFuncTable
(
const
GpuFuncTable
*
funcTbl
);
////////////////////////////////////////////////////////////////////////
inline
GpuMat
::
GpuMat
()
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
}
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
create
(
rows_
,
cols_
,
type_
);
}
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
,
Scalar
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
{
create
(
rows_
,
cols_
,
type_
);
setTo
(
s_
);
}
}
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
,
Scalar
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
{
create
(
size_
.
height
,
size_
.
width
,
type_
);
setTo
(
s_
);
}
}
inline
GpuMat
::~
GpuMat
()
{
release
();
}
inline
GpuMat
GpuMat
::
clone
()
const
{
GpuMat
m
;
copyTo
(
m
);
return
m
;
}
inline
void
GpuMat
::
assignTo
(
GpuMat
&
m
,
int
type
)
const
{
if
(
type
<
0
)
m
=
*
this
;
else
convertTo
(
m
,
type
);
}
inline
size_t
GpuMat
::
step1
()
const
{
return
step
/
elemSize1
();
}
inline
bool
GpuMat
::
empty
()
const
{
return
data
==
0
;
}
template
<
typename
_Tp
>
inline
_Tp
*
GpuMat
::
ptr
(
int
y
)
{
return
(
_Tp
*
)
ptr
(
y
);
}
template
<
typename
_Tp
>
inline
const
_Tp
*
GpuMat
::
ptr
(
int
y
)
const
{
return
(
const
_Tp
*
)
ptr
(
y
);
}
inline
void
swap
(
GpuMat
&
a
,
GpuMat
&
b
)
{
a
.
swap
(
b
);
}
inline
GpuMat
GpuMat
::
row
(
int
y
)
const
{
return
GpuMat
(
*
this
,
Range
(
y
,
y
+
1
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
col
(
int
x
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
x
,
x
+
1
));
}
inline
GpuMat
GpuMat
::
rowRange
(
int
startrow
,
int
endrow
)
const
{
return
GpuMat
(
*
this
,
Range
(
startrow
,
endrow
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
rowRange
(
Range
r
)
const
{
return
GpuMat
(
*
this
,
r
,
Range
::
all
());
}
inline
GpuMat
GpuMat
::
colRange
(
int
startcol
,
int
endcol
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
startcol
,
endcol
));
}
inline
GpuMat
GpuMat
::
colRange
(
Range
r
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
r
);
}
inline
void
GpuMat
::
create
(
Size
size_
,
int
type_
)
{
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
inline
GpuMat
GpuMat
::
operator
()(
Range
rowRange
,
Range
colRange
)
const
{
return
GpuMat
(
*
this
,
rowRange
,
colRange
);
}
inline
GpuMat
GpuMat
::
operator
()(
Rect
roi
)
const
{
return
GpuMat
(
*
this
,
roi
);
}
inline
bool
GpuMat
::
isContinuous
()
const
{
return
(
flags
&
Mat
::
CONTINUOUS_FLAG
)
!=
0
;
}
inline
size_t
GpuMat
::
elemSize
()
const
{
return
CV_ELEM_SIZE
(
flags
);
}
inline
size_t
GpuMat
::
elemSize1
()
const
{
return
CV_ELEM_SIZE1
(
flags
);
}
inline
int
GpuMat
::
type
()
const
{
return
CV_MAT_TYPE
(
flags
);
}
inline
int
GpuMat
::
depth
()
const
{
return
CV_MAT_DEPTH
(
flags
);
}
inline
int
GpuMat
::
channels
()
const
{
return
CV_MAT_CN
(
flags
);
}
inline
Size
GpuMat
::
size
()
const
{
return
Size
(
cols
,
rows
);
}
inline
uchar
*
GpuMat
::
ptr
(
int
y
)
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
const
uchar
*
GpuMat
::
ptr
(
int
y
)
const
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
GpuMat
&
GpuMat
::
operator
=
(
Scalar
s
)
{
setTo
(
s
);
return
*
this
;
}
template
<
class
T
>
inline
GpuMat
::
operator
DevMem2D_
<
T
>
()
const
{
return
DevMem2D_
<
T
>
(
rows
,
cols
,
(
T
*
)
data
,
step
);
}
template
<
class
T
>
inline
GpuMat
::
operator
PtrStep_
<
T
>
()
const
{
return
PtrStep_
<
T
>
(
static_cast
<
DevMem2D_
<
T
>
>
(
*
this
));
}
inline
GpuMat
createContinuous
(
int
rows
,
int
cols
,
int
type
)
{
GpuMat
m
;
createContinuous
(
rows
,
cols
,
type
,
m
);
return
m
;
}
inline
void
createContinuous
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
createContinuous
(
size
.
height
,
size
.
width
,
type
,
m
);
}
inline
GpuMat
createContinuous
(
Size
size
,
int
type
)
{
GpuMat
m
;
createContinuous
(
size
,
type
,
m
);
return
m
;
}
inline
void
ensureSizeIsEnough
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
ensureSizeIsEnough
(
size
.
height
,
size
.
width
,
type
,
m
);
}
inline
void
createContinuous
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
)
{
int
area
=
rows
*
cols
;
if
(
!
m
.
isContinuous
()
||
m
.
type
()
!=
type
||
m
.
size
().
area
()
!=
area
)
m
.
create
(
1
,
area
,
type
);
m
=
m
.
reshape
(
0
,
rows
);
}
inline
void
ensureSizeIsEnough
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
)
{
if
(
m
.
type
()
==
type
&&
m
.
rows
>=
rows
&&
m
.
cols
>=
cols
)
m
=
m
(
Rect
(
0
,
0
,
cols
,
rows
));
else
m
.
create
(
rows
,
cols
,
type
);
}
}}
#endif // __OPENCV_GPUMAT_HPP__
modules/
gpu
/src/gpumat.cpp
→
modules/
core
/src/gpumat.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/CMakeLists.txt
浏览文件 @
fcfa7208
...
...
@@ -3,7 +3,8 @@ set(name "gpu")
set
(
the_target
"opencv_
${
name
}
"
)
project
(
${
the_target
}
)
set
(
DEPS
"opencv_core"
"opencv_imgproc"
"opencv_objdetect"
"opencv_features2d"
"opencv_flann"
"opencv_calib3d"
)
#"opencv_features2d" "opencv_flann" "opencv_objdetect" - only headers needed
set
(
DEPS
"opencv_core"
"opencv_imgproc"
"opencv_calib3d"
"opencv_objdetect"
)
set
(
DEPS_HEADER
${
DEPS
}
"opencv_features2d"
"opencv_flann"
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
opencv_gpu
)
include_directories
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
...
...
@@ -27,6 +28,13 @@ file(GLOB lib_device_hdrs_detail "src/opencv2/gpu/device/detail/*.h*")
source_group
(
"Device"
FILES
${
lib_device_hdrs
}
)
source_group
(
"Device
\\
Detail"
FILES
${
lib_device_hdrs_detail
}
)
foreach
(
d
${
DEPS_HEADER
}
)
if
(
${
d
}
MATCHES
"opencv_"
)
string
(
REPLACE
"opencv_"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../"
d_dir
${
d
}
)
include_directories
(
"
${
d_dir
}
/include"
)
endif
()
endforeach
()
if
(
HAVE_CUDA
)
file
(
GLOB_RECURSE ncv_srcs
"src/nvidia/*.cpp"
)
file
(
GLOB_RECURSE ncv_cuda
"src/nvidia/*.cu"
)
...
...
@@ -50,7 +58,6 @@ if (HAVE_CUDA)
if
(
APPLE
)
set
(
CUDA_NVCC_FLAGS
${
CUDA_NVCC_FLAGS
}
"-Xcompiler;-fno-finite-math-only;"
)
endif
()
string
(
REPLACE
"/W4"
"/W3"
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
string
(
REPLACE
"/W4"
"/W3"
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
"
)
...
...
@@ -60,7 +67,7 @@ if (HAVE_CUDA)
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
#string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/wd4211 /wd4201 /wd4100 /wd4505 /wd4408"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/wd4211 /wd4201 /wd4100 /wd4505 /wd4408
/wd4251
"
)
string
(
REPLACE
"/EHsc-"
"/EHs"
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
"
)
string
(
REPLACE
"/EHsc-"
"/EHs"
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS_RELEASE
}
"
)
...
...
@@ -69,22 +76,19 @@ if (HAVE_CUDA)
string
(
REPLACE
"/EHsc-"
"/EHs"
CMAKE_CXX_FLAGS_RELEASE
"
${
CMAKE_CXX_FLAGS_RELEASE
}
"
)
string
(
REPLACE
"/EHsc-"
"/EHs"
CMAKE_CXX_FLAGS_DEBUG
"
${
CMAKE_CXX_FLAGS_DEBUG
}
"
)
endif
()
if
(
BUILD_SHARED_LIBS
)
set
(
CUDA_NVCC_FLAGS
${
CUDA_NVCC_FLAGS
}
"-Xcompiler;-DCVAPI_EXPORTS"
)
endif
()
set
(
CUDA_NVCC_FLAGS
${
CUDA_NVCC_FLAGS
}
"-Xcompiler;-DCVAPI_EXPORTS"
)
endif
()
if
(
MSVC
)
set
(
CUDA_NVCC_FLAGS
${
CUDA_NVCC_FLAGS
}
"-Xcompiler;/wd4251"
)
endif
()
CUDA_COMPILE
(
cuda_objs
${
lib_cuda
}
${
ncv_cuda
}
)
#CUDA_BUILD_CLEAN_TARGET()
endif
()
foreach
(
d
${
DEPS
}
)
if
(
${
d
}
MATCHES
"opencv_"
)
string
(
REPLACE
"opencv_"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../"
d_dir
${
d
}
)
include_directories
(
"
${
d_dir
}
/include"
)
endif
()
endforeach
()
add_library
(
${
the_target
}
${
lib_srcs
}
${
lib_hdrs
}
${
lib_int_hdrs
}
${
lib_cuda
}
${
lib_cuda_hdrs
}
${
lib_device_hdrs
}
${
lib_device_hdrs_detail
}
${
ncv_srcs
}
${
ncv_hdrs
}
${
ncv_cuda
}
${
cuda_objs
}
)
# For dynamic link numbering convenions
...
...
modules/gpu/include/opencv2/gpu/devmem2d.hpp
浏览文件 @
fcfa7208
...
...
@@ -40,122 +40,4 @@
//
//M*/
#ifndef __OPENCV_GPU_DevMem2D_HPP__
#define __OPENCV_GPU_DevMem2D_HPP__
namespace
cv
{
namespace
gpu
{
// Simple lightweight structures that encapsulates information about an image on device.
// It is intended to pass to nvcc-compiled code. GpuMat depends on headers that nvcc can't compile
#if defined(__CUDACC__)
#define __CV_GPU_HOST_DEVICE__ __host__ __device__ __forceinline__
#else
#define __CV_GPU_HOST_DEVICE__
#endif
template
<
bool
expr
>
struct
StaticAssert
;
template
<
>
struct
StaticAssert
<
true
>
{
static
__CV_GPU_HOST_DEVICE__
void
check
(){}};
template
<
typename
T
>
struct
DevPtr
{
typedef
T
elem_type
;
typedef
int
index_type
;
enum
{
elem_size
=
sizeof
(
elem_type
)
};
T
*
data
;
__CV_GPU_HOST_DEVICE__
DevPtr
()
:
data
(
0
)
{}
__CV_GPU_HOST_DEVICE__
DevPtr
(
T
*
data_
)
:
data
(
data_
)
{}
__CV_GPU_HOST_DEVICE__
size_t
elemSize
()
const
{
return
elem_size
;
}
__CV_GPU_HOST_DEVICE__
operator
T
*
()
{
return
data
;
}
__CV_GPU_HOST_DEVICE__
operator
const
T
*
()
const
{
return
data
;
}
};
template
<
typename
T
>
struct
PtrSz
:
public
DevPtr
<
T
>
{
__CV_GPU_HOST_DEVICE__
PtrSz
()
:
size
(
0
)
{}
__CV_GPU_HOST_DEVICE__
PtrSz
(
T
*
data_
,
size_t
size_
)
:
DevPtr
<
T
>
(
data_
),
size
(
size_
)
{}
size_t
size
;
};
template
<
typename
T
>
struct
PtrStep
:
public
DevPtr
<
T
>
{
__CV_GPU_HOST_DEVICE__
PtrStep
()
:
step
(
0
)
{}
__CV_GPU_HOST_DEVICE__
PtrStep
(
T
*
data_
,
size_t
step_
)
:
DevPtr
<
T
>
(
data_
),
step
(
step_
)
{}
/** \brief stride between two consecutive rows in bytes. Step is stored always and everywhere in bytes!!! */
size_t
step
;
__CV_GPU_HOST_DEVICE__
T
*
ptr
(
int
y
=
0
)
{
return
(
T
*
)(
(
char
*
)
DevPtr
<
T
>::
data
+
y
*
step
);
}
__CV_GPU_HOST_DEVICE__
const
T
*
ptr
(
int
y
=
0
)
const
{
return
(
const
T
*
)(
(
const
char
*
)
DevPtr
<
T
>::
data
+
y
*
step
);
}
__CV_GPU_HOST_DEVICE__
T
&
operator
()(
int
y
,
int
x
)
{
return
ptr
(
y
)[
x
];
}
__CV_GPU_HOST_DEVICE__
const
T
&
operator
()(
int
y
,
int
x
)
const
{
return
ptr
(
y
)[
x
];
}
};
template
<
typename
T
>
struct
PtrStepSz
:
public
PtrStep
<
T
>
{
__CV_GPU_HOST_DEVICE__
PtrStepSz
()
:
cols
(
0
),
rows
(
0
)
{}
__CV_GPU_HOST_DEVICE__
PtrStepSz
(
int
rows_
,
int
cols_
,
T
*
data_
,
size_t
step_
)
:
PtrStep
<
T
>
(
data_
,
step_
),
cols
(
cols_
),
rows
(
rows_
)
{}
int
cols
;
int
rows
;
};
template
<
typename
T
>
struct
DevMem2D_
:
public
PtrStepSz
<
T
>
{
DevMem2D_
()
{}
DevMem2D_
(
int
rows_
,
int
cols_
,
T
*
data_
,
size_t
step_
)
:
PtrStepSz
<
T
>
(
rows_
,
cols_
,
data_
,
step_
)
{}
template
<
typename
U
>
explicit
DevMem2D_
(
const
DevMem2D_
<
U
>&
d
)
:
PtrStepSz
<
T
>
(
d
.
rows
,
d
.
cols
,
(
T
*
)
d
.
data
,
d
.
step
)
{}
};
template
<
typename
T
>
struct
PtrElemStep_
:
public
PtrStep
<
T
>
{
PtrElemStep_
(
const
DevMem2D_
<
T
>&
mem
)
:
PtrStep
<
T
>
(
mem
.
data
,
mem
.
step
)
{
StaticAssert
<
256
%
sizeof
(
T
)
==
0
>::
check
();
PtrStep
<
T
>::
step
/=
PtrStep
<
T
>::
elem_size
;
}
__CV_GPU_HOST_DEVICE__
T
*
ptr
(
int
y
=
0
)
{
return
PtrStep
<
T
>::
data
+
y
*
PtrStep
<
T
>::
step
;
}
__CV_GPU_HOST_DEVICE__
const
T
*
ptr
(
int
y
=
0
)
const
{
return
PtrStep
<
T
>::
data
+
y
*
PtrStep
<
T
>::
step
;
}
__CV_GPU_HOST_DEVICE__
T
&
operator
()(
int
y
,
int
x
)
{
return
ptr
(
y
)[
x
];
}
__CV_GPU_HOST_DEVICE__
const
T
&
operator
()(
int
y
,
int
x
)
const
{
return
ptr
(
y
)[
x
];
}
};
template
<
typename
T
>
struct
PtrStep_
:
public
PtrStep
<
T
>
{
PtrStep_
()
{}
PtrStep_
(
const
DevMem2D_
<
T
>&
mem
)
:
PtrStep
<
T
>
(
mem
.
data
,
mem
.
step
)
{}
};
#undef __CV_GPU_HOST_DEVICE__
typedef
DevMem2D_
<
unsigned
char
>
DevMem2Db
;
typedef
DevMem2Db
DevMem2D
;
typedef
DevMem2D_
<
float
>
DevMem2Df
;
typedef
DevMem2D_
<
int
>
DevMem2Di
;
typedef
PtrStep
<
unsigned
char
>
PtrStepb
;
typedef
PtrStep
<
float
>
PtrStepf
;
typedef
PtrStep
<
int
>
PtrStepi
;
typedef
PtrElemStep_
<
unsigned
char
>
PtrElemStep
;
typedef
PtrElemStep_
<
float
>
PtrElemStepf
;
typedef
PtrElemStep_
<
int
>
PtrElemStepi
;
}
}
#endif
/* __OPENCV_GPU_DevMem2D_HPP__ */
#include "opencv2/core/devmem2d.hpp"
modules/gpu/include/opencv2/gpu/gpu.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/include/opencv2/gpu/gpumat.hpp
浏览文件 @
fcfa7208
...
...
@@ -40,427 +40,4 @@
//
//M*/
#ifndef __OPENCV_GPUMAT_HPP__
#define __OPENCV_GPUMAT_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/gpu/devmem2d.hpp"
namespace
cv
{
namespace
gpu
{
//! Smart pointer for GPU memory with reference counting. Its interface is mostly similar with cv::Mat.
class
CV_EXPORTS
GpuMat
{
public:
//! returns lightweight DevMem2D_ structure for passing to nvcc-compiled code.
// Contains just image size, data ptr and step.
template
<
class
T
>
operator
DevMem2D_
<
T
>
()
const
;
template
<
class
T
>
operator
PtrStep_
<
T
>
()
const
;
template
<
class
T
>
operator
PtrStep
<
T
>
()
const
;
//! builds GpuMat from Mat. Perfom blocking upload to device.
explicit
GpuMat
(
const
Mat
&
m
);
//! pefroms blocking upload data to GpuMat.
void
upload
(
const
Mat
&
m
);
//! downloads data from device to host memory. Blocking calls.
void
download
(
Mat
&
m
)
const
;
operator
Mat
()
const
{
Mat
m
;
download
(
m
);
return
m
;
}
//! default constructor
GpuMat
();
//! constructs GpuMatrix of the specified size and type (_type is CV_8UC1, CV_64FC3, CV_32SC(12) etc.)
GpuMat
(
int
rows
,
int
cols
,
int
type
);
GpuMat
(
Size
size
,
int
type
);
//! constucts GpuMatrix and fills it with the specified value _s.
GpuMat
(
int
rows
,
int
cols
,
int
type
,
const
Scalar
&
s
);
GpuMat
(
Size
size
,
int
type
,
const
Scalar
&
s
);
//! copy constructor
GpuMat
(
const
GpuMat
&
m
);
//! constructor for GpuMatrix headers pointing to user-allocated data
GpuMat
(
int
rows
,
int
cols
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
GpuMat
(
Size
size
,
int
type
,
void
*
data
,
size_t
step
=
Mat
::
AUTO_STEP
);
//! creates a matrix header for a part of the bigger matrix
GpuMat
(
const
GpuMat
&
m
,
const
Range
&
rowRange
,
const
Range
&
colRange
);
GpuMat
(
const
GpuMat
&
m
,
const
Rect
&
roi
);
//! destructor - calls release()
~
GpuMat
();
//! assignment operators
GpuMat
&
operator
=
(
const
GpuMat
&
m
);
//! returns a new GpuMatrix header for the specified row
GpuMat
row
(
int
y
)
const
;
//! returns a new GpuMatrix header for the specified column
GpuMat
col
(
int
x
)
const
;
//! ... for the specified row span
GpuMat
rowRange
(
int
startrow
,
int
endrow
)
const
;
GpuMat
rowRange
(
const
Range
&
r
)
const
;
//! ... for the specified column span
GpuMat
colRange
(
int
startcol
,
int
endcol
)
const
;
GpuMat
colRange
(
const
Range
&
r
)
const
;
//! returns deep copy of the GpuMatrix, i.e. the data is copied
GpuMat
clone
()
const
;
//! copies the GpuMatrix content to "m".
// It calls m.create(this->size(), this->type()).
void
copyTo
(
GpuMat
&
m
)
const
;
//! copies those GpuMatrix elements to "m" that are marked with non-zero mask elements.
void
copyTo
(
GpuMat
&
m
,
const
GpuMat
&
mask
)
const
;
//! converts GpuMatrix to another datatype with optional scalng. See cvConvertScale.
void
convertTo
(
GpuMat
&
m
,
int
rtype
,
double
alpha
=
1
,
double
beta
=
0
)
const
;
void
assignTo
(
GpuMat
&
m
,
int
type
=-
1
)
const
;
//! sets every GpuMatrix element to s
GpuMat
&
operator
=
(
const
Scalar
&
s
);
//! sets some of the GpuMatrix elements to s, according to the mask
GpuMat
&
setTo
(
const
Scalar
&
s
,
const
GpuMat
&
mask
=
GpuMat
());
//! creates alternative GpuMatrix header for the same data, with different
// number of channels and/or different number of rows. see cvReshape.
GpuMat
reshape
(
int
cn
,
int
rows
=
0
)
const
;
//! allocates new GpuMatrix data unless the GpuMatrix already has specified size and type.
// previous data is unreferenced if needed.
void
create
(
int
rows
,
int
cols
,
int
type
);
void
create
(
Size
size
,
int
type
);
//! decreases reference counter;
// deallocate the data when reference counter reaches 0.
void
release
();
//! swaps with other smart pointer
void
swap
(
GpuMat
&
mat
);
//! locates GpuMatrix header within a parent GpuMatrix. See below
void
locateROI
(
Size
&
wholeSize
,
Point
&
ofs
)
const
;
//! moves/resizes the current GpuMatrix ROI inside the parent GpuMatrix.
GpuMat
&
adjustROI
(
int
dtop
,
int
dbottom
,
int
dleft
,
int
dright
);
//! extracts a rectangular sub-GpuMatrix
// (this is a generalized form of row, rowRange etc.)
GpuMat
operator
()(
Range
rowRange
,
Range
colRange
)
const
;
GpuMat
operator
()(
const
Rect
&
roi
)
const
;
//! returns true iff the GpuMatrix data is continuous
// (i.e. when there are no gaps between successive rows).
// similar to CV_IS_GpuMat_CONT(cvGpuMat->type)
bool
isContinuous
()
const
;
//! returns element size in bytes,
// similar to CV_ELEM_SIZE(cvMat->type)
size_t
elemSize
()
const
;
//! returns the size of element channel in bytes.
size_t
elemSize1
()
const
;
//! returns element type, similar to CV_MAT_TYPE(cvMat->type)
int
type
()
const
;
//! returns element type, similar to CV_MAT_DEPTH(cvMat->type)
int
depth
()
const
;
//! returns element type, similar to CV_MAT_CN(cvMat->type)
int
channels
()
const
;
//! returns step/elemSize1()
size_t
step1
()
const
;
//! returns GpuMatrix size:
// width == number of columns, height == number of rows
Size
size
()
const
;
//! returns true if GpuMatrix data is NULL
bool
empty
()
const
;
//! returns pointer to y-th row
uchar
*
ptr
(
int
y
=
0
);
const
uchar
*
ptr
(
int
y
=
0
)
const
;
//! template version of the above method
template
<
typename
_Tp
>
_Tp
*
ptr
(
int
y
=
0
);
template
<
typename
_Tp
>
const
_Tp
*
ptr
(
int
y
=
0
)
const
;
/*! includes several bit-fields:
- the magic signature
- continuity flag
- depth
- number of channels
*/
int
flags
;
//! the number of rows and columns
int
rows
,
cols
;
//! a distance between successive rows in bytes; includes the gap if any
size_t
step
;
//! pointer to the data
uchar
*
data
;
//! pointer to the reference counter;
// when GpuMatrix points to user-allocated data, the pointer is NULL
int
*
refcount
;
//! helper fields used in locateROI and adjustROI
uchar
*
datastart
;
uchar
*
dataend
;
};
//! Creates continuous GPU matrix
CV_EXPORTS
void
createContinuous
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
createContinuous
(
int
rows
,
int
cols
,
int
type
);
CV_EXPORTS
void
createContinuous
(
Size
size
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
GpuMat
createContinuous
(
Size
size
,
int
type
);
//! Ensures that size of the given matrix is not less than (rows, cols) size
//! and matrix type is match specified one too
CV_EXPORTS
void
ensureSizeIsEnough
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
);
CV_EXPORTS
void
ensureSizeIsEnough
(
Size
size
,
int
type
,
GpuMat
&
m
);
////////////////////////////////////////////////////////////////////////
template
<
class
T
>
inline
GpuMat
::
operator
DevMem2D_
<
T
>
()
const
{
return
DevMem2D_
<
T
>
(
rows
,
cols
,
(
T
*
)
data
,
step
);
}
template
<
class
T
>
inline
GpuMat
::
operator
PtrStep_
<
T
>
()
const
{
return
PtrStep_
<
T
>
(
static_cast
<
DevMem2D_
<
T
>
>
(
*
this
));
}
template
<
class
T
>
inline
GpuMat
::
operator
PtrStep
<
T
>
()
const
{
return
PtrStep
<
T
>
((
T
*
)
data
,
step
);
}
inline
GpuMat
::
GpuMat
()
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
}
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
create
(
rows_
,
cols_
,
type_
);
}
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
inline
GpuMat
::
GpuMat
(
int
rows_
,
int
cols_
,
int
type_
,
const
Scalar
&
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
rows_
>
0
&&
cols_
>
0
)
{
create
(
rows_
,
cols_
,
type_
);
setTo
(
s_
);
}
}
inline
GpuMat
::
GpuMat
(
Size
size_
,
int
type_
,
const
Scalar
&
s_
)
:
flags
(
0
),
rows
(
0
),
cols
(
0
),
step
(
0
),
data
(
0
),
refcount
(
0
),
datastart
(
0
),
dataend
(
0
)
{
if
(
size_
.
height
>
0
&&
size_
.
width
>
0
)
{
create
(
size_
.
height
,
size_
.
width
,
type_
);
setTo
(
s_
);
}
}
inline
GpuMat
::~
GpuMat
()
{
release
();
}
inline
GpuMat
GpuMat
::
clone
()
const
{
GpuMat
m
;
copyTo
(
m
);
return
m
;
}
inline
void
GpuMat
::
assignTo
(
GpuMat
&
m
,
int
type
)
const
{
if
(
type
<
0
)
m
=
*
this
;
else
convertTo
(
m
,
type
);
}
inline
size_t
GpuMat
::
step1
()
const
{
return
step
/
elemSize1
();
}
inline
bool
GpuMat
::
empty
()
const
{
return
data
==
0
;
}
template
<
typename
_Tp
>
inline
_Tp
*
GpuMat
::
ptr
(
int
y
)
{
return
(
_Tp
*
)
ptr
(
y
);
}
template
<
typename
_Tp
>
inline
const
_Tp
*
GpuMat
::
ptr
(
int
y
)
const
{
return
(
const
_Tp
*
)
ptr
(
y
);
}
inline
void
swap
(
GpuMat
&
a
,
GpuMat
&
b
)
{
a
.
swap
(
b
);
}
inline
GpuMat
GpuMat
::
row
(
int
y
)
const
{
return
GpuMat
(
*
this
,
Range
(
y
,
y
+
1
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
col
(
int
x
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
x
,
x
+
1
));
}
inline
GpuMat
GpuMat
::
rowRange
(
int
startrow
,
int
endrow
)
const
{
return
GpuMat
(
*
this
,
Range
(
startrow
,
endrow
),
Range
::
all
());
}
inline
GpuMat
GpuMat
::
rowRange
(
const
Range
&
r
)
const
{
return
GpuMat
(
*
this
,
r
,
Range
::
all
());
}
inline
GpuMat
GpuMat
::
colRange
(
int
startcol
,
int
endcol
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
Range
(
startcol
,
endcol
));
}
inline
GpuMat
GpuMat
::
colRange
(
const
Range
&
r
)
const
{
return
GpuMat
(
*
this
,
Range
::
all
(),
r
);
}
inline
void
GpuMat
::
create
(
Size
size_
,
int
type_
)
{
create
(
size_
.
height
,
size_
.
width
,
type_
);
}
inline
GpuMat
GpuMat
::
operator
()(
Range
rowRange
,
Range
colRange
)
const
{
return
GpuMat
(
*
this
,
rowRange
,
colRange
);
}
inline
GpuMat
GpuMat
::
operator
()(
const
Rect
&
roi
)
const
{
return
GpuMat
(
*
this
,
roi
);
}
inline
bool
GpuMat
::
isContinuous
()
const
{
return
(
flags
&
Mat
::
CONTINUOUS_FLAG
)
!=
0
;
}
inline
size_t
GpuMat
::
elemSize
()
const
{
return
CV_ELEM_SIZE
(
flags
);
}
inline
size_t
GpuMat
::
elemSize1
()
const
{
return
CV_ELEM_SIZE1
(
flags
);
}
inline
int
GpuMat
::
type
()
const
{
return
CV_MAT_TYPE
(
flags
);
}
inline
int
GpuMat
::
depth
()
const
{
return
CV_MAT_DEPTH
(
flags
);
}
inline
int
GpuMat
::
channels
()
const
{
return
CV_MAT_CN
(
flags
);
}
inline
Size
GpuMat
::
size
()
const
{
return
Size
(
cols
,
rows
);
}
inline
unsigned
char
*
GpuMat
::
ptr
(
int
y
)
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
const
unsigned
char
*
GpuMat
::
ptr
(
int
y
)
const
{
CV_DbgAssert
((
unsigned
)
y
<
(
unsigned
)
rows
);
return
data
+
step
*
y
;
}
inline
GpuMat
&
GpuMat
::
operator
=
(
const
Scalar
&
s
)
{
setTo
(
s
);
return
*
this
;
}
inline
GpuMat
createContinuous
(
int
rows
,
int
cols
,
int
type
)
{
GpuMat
m
;
createContinuous
(
rows
,
cols
,
type
,
m
);
return
m
;
}
inline
void
createContinuous
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
createContinuous
(
size
.
height
,
size
.
width
,
type
,
m
);
}
inline
GpuMat
createContinuous
(
Size
size
,
int
type
)
{
GpuMat
m
;
createContinuous
(
size
,
type
,
m
);
return
m
;
}
inline
void
ensureSizeIsEnough
(
Size
size
,
int
type
,
GpuMat
&
m
)
{
ensureSizeIsEnough
(
size
.
height
,
size
.
width
,
type
,
m
);
}
inline
void
createContinuous
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
)
{
int
area
=
rows
*
cols
;
if
(
!
m
.
isContinuous
()
||
m
.
type
()
!=
type
||
m
.
size
().
area
()
!=
area
)
m
.
create
(
1
,
area
,
type
);
m
=
m
.
reshape
(
0
,
rows
);
}
inline
void
ensureSizeIsEnough
(
int
rows
,
int
cols
,
int
type
,
GpuMat
&
m
)
{
if
(
m
.
type
()
==
type
&&
m
.
rows
>=
rows
&&
m
.
cols
>=
cols
)
m
=
m
(
Rect
(
0
,
0
,
cols
,
rows
));
else
m
.
create
(
rows
,
cols
,
type
);
}
}}
#endif // __OPENCV_GPUMAT_HPP__
#include "opencv2/core/gpumat.hpp"
modules/gpu/perf/perf_arithm.cpp
浏览文件 @
fcfa7208
...
...
@@ -24,7 +24,7 @@ PERF_TEST_P(DevInfo_Size_MatType, transpose, testing::Combine(testing::ValuesIn(
transpose
(
src
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -55,7 +55,7 @@ PERF_TEST_P(DevInfo_Size_MatType_FlipCode, flip, testing::Combine(testing::Value
flip
(
src
,
dst
,
flipCode
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -85,7 +85,7 @@ PERF_TEST_P(DevInfo_Size_MatType, LUT, testing::Combine(testing::ValuesIn(device
LUT
(
src
,
lut
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -115,8 +115,8 @@ PERF_TEST_P(DevInfo_Size, cartToPolar, testing::Combine(testing::ValuesIn(device
cartToPolar
(
x
,
y
,
magnitude
,
angle
);
}
Mat
magnitude_host
=
magnitude
;
Mat
angle_host
=
angle
;
Mat
magnitude_host
(
magnitude
)
;
Mat
angle_host
(
angle
)
;
SANITY_CHECK
(
magnitude_host
);
SANITY_CHECK
(
angle_host
);
...
...
@@ -147,8 +147,8 @@ PERF_TEST_P(DevInfo_Size, polarToCart, testing::Combine(testing::ValuesIn(device
polarToCart
(
magnitude
,
angle
,
x
,
y
);
}
Mat
x_host
=
x
;
Mat
y_host
=
angle
;
Mat
x_host
(
x
)
;
Mat
y_host
(
y
)
;
SANITY_CHECK
(
x_host
);
SANITY_CHECK
(
y_host
);
...
...
@@ -180,7 +180,7 @@ PERF_TEST_P(DevInfo_Size_MatType, addMat, testing::Combine(testing::ValuesIn(dev
add
(
a
,
b
,
c
);
}
Mat
c_host
=
c
;
Mat
c_host
(
c
)
;
SANITY_CHECK
(
c_host
);
}
...
...
@@ -210,7 +210,7 @@ PERF_TEST_P(DevInfo_Size_MatType, addScalar, testing::Combine(testing::ValuesIn(
add
(
a
,
b
,
c
);
}
Mat
c_host
=
c
;
Mat
c_host
(
c
)
;
SANITY_CHECK
(
c_host
);
}
...
...
@@ -241,7 +241,7 @@ PERF_TEST_P(DevInfo_Size_MatType, subtractMat, testing::Combine(testing::ValuesI
subtract
(
a
,
b
,
c
);
}
Mat
c_host
=
c
;
Mat
c_host
(
c
)
;
SANITY_CHECK
(
c_host
);
}
...
...
@@ -270,7 +270,7 @@ PERF_TEST_P(DevInfo_Size, multiplyMat, testing::Combine(testing::ValuesIn(device
multiply
(
a
,
b
,
c
);
}
Mat
c_host
=
c
;
Mat
c_host
(
c
)
;
SANITY_CHECK
(
c_host
);
}
...
...
@@ -300,7 +300,7 @@ PERF_TEST_P(DevInfo_Size_MatType, multiplyScalar, testing::Combine(testing::Valu
multiply
(
a
,
b
,
c
);
}
Mat
c_host
=
c
;
Mat
c_host
(
c
)
;
SANITY_CHECK
(
c_host
);
}
...
...
@@ -327,7 +327,7 @@ PERF_TEST_P(DevInfo_Size, exp, testing::Combine(testing::ValuesIn(devices()),
exp
(
a
,
b
);
}
Mat
b_host
=
b
;
Mat
b_host
(
b
)
;
SANITY_CHECK
(
b_host
);
}
...
...
@@ -356,7 +356,7 @@ PERF_TEST_P(DevInfo_Size_MatType, pow, testing::Combine(testing::ValuesIn(device
pow
(
src
,
2.0
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -389,7 +389,7 @@ PERF_TEST_P(DevInfo_Size_MatType_CmpOp, compare, testing::Combine(testing::Value
compare
(
src1
,
src2
,
dst
,
cmpop
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -418,7 +418,7 @@ PERF_TEST_P(DevInfo_Size_MatType, bitwise_not, testing::Combine(testing::ValuesI
bitwise_not
(
src
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -449,7 +449,7 @@ PERF_TEST_P(DevInfo_Size_MatType, bitwise_and, testing::Combine(testing::ValuesI
bitwise_and
(
src1
,
src2
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -480,7 +480,7 @@ PERF_TEST_P(DevInfo_Size_MatType, min, testing::Combine(testing::ValuesIn(device
min
(
src1
,
src2
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -712,7 +712,7 @@ PERF_TEST_P(DevInfo_Size_MatType, addWeighted, testing::Combine(testing::ValuesI
addWeighted
(
src1
,
0.5
,
src2
,
0.5
,
0.0
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -743,7 +743,7 @@ PERF_TEST_P(DevInfo_Size_MatType_FlipCode, reduce, testing::Combine(testing::Val
reduce
(
src
,
dst
,
dim
,
CV_REDUCE_MIN
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -774,7 +774,7 @@ PERF_TEST_P(DevInfo_Size, gemm, testing::Combine(testing::ValuesIn(devices()),
gemm
(
src1
,
src2
,
1.0
,
src3
,
1.0
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
modules/gpu/perf/perf_calib3d.cpp
浏览文件 @
fcfa7208
...
...
@@ -20,7 +20,7 @@ PERF_TEST_P(DevInfo, transformPoints, testing::ValuesIn(devices()))
transformPoints
(
src
,
Mat
::
ones
(
1
,
3
,
CV_32FC1
),
Mat
::
ones
(
1
,
3
,
CV_32FC1
),
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -45,7 +45,7 @@ PERF_TEST_P(DevInfo, projectPoints, testing::ValuesIn(devices()))
projectPoints
(
src
,
Mat
::
ones
(
1
,
3
,
CV_32FC1
),
Mat
::
ones
(
1
,
3
,
CV_32FC1
),
Mat
::
ones
(
3
,
3
,
CV_32FC1
),
Mat
(),
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
modules/gpu/perf/perf_filters.cpp
浏览文件 @
fcfa7208
...
...
@@ -28,7 +28,7 @@ PERF_TEST_P(DevInfo_Size_MatType_KernelSize, boxFilter, testing::Combine(testing
filter
->
apply
(
src
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -63,7 +63,7 @@ PERF_TEST_P(DevInfo_Size_MatType_MorphOp_KernelSize, morphologyFilter, testing::
filter
->
apply
(
src
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -96,7 +96,7 @@ PERF_TEST_P(DevInfo_Size_MatType_KernelSize, linearFilter, testing::Combine(test
filter
->
apply
(
src
,
dst
);
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
...
...
@@ -130,7 +130,7 @@ PERF_TEST_P(DevInfo_Size_MatType_KernelSize, separableLinearFilter, testing::Com
filter
->
apply
(
src
,
dst
,
Rect
(
0
,
0
,
src
.
cols
,
src
.
rows
));
}
Mat
dst_host
=
dst
;
Mat
dst_host
(
dst
)
;
SANITY_CHECK
(
dst_host
);
}
modules/gpu/perf/perf_imgproc.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/perf/perf_matop.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/arithm.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/bilateral_filter.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/blend.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/brute_force_matcher.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/calib3d.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cascadeclassifier.cpp
浏览文件 @
fcfa7208
...
...
@@ -46,7 +46,6 @@ using namespace cv;
using
namespace
cv
::
gpu
;
using
namespace
std
;
#if !defined (HAVE_CUDA)
cv
::
gpu
::
CascadeClassifier_GPU
::
CascadeClassifier_GPU
()
{
throw_nogpu
();
}
...
...
modules/gpu/src/color.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/bf_knnmatch.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/bf_match.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/bf_radius_match.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/bilateral_filter.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/blend.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/calib3d.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/canny.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/color.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/column_filter.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/copy_make_border.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/element_operations.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/hist.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/hog.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/imgproc.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/internal_shared.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/match_template.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/mathfunc.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/matrix_operations.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/matrix_reductions.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/pyr_down.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/pyr_up.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/remap.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/resize.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/row_filter.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/safe_call.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/split_merge.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/stereobm.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/stereobp.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/stereocsbp.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cuda/surf.cu
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/cudastream.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/element_operations.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/filtering.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/hog.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/imgproc.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/initialization.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/match_template.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/matrix_operations.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/matrix_reductions.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/mssegmentation.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/border_interpolate.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/color.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/datamov_utils.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/detail/color_detail.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/detail/transform_detail.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/detail/type_traits_detail.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/detail/utility_detail.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/detail/vec_distance_detail.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/dynamic_smem.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/emulation.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/filters.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/funcattrib.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/functional.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/limits.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/saturate_cast.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/transform.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/type_traits.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/utility.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/vec_distance.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/vec_math.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/vec_traits.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/warp.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/opencv2/gpu/device/warp_reduce.hpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/split_merge.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/stereobm.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/stereobp.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/stereocsbp.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/src/surf.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/test/test_filters.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/test/test_hog.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
modules/gpu/test/test_imgproc.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
samples/gpu/stereo_match.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
samples/gpu/surf_keypoint_matcher.cpp
浏览文件 @
fcfa7208
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录