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
af806bc8
Commit
af806bc8
authored
May 19, 2015
by
Vladimir Dudnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replaced macros with template func
parent
f0197006
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
69 deletions
+86
-69
d3d10_interop.cpp
samples/directx/d3d10_interop.cpp
+5
-1
d3d11_interop.cpp
samples/directx/d3d11_interop.cpp
+5
-1
d3d9_interop.cpp
samples/directx/d3d9_interop.cpp
+5
-1
d3d9ex_interop.cpp
samples/directx/d3d9ex_interop.cpp
+5
-1
d3dsample.hpp
samples/directx/d3dsample.hpp
+66
-65
No files found.
samples/directx/d3d10_interop.cpp
View file @
af806bc8
...
@@ -296,4 +296,8 @@ private:
...
@@ -296,4 +296,8 @@ private:
// main func
// 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
View file @
af806bc8
...
@@ -302,4 +302,8 @@ private:
...
@@ -302,4 +302,8 @@ private:
// main func
// 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
View file @
af806bc8
...
@@ -294,4 +294,8 @@ private:
...
@@ -294,4 +294,8 @@ private:
// main func
// 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
View file @
af806bc8
...
@@ -295,4 +295,8 @@ private:
...
@@ -295,4 +295,8 @@ private:
// main func
// 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
View file @
af806bc8
...
@@ -113,73 +113,74 @@ protected:
...
@@ -113,73 +113,74 @@ protected:
};
};
#define ENTRY_POINT(type, title) \
static
void
help
()
static void help() \
{
{ \
printf
(
printf( \
"
\n
Sample demonstrating interoperability of DirectX and OpenCL with OpenCV.
\n
"
"\nSample demonstrating interoperability of DirectX and OpenCL with OpenCV.\n" \
"Hot keys:
\n
"
"Hot keys: \n" \
" 0 - no processing
\n
"
" 0 - no processing\n" \
" 1 - blur DX surface on CPU through OpenCV
\n
"
" 1 - blur DX surface on CPU through OpenCV\n" \
" 2 - blur DX surface on GPU through OpenCV using OpenCL
\n
"
" 2 - blur DX surface on GPU through OpenCV using OpenCL\n" \
" ESC - exit
\n\n
"
);
" ESC - exit\n\n"); \
}
} \
\
static const char* keys = \
static
const
char
*
keys
=
{ \
{
"{c camera | true | use camera or not}" \
"{c camera | true | use camera or not}"
"{f file | | movie file name }" \
"{f file | | movie file name }"
"{h help | false | print help info }" \
"{h help | false | print help info }"
}; \
};
\
\
int main(int argc, char** argv) \
template
<
typename
TApp
>
{ \
int
d3d_app
(
int
argc
,
char
**
argv
,
std
::
string
&
title
)
{
cv
::
CommandLineParser
parser
(
argc
,
argv
,
keys
);
\
cv
::
CommandLineParser
parser
(
argc
,
argv
,
keys
);
\
bool
useCamera
=
parser
.
has
(
"camera"
);
\
bool
useCamera
=
parser
.
has
(
"camera"
);
\
string
file
=
parser
.
get
<
string
>
(
"file"
);
\
string
file
=
parser
.
get
<
string
>
(
"file"
);
\
bool
showHelp
=
parser
.
get
<
bool
>
(
"help"
);
\
bool
showHelp
=
parser
.
get
<
bool
>
(
"help"
);
\
\
if (showHelp)
\
if
(
showHelp
)
help();
\
help
();
\
parser.printMessage();
\
parser
.
printMessage
();
\
cv::VideoCapture cap;
\
cv
::
VideoCapture
cap
;
\
if (useCamera)
\
if
(
useCamera
)
cap.open(0);
\
cap
.
open
(
0
);
else
\
else
cap.open(file.c_str());
\
cap
.
open
(
file
.
c_str
());
\
if (!cap.isOpened())
\
if
(
!
cap
.
isOpened
())
{
\
{
printf("can not open camera or video file\n");
\
printf
(
"can not open camera or video file
\n
"
);
return -1;
\
return
-
1
;
}
\
}
\
int width = (int)cap.get(CAP_PROP_FRAME_WIDTH);
\
int
width
=
(
int
)
cap
.
get
(
CAP_PROP_FRAME_WIDTH
);
int height = (int)cap.get(CAP_PROP_FRAME_HEIGHT);
\
int
height
=
(
int
)
cap
.
get
(
CAP_PROP_FRAME_HEIGHT
);
\
std::string wndname = title;
\
std
::
string
wndname
=
title
;
\
type app(width, height, wndname, cap); \
TApp
app
(
width
,
height
,
wndname
,
cap
);
\
try
\
try
{
\
{
app.create();
\
app
.
create
();
return app.run();
\
return
app
.
run
();
}
\
}
\
catch (cv::Exception& e)
\
catch
(
cv
::
Exception
&
e
)
{
\
{
std::cerr << "Exception: " << e.what() << std::endl;
\
std
::
cerr
<<
"Exception: "
<<
e
.
what
()
<<
std
::
endl
;
return 10;
\
return
10
;
}
\
}
\
catch (...)
\
catch
(...)
{
\
{
std::cerr << "FATAL ERROR: Unknown exception" << std::endl;
\
std
::
cerr
<<
"FATAL ERROR: Unknown exception"
<<
std
::
endl
;
return 11;
\
return
11
;
}
\
}
}
}
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