Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Opencv
提交
af806bc8
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,发现更多精彩内容 >>
提交
af806bc8
编写于
5月 19, 2015
作者:
V
Vladimir Dudnik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replaced macros with template func
上级
f0197006
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
86 addition
and
69 deletion
+86
-69
samples/directx/d3d10_interop.cpp
samples/directx/d3d10_interop.cpp
+5
-1
samples/directx/d3d11_interop.cpp
samples/directx/d3d11_interop.cpp
+5
-1
samples/directx/d3d9_interop.cpp
samples/directx/d3d9_interop.cpp
+5
-1
samples/directx/d3d9ex_interop.cpp
samples/directx/d3d9ex_interop.cpp
+5
-1
samples/directx/d3dsample.hpp
samples/directx/d3dsample.hpp
+66
-65
未找到文件。
samples/directx/d3d10_interop.cpp
浏览文件 @
af806bc8
...
...
@@ -296,4 +296,8 @@ private:
// main func
ENTRY_POINT
(
D3D10WinApp
,
"D3D10 interop sample"
);
int
main
(
int
argc
,
char
**
argv
)
{
std
::
string
title
=
"D3D10 interop sample"
;
return
d3d_app
<
D3D10WinApp
>
(
argc
,
argv
,
title
);
}
samples/directx/d3d11_interop.cpp
浏览文件 @
af806bc8
...
...
@@ -302,4 +302,8 @@ private:
// main func
ENTRY_POINT
(
D3D11WinApp
,
"D3D11 interop sample"
);
int
main
(
int
argc
,
char
**
argv
)
{
std
::
string
title
=
"D3D11 interop sample"
;
return
d3d_app
<
D3D11WinApp
>
(
argc
,
argv
,
title
);
}
samples/directx/d3d9_interop.cpp
浏览文件 @
af806bc8
...
...
@@ -294,4 +294,8 @@ private:
// main func
ENTRY_POINT
(
D3D9WinApp
,
"D3D9 interop sample"
);
int
main
(
int
argc
,
char
**
argv
)
{
std
::
string
title
=
"D3D9 interop sample"
;
return
d3d_app
<
D3D9WinApp
>
(
argc
,
argv
,
title
);
}
samples/directx/d3d9ex_interop.cpp
浏览文件 @
af806bc8
...
...
@@ -295,4 +295,8 @@ private:
// main func
ENTRY_POINT
(
D3D9ExWinApp
,
"D3D9Ex interop sample"
);
int
main
(
int
argc
,
char
**
argv
)
{
std
::
string
title
=
"D3D9Ex interop sample"
;
return
d3d_app
<
D3D9ExWinApp
>
(
argc
,
argv
,
title
);
}
samples/directx/d3dsample.hpp
浏览文件 @
af806bc8
...
...
@@ -113,73 +113,74 @@ protected:
};
#define ENTRY_POINT(type, title) \
static void help() \
{ \
printf( \
"\nSample demonstrating interoperability of DirectX and OpenCL with OpenCV.\n" \
"Hot keys: \n" \
" 0 - no processing\n" \
" 1 - blur DX surface on CPU through OpenCV\n" \
" 2 - blur DX surface on GPU through OpenCV using OpenCL\n" \
" ESC - exit\n\n"); \
} \
\
static const char* keys = \
{ \
"{c camera | true | use camera or not}" \
"{f file | | movie file name }" \
"{h help | false | print help info }" \
}; \
\
\
int main(int argc, char** argv) \
{ \
static
void
help
()
{
printf
(
"
\n
Sample demonstrating interoperability of DirectX and OpenCL with OpenCV.
\n
"
"Hot keys:
\n
"
" 0 - no processing
\n
"
" 1 - blur DX surface on CPU through OpenCV
\n
"
" 2 - blur DX surface on GPU through OpenCV using OpenCL
\n
"
" ESC - exit
\n\n
"
);
}
static
const
char
*
keys
=
{
"{c camera | true | use camera or not}"
"{f file | | movie file name }"
"{h help | false | print help info }"
};
template
<
typename
TApp
>
int
d3d_app
(
int
argc
,
char
**
argv
,
std
::
string
&
title
)
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
keys
);
\
bool
useCamera
=
parser
.
has
(
"camera"
);
\
string
file
=
parser
.
get
<
string
>
(
"file"
);
\
bool
showHelp
=
parser
.
get
<
bool
>
(
"help"
);
\
\
if (showHelp)
\
help();
\
\
parser.printMessage();
\
\
cv::VideoCapture cap;
\
\
if (useCamera)
\
cap.open(0);
\
else
\
cap.open(file.c_str());
\
\
if (!cap.isOpened())
\
{
\
printf("can not open camera or video file\n");
\
return -1;
\
}
\
\
int width = (int)cap.get(CAP_PROP_FRAME_WIDTH);
\
int height = (int)cap.get(CAP_PROP_FRAME_HEIGHT);
\
\
std::string wndname = title;
\
\
type app(width, height, wndname, cap); \
\
try
\
{
\
app.create();
\
return app.run();
\
}
\
\
catch (cv::Exception& e)
\
{
\
std::cerr << "Exception: " << e.what() << std::endl;
\
return 10;
\
}
\
\
catch (...)
\
{
\
std::cerr << "FATAL ERROR: Unknown exception" << std::endl;
\
return 11;
\
}
\
if
(
showHelp
)
help
();
parser
.
printMessage
();
cv
::
VideoCapture
cap
;
if
(
useCamera
)
cap
.
open
(
0
);
else
cap
.
open
(
file
.
c_str
());
if
(
!
cap
.
isOpened
())
{
printf
(
"can not open camera or video file
\n
"
);
return
-
1
;
}
int
width
=
(
int
)
cap
.
get
(
CAP_PROP_FRAME_WIDTH
);
int
height
=
(
int
)
cap
.
get
(
CAP_PROP_FRAME_HEIGHT
);
std
::
string
wndname
=
title
;
TApp
app
(
width
,
height
,
wndname
,
cap
);
try
{
app
.
create
();
return
app
.
run
();
}
catch
(
cv
::
Exception
&
e
)
{
std
::
cerr
<<
"Exception: "
<<
e
.
what
()
<<
std
::
endl
;
return
10
;
}
catch
(...)
{
std
::
cerr
<<
"FATAL ERROR: Unknown exception"
<<
std
::
endl
;
return
11
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录