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
2e363386
Commit
2e363386
authored
Sep 20, 2012
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove warnings of some functions in ocl module
parent
82b30963
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
26 deletions
+24
-26
canny.cpp
modules/ocl/src/canny.cpp
+14
-12
imgproc_canny.cl
modules/ocl/src/kernels/imgproc_canny.cl
+1
-7
match_template.cpp
modules/ocl/src/match_template.cpp
+9
-6
surf.cpp
modules/ocl/src/surf.cpp
+0
-0
test_match_template.cpp
modules/ocl/test/test_match_template.cpp
+0
-1
No files found.
modules/ocl/src/canny.cpp
View file @
2e363386
...
...
@@ -75,13 +75,13 @@ cv::ocl::CannyBuf::CannyBuf(const oclMat& dx_, const oclMat& dy_) : dx(dx_), dy(
void
cv
::
ocl
::
CannyBuf
::
create
(
const
Size
&
image_size
,
int
apperture_size
)
{
dx
.
create
(
image_size
,
CV_32SC1
);
dy
.
create
(
image_size
,
CV_32SC1
);
ensureSizeIsEnough
(
image_size
,
CV_32SC1
,
dx
);
ensureSizeIsEnough
(
image_size
,
CV_32SC1
,
dy
);
if
(
apperture_size
==
3
)
{
dx_buf
.
create
(
image_size
,
CV_32SC1
);
dy_buf
.
create
(
image_size
,
CV_32SC1
);
ensureSizeIsEnough
(
image_size
,
CV_32SC1
,
dx_buf
);
ensureSizeIsEnough
(
image_size
,
CV_32SC1
,
dy_buf
);
}
else
if
(
apperture_size
>
0
)
{
...
...
@@ -95,18 +95,18 @@ void cv::ocl::CannyBuf::create(const Size& image_size, int apperture_size)
filterDY
=
createDerivFilter_GPU
(
CV_8U
,
CV_32S
,
0
,
1
,
apperture_size
,
BORDER_REPLICATE
);
}
}
e
dgeBuf
.
create
(
image_size
.
height
+
2
,
image_size
.
width
+
2
,
CV_32FC1
);
e
nsureSizeIsEnough
(
image_size
.
height
+
2
,
image_size
.
width
+
2
,
CV_32FC1
,
edgeBuf
);
trackBuf1
.
create
(
1
,
image_size
.
width
*
image_size
.
height
,
CV_16UC2
);
trackBuf2
.
create
(
1
,
image_size
.
width
*
image_size
.
height
,
CV_16UC
2
);
ensureSizeIsEnough
(
1
,
image_size
.
width
*
image_size
.
height
,
CV_16UC2
,
trackBuf1
);
ensureSizeIsEnough
(
1
,
image_size
.
width
*
image_size
.
height
,
CV_16UC2
,
trackBuf
2
);
float
counter_f
[
1
]
=
{
0
};
int
counter_i
[
1
]
=
{
0
};
int
err
=
0
;
if
(
counter
)
{
openCLFree
(
counter
);
}
counter
=
clCreateBuffer
(
Context
::
getContext
()
->
impl
->
clContext
,
CL_MEM_COPY_HOST_PTR
,
sizeof
(
float
),
counter_f
,
&
err
);
counter
=
clCreateBuffer
(
Context
::
getContext
()
->
impl
->
clContext
,
CL_MEM_COPY_HOST_PTR
,
sizeof
(
int
),
counter_i
,
&
err
);
openCLSafeCall
(
err
);
}
...
...
@@ -357,16 +357,18 @@ void canny::edgesHysteresisLocal_gpu(oclMat& map, oclMat& st1, void * counter, i
void
canny
::
edgesHysteresisGlobal_gpu
(
oclMat
&
map
,
oclMat
&
st1
,
oclMat
&
st2
,
void
*
counter
,
int
rows
,
int
cols
)
{
unsigned
int
count
;
openCLSafeCall
(
clEnqueueReadBuffer
(
Context
::
getContext
()
->
impl
->
clCmdQueue
,
(
cl_mem
)
counter
,
1
,
0
,
sizeof
(
float
),
&
count
,
NULL
,
NULL
,
NULL
));
openCLSafeCall
(
clEnqueueReadBuffer
(
Context
::
getContext
()
->
impl
->
clCmdQueue
,
(
cl_mem
)
counter
,
1
,
0
,
sizeof
(
float
),
&
count
,
0
,
NULL
,
NULL
));
Context
*
clCxt
=
map
.
clCxt
;
string
kernelName
=
"edgesHysteresisGlobal"
;
vector
<
pair
<
size_t
,
const
void
*>
>
args
;
size_t
localThreads
[
3
]
=
{
128
,
1
,
1
};
#define DIVUP(a, b) ((a)+(b)-1)/(b)
int
count_i
[
1
]
=
{
0
};
while
(
count
>
0
)
{
openCLSafeCall
(
clEnqueueWriteBuffer
(
Context
::
getContext
()
->
impl
->
clCmdQueue
,
(
cl_mem
)
counter
,
1
,
0
,
sizeof
(
int
),
&
count_i
,
0
,
NULL
,
NULL
));
args
.
clear
();
size_t
globalThreads
[
3
]
=
{
std
::
min
(
count
,
65535u
)
*
128
,
DIVUP
(
count
,
65535
),
1
};
args
.
push_back
(
make_pair
(
sizeof
(
cl_mem
),
(
void
*
)
&
map
.
data
));
...
...
@@ -380,7 +382,7 @@ void canny::edgesHysteresisGlobal_gpu(oclMat& map, oclMat& st1, oclMat& st2, voi
args
.
push_back
(
make_pair
(
sizeof
(
cl_int
),
(
void
*
)
&
map
.
offset
));
openCLExecuteKernel
(
clCxt
,
&
imgproc_canny
,
kernelName
,
globalThreads
,
localThreads
,
args
,
-
1
,
-
1
);
openCLSafeCall
(
clEnqueueReadBuffer
(
Context
::
getContext
()
->
impl
->
clCmdQueue
,
(
cl_mem
)
counter
,
1
,
0
,
sizeof
(
float
),
&
count
,
NULL
,
NULL
,
NULL
));
openCLSafeCall
(
clEnqueueReadBuffer
(
Context
::
getContext
()
->
impl
->
clCmdQueue
,
(
cl_mem
)
counter
,
1
,
0
,
sizeof
(
int
),
&
count
,
0
,
NULL
,
NULL
));
std
::
swap
(
st1
,
st2
);
}
#undef DIVUP
...
...
modules/ocl/src/kernels/imgproc_canny.cl
View file @
2e363386
...
...
@@ -601,7 +601,7 @@ __kernel
{
int
n
;
#
pragma
unroll
#
pragma
unroll
for
(
int
k
=
0
; k < 16; ++k)
{
n
=
0
;
...
...
@@ -686,12 +686,6 @@ __kernel
__local
ushort2
s_st[stack_size]
;
if
(
gidx
+
gidy
==
0
)
{
*counter
=
0
;
}
barrier
(
CLK_GLOBAL_MEM_FENCE
)
;
if
(
lidx
==
0
)
{
s_counter
=
0
;
...
...
modules/ocl/src/match_template.cpp
View file @
2e363386
...
...
@@ -114,7 +114,7 @@ namespace cv { namespace ocl
//////////////////////////////////////////////////////////////////////
// SQDIFF
void
matchTemplate_SQDIFF
(
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
MatchTemplateBuf
&
buf
)
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
MatchTemplateBuf
&
)
{
result
.
create
(
image
.
rows
-
templ
.
rows
+
1
,
image
.
cols
-
templ
.
cols
+
1
,
CV_32F
);
if
(
templ
.
size
().
area
()
<
getTemplateThreshold
(
CV_TM_SQDIFF
,
image
.
depth
()))
...
...
@@ -167,10 +167,11 @@ namespace cv { namespace ocl
}
void
matchTemplateNaive_SQDIFF
(
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
int
cn
)
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
int
)
{
CV_Assert
((
image
.
depth
()
==
CV_8U
&&
templ
.
depth
()
==
CV_8U
)
||
(
image
.
depth
()
==
CV_32F
&&
templ
.
depth
()
==
CV_32F
)
&&
result
.
depth
()
==
CV_32F
);
||
((
image
.
depth
()
==
CV_32F
&&
templ
.
depth
()
==
CV_32F
)
&&
result
.
depth
()
==
CV_32F
)
);
CV_Assert
(
image
.
channels
()
==
templ
.
channels
()
&&
(
image
.
channels
()
==
1
||
image
.
channels
()
==
4
)
&&
result
.
channels
()
==
1
);
CV_Assert
(
result
.
rows
==
image
.
rows
-
templ
.
rows
+
1
&&
result
.
cols
==
image
.
cols
-
templ
.
cols
+
1
);
...
...
@@ -263,10 +264,11 @@ namespace cv { namespace ocl
}
void
matchTemplateNaive_CCORR
(
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
int
cn
)
const
oclMat
&
image
,
const
oclMat
&
templ
,
oclMat
&
result
,
int
)
{
CV_Assert
((
image
.
depth
()
==
CV_8U
&&
templ
.
depth
()
==
CV_8U
)
||
(
image
.
depth
()
==
CV_32F
&&
templ
.
depth
()
==
CV_32F
)
&&
result
.
depth
()
==
CV_32F
);
||
((
image
.
depth
()
==
CV_32F
&&
templ
.
depth
()
==
CV_32F
)
&&
result
.
depth
()
==
CV_32F
)
);
CV_Assert
(
image
.
channels
()
==
templ
.
channels
()
&&
(
image
.
channels
()
==
1
||
image
.
channels
()
==
4
)
&&
result
.
channels
()
==
1
);
CV_Assert
(
result
.
rows
==
image
.
rows
-
templ
.
rows
+
1
&&
result
.
cols
==
image
.
cols
-
templ
.
cols
+
1
);
...
...
@@ -341,6 +343,7 @@ namespace cv { namespace ocl
templ_sum
=
sum
(
templ
)
/
templ
.
size
().
area
();
buf
.
image_sums
.
resize
(
buf
.
images
.
size
());
for
(
int
i
=
0
;
i
<
image
.
channels
();
i
++
)
{
integral
(
buf
.
images
[
i
],
buf
.
image_sums
[
i
]);
...
...
@@ -408,7 +411,7 @@ namespace cv { namespace ocl
#else
oclMat
templ_sqr
=
templ
;
multiply
(
templ
,
templ
,
templ_sqr
);
templ_sqsum
=
s
um
(
templ_sqr
)[
0
]
;
templ_sqsum
=
s
aturate_cast
<
float
>
(
sum
(
templ_sqr
)[
0
])
;
#endif //SQRSUM_FIXED
templ_sqsum
-=
scale
*
templ_sum
*
templ_sum
;
templ_sum
*=
scale
;
...
...
modules/ocl/src/surf.cpp
View file @
2e363386
This diff is collapsed.
Click to expand it.
modules/ocl/test/test_match_template.cpp
View file @
2e363386
...
...
@@ -44,7 +44,6 @@
#include "precomp.hpp"
#define PERF_TEST 0
////////////////////////////////////////////////////////////////////////////////
// MatchTemplate
...
...
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