Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
336e000e
O
Opencv
项目概览
Greenplum
/
Opencv
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
336e000e
编写于
10月 03, 2011
作者:
A
Anatoly Baksheev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optical flow sample compilation under ubuntu
上级
74561c5b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
13 deletion
+14
-13
samples/gpu/opticalflow_nvidia_api.cpp
samples/gpu/opticalflow_nvidia_api.cpp
+14
-13
未找到文件。
samples/gpu/opticalflow_nvidia_api.cpp
浏览文件 @
336e000e
...
...
@@ -27,7 +27,8 @@ int main( int argc, const char** argv )
}
#else
using
std
::
tr1
::
shared_ptr
;
//using std::tr1::shared_ptr;
using
cv
::
Ptr
;
#define PARAM_INPUT "--input"
#define PARAM_SCALE "--scale"
...
...
@@ -39,8 +40,8 @@ using std::tr1::shared_ptr;
#define PARAM_TIME_STEP "--time-step"
#define PARAM_HELP "--help"
shared_p
tr
<
INCVMemAllocator
>
g_pGPUMemAllocator
;
shared_p
tr
<
INCVMemAllocator
>
g_pHostMemAllocator
;
P
tr
<
INCVMemAllocator
>
g_pGPUMemAllocator
;
P
tr
<
INCVMemAllocator
>
g_pHostMemAllocator
;
class
RgbToMonochrome
{
...
...
@@ -83,9 +84,9 @@ public:
};
template
<
class
T
>
NCVStatus
CopyData
(
IplImage
*
image
,
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
&
dst
)
NCVStatus
CopyData
(
IplImage
*
image
,
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
&
dst
)
{
dst
=
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
(
new
NCVMatrixAlloc
<
Ncv32f
>
(
*
g_pHostMemAllocator
,
image
->
width
,
image
->
height
));
dst
=
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
(
new
NCVMatrixAlloc
<
Ncv32f
>
(
*
g_pHostMemAllocator
,
image
->
width
,
image
->
height
));
ncvAssertReturn
(
dst
->
isMemAllocated
(),
NCV_ALLOCATOR_BAD_ALLOC
);
unsigned
char
*
row
=
reinterpret_cast
<
unsigned
char
*>
(
image
->
imageData
);
...
...
@@ -137,8 +138,8 @@ NCVStatus LoadImages (const char *frame0Name,
const
char
*
frame1Name
,
int
&
width
,
int
&
height
,
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
&
src
,
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
&
dst
,
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
&
src
,
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
&
dst
,
IplImage
*&
firstFrame
,
IplImage
*&
lastFrame
)
{
...
...
@@ -394,16 +395,16 @@ int main(int argc, char **argv)
std
::
cout
<<
"Using GPU: "
<<
devId
<<
"("
<<
devProp
.
name
<<
"), arch="
<<
devProp
.
major
<<
"."
<<
devProp
.
minor
<<
std
::
endl
;
g_pGPUMemAllocator
=
shared_p
tr
<
INCVMemAllocator
>
(
new
NCVMemNativeAllocator
(
NCVMemoryTypeDevice
,
devProp
.
textureAlignment
));
g_pGPUMemAllocator
=
P
tr
<
INCVMemAllocator
>
(
new
NCVMemNativeAllocator
(
NCVMemoryTypeDevice
,
devProp
.
textureAlignment
));
ncvAssertPrintReturn
(
g_pGPUMemAllocator
->
isInitialized
(),
"Device memory allocator isn't initialized"
,
-
1
);
g_pHostMemAllocator
=
shared_p
tr
<
INCVMemAllocator
>
(
new
NCVMemNativeAllocator
(
NCVMemoryTypeHostPageable
,
devProp
.
textureAlignment
));
g_pHostMemAllocator
=
P
tr
<
INCVMemAllocator
>
(
new
NCVMemNativeAllocator
(
NCVMemoryTypeHostPageable
,
devProp
.
textureAlignment
));
ncvAssertPrintReturn
(
g_pHostMemAllocator
->
isInitialized
(),
"Host memory allocator isn't initialized"
,
-
1
);
int
width
,
height
;
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
src_host
;
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
dst_host
;
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
src_host
;
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
dst_host
;
IplImage
*
firstFrame
,
*
lastFrame
;
if
(
frame0Name
!=
0
&&
frame1Name
!=
0
)
...
...
@@ -415,10 +416,10 @@ int main(int argc, char **argv)
ncvAssertReturnNcvStat
(
LoadImages
(
"frame10.bmp"
,
"frame11.bmp"
,
width
,
height
,
src_host
,
dst_host
,
firstFrame
,
lastFrame
));
}
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
src
(
new
NCVMatrixAlloc
<
Ncv32f
>
(
*
g_pGPUMemAllocator
,
src_host
->
width
(),
src_host
->
height
()));
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
src
(
new
NCVMatrixAlloc
<
Ncv32f
>
(
*
g_pGPUMemAllocator
,
src_host
->
width
(),
src_host
->
height
()));
ncvAssertReturn
(
src
->
isMemAllocated
(),
-
1
);
shared_p
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
dst
(
new
NCVMatrixAlloc
<
Ncv32f
>
(
*
g_pGPUMemAllocator
,
src_host
->
width
(),
src_host
->
height
()));
P
tr
<
NCVMatrixAlloc
<
Ncv32f
>>
dst
(
new
NCVMatrixAlloc
<
Ncv32f
>
(
*
g_pGPUMemAllocator
,
src_host
->
width
(),
src_host
->
height
()));
ncvAssertReturn
(
dst
->
isMemAllocated
(),
-
1
);
ncvAssertReturnNcvStat
(
src_host
->
copySolid
(
*
src
,
0
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录