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
336e000e
Commit
336e000e
authored
Oct 03, 2011
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optical flow sample compilation under ubuntu
parent
74561c5b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
opticalflow_nvidia_api.cpp
samples/gpu/opticalflow_nvidia_api.cpp
+14
-13
No files found.
samples/gpu/opticalflow_nvidia_api.cpp
View file @
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
));
...
...
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