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
5b598f8a
Commit
5b598f8a
authored
May 30, 2013
by
yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
a few fixes of ocl::perf test cases
parent
a9b7ff41
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
200 deletions
+10
-200
perf_arithm.cpp
modules/ocl/perf/perf_arithm.cpp
+0
-5
perf_filters.cpp
modules/ocl/perf/perf_filters.cpp
+3
-5
perf_imgproc.cpp
modules/ocl/perf/perf_imgproc.cpp
+7
-190
No files found.
modules/ocl/perf/perf_arithm.cpp
View file @
5b598f8a
...
@@ -62,7 +62,6 @@ PERFTEST(lut)
...
@@ -62,7 +62,6 @@ PERFTEST(lut)
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
lut
,
1
,
256
,
CV_8UC1
,
0
,
1
);
gen
(
lut
,
1
,
256
,
CV_8UC1
,
0
,
1
);
dst
=
src
;
LUT
(
src
,
lut
,
dst
);
LUT
(
src
,
lut
,
dst
);
...
@@ -233,8 +232,6 @@ PERFTEST(Mul)
...
@@ -233,8 +232,6 @@ PERFTEST(Mul)
gen
(
src1
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src1
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src2
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src2
,
size
,
size
,
all_type
[
j
],
0
,
256
);
dst
=
src1
;
dst
.
setTo
(
0
);
multiply
(
src1
,
src2
,
dst
);
multiply
(
src1
,
src2
,
dst
);
...
@@ -281,8 +278,6 @@ PERFTEST(Div)
...
@@ -281,8 +278,6 @@ PERFTEST(Div)
gen
(
src1
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src1
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src2
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src2
,
size
,
size
,
all_type
[
j
],
0
,
256
);
dst
=
src1
;
dst
.
setTo
(
0
);
divide
(
src1
,
src2
,
dst
);
divide
(
src1
,
src2
,
dst
);
...
...
modules/ocl/perf/perf_filters.cpp
View file @
5b598f8a
...
@@ -291,9 +291,7 @@ PERFTEST(GaussianBlur)
...
@@ -291,9 +291,7 @@ PERFTEST(GaussianBlur)
{
{
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; "
<<
type_name
[
j
]
;
gen
(
src
,
size
,
size
,
all_type
[
j
],
0
,
256
);
gen
(
src
,
size
,
size
,
all_type
[
j
],
5
,
16
);
dst
=
src
;
dst
.
setTo
(
0
);
GaussianBlur
(
src
,
dst
,
Size
(
9
,
9
),
0
);
GaussianBlur
(
src
,
dst
,
Size
(
9
,
9
),
0
);
...
@@ -346,8 +344,8 @@ PERFTEST(filter2D)
...
@@ -346,8 +344,8 @@ PERFTEST(filter2D)
Mat
kernel
;
Mat
kernel
;
gen
(
kernel
,
ksize
,
ksize
,
CV_32FC1
,
0.0
,
1.0
);
gen
(
kernel
,
ksize
,
ksize
,
CV_32FC1
,
0.0
,
1.0
);
Mat
dst
,
ocl_dst
;
Mat
dst
,
ocl_dst
;
dst
.
setTo
(
0
);
cv
::
filter2D
(
src
,
dst
,
-
1
,
kernel
);
cv
::
filter2D
(
src
,
dst
,
-
1
,
kernel
);
CPU_ON
;
CPU_ON
;
...
...
modules/ocl/perf/perf_imgproc.cpp
View file @
5b598f8a
...
@@ -674,8 +674,8 @@ COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size
...
@@ -674,8 +674,8 @@ COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size
coor
.
y
=
static_cast
<
short
>
(
y0
);
coor
.
y
=
static_cast
<
short
>
(
y0
);
return
coor
;
return
coor
;
}
}
void
meanShiftFiltering_
(
const
Mat
&
src_roi
,
Mat
&
dst_roi
,
int
sp
,
int
sr
,
cv
::
TermCriteria
crit
);
void
meanShiftFiltering_
(
const
Mat
&
src_roi
,
Mat
&
dst_roi
,
int
sp
,
int
sr
,
cv
::
TermCriteria
crit
)
static
void
meanShiftFiltering_
(
const
Mat
&
src_roi
,
Mat
&
dst_roi
,
int
sp
,
int
sr
,
cv
::
TermCriteria
crit
)
{
{
if
(
src_roi
.
empty
()
)
if
(
src_roi
.
empty
()
)
CV_Error
(
CV_StsBadArg
,
"The input image is empty"
);
CV_Error
(
CV_StsBadArg
,
"The input image is empty"
);
...
@@ -683,6 +683,8 @@ void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr, cv::T
...
@@ -683,6 +683,8 @@ void meanShiftFiltering_(const Mat &src_roi, Mat &dst_roi, int sp, int sr, cv::T
if
(
src_roi
.
depth
()
!=
CV_8U
||
src_roi
.
channels
()
!=
4
)
if
(
src_roi
.
depth
()
!=
CV_8U
||
src_roi
.
channels
()
!=
4
)
CV_Error
(
CV_StsUnsupportedFormat
,
"Only 8-bit, 4-channel images are supported"
);
CV_Error
(
CV_StsUnsupportedFormat
,
"Only 8-bit, 4-channel images are supported"
);
dst_roi
.
create
(
src_roi
.
size
(),
src_roi
.
type
());
CV_Assert
(
(
src_roi
.
cols
==
dst_roi
.
cols
)
&&
(
src_roi
.
rows
==
dst_roi
.
rows
)
);
CV_Assert
(
(
src_roi
.
cols
==
dst_roi
.
cols
)
&&
(
src_roi
.
rows
==
dst_roi
.
rows
)
);
CV_Assert
(
!
(
dst_roi
.
step
&
0x3
)
);
CV_Assert
(
!
(
dst_roi
.
step
&
0x3
)
);
...
@@ -725,9 +727,6 @@ PERFTEST(meanShiftFiltering)
...
@@ -725,9 +727,6 @@ PERFTEST(meanShiftFiltering)
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; 8UC3 vs 8UC4"
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; 8UC3 vs 8UC4"
;
gen
(
src
,
size
,
size
,
CV_8UC4
,
Scalar
::
all
(
0
),
Scalar
::
all
(
256
));
gen
(
src
,
size
,
size
,
CV_8UC4
,
Scalar
::
all
(
0
),
Scalar
::
all
(
256
));
//gen(dst, size, size, CV_8UC4, Scalar::all(0), Scalar::all(256));
dst
=
src
;
dst
.
setTo
(
0
);
cv
::
TermCriteria
crit
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
5
,
1
);
cv
::
TermCriteria
crit
(
cv
::
TermCriteria
::
COUNT
+
cv
::
TermCriteria
::
EPS
,
5
,
1
);
...
@@ -756,201 +755,21 @@ PERFTEST(meanShiftFiltering)
...
@@ -756,201 +755,21 @@ PERFTEST(meanShiftFiltering)
TestSystem
::
instance
().
ExpectedMatNear
(
dst
,
ocl_dst
,
0.0
);
TestSystem
::
instance
().
ExpectedMatNear
(
dst
,
ocl_dst
,
0.0
);
}
}
}
}
///////////// meanShiftProc////////////////////////
#if 0
COOR do_meanShift(int x0, int y0, uchar *sptr, uchar *dptr, int sstep, cv::Size size, int sp, int sr, int maxIter, float eps, int *tab)
{
int isr2 = sr * sr;
int c0, c1, c2, c3;
int iter;
uchar *ptr = NULL;
uchar *pstart = NULL;
int revx = 0, revy = 0;
c0 = sptr[0];
c1 = sptr[1];
c2 = sptr[2];
c3 = sptr[3];
// iterate meanshift procedure
for (iter = 0; iter < maxIter; iter++)
{
int count = 0;
int s0 = 0, s1 = 0, s2 = 0, sx = 0, sy = 0;
//mean shift: process pixels in window (p-sigmaSp)x(p+sigmaSp)
int minx = x0 - sp;
int miny = y0 - sp;
int maxx = x0 + sp;
int maxy = y0 + sp;
//deal with the image boundary
if (minx < 0)
{
minx = 0;
}
if (miny < 0)
{
miny = 0;
}
if (maxx >= size.width)
{
maxx = size.width - 1;
}
if (maxy >= size.height)
{
maxy = size.height - 1;
}
if (iter == 0)
{
pstart = sptr;
}
else
{
pstart = pstart + revy * sstep + (revx << 2); //point to the new position
}
ptr = pstart;
ptr = ptr + (miny - y0) * sstep + ((minx - x0) << 2); //point to the start in the row
for (int y = miny; y <= maxy; y++, ptr += sstep - ((maxx - minx + 1) << 2))
{
int rowCount = 0;
int x = minx;
#if CV_ENABLE_UNROLLED
for (; x + 4 <= maxx; x += 4, ptr += 16)
{
int t0, t1, t2;
t0 = ptr[0], t1 = ptr[1], t2 = ptr[2];
if (tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
{
s0 += t0;
s1 += t1;
s2 += t2;
sx += x;
rowCount++;
}
t0 = ptr[4], t1 = ptr[5], t2 = ptr[6];
if (tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
{
s0 += t0;
s1 += t1;
s2 += t2;
sx += x + 1;
rowCount++;
}
t0 = ptr[8], t1 = ptr[9], t2 = ptr[10];
if (tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
{
s0 += t0;
s1 += t1;
s2 += t2;
sx += x + 2;
rowCount++;
}
t0 = ptr[12], t1 = ptr[13], t2 = ptr[14];
if (tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
{
s0 += t0;
s1 += t1;
s2 += t2;
sx += x + 3;
rowCount++;
}
}
#endif
for (; x <= maxx; x++, ptr += 4)
{
int t0 = ptr[0], t1 = ptr[1], t2 = ptr[2];
if (tab[t0 - c0 + 255] + tab[t1 - c1 + 255] + tab[t2 - c2 + 255] <= isr2)
{
s0 += t0;
s1 += t1;
s2 += t2;
sx += x;
rowCount++;
}
}
if (rowCount == 0)
{
continue;
}
count += rowCount;
sy += y * rowCount;
}
if (count == 0)
{
break;
}
int x1 = sx / count;
int y1 = sy / count;
s0 = s0 / count;
s1 = s1 / count;
s2 = s2 / count;
bool stopFlag = (x0 == x1 && y0 == y1) || (abs(x1 - x0) + abs(y1 - y0) +
tab[s0 - c0 + 255] + tab[s1 - c1 + 255] + tab[s2 - c2 + 255] <= eps);
//revise the pointer corresponding to the new (y0,x0)
revx = x1 - x0;
revy = y1 - y0;
x0 = x1;
y0 = y1;
c0 = s0;
c1 = s1;
c2 = s2;
if (stopFlag)
{
break;
}
} //for iter
dptr[0] = (uchar)c0;
dptr[1] = (uchar)c1;
dptr[2] = (uchar)c2;
dptr[3] = (uchar)c3;
COOR coor;
coor.x = static_cast<short>(x0);
coor.y = static_cast<short>(y0);
return coor;
}
#endif
void
meanShiftProc_
(
const
Mat
&
src_roi
,
Mat
&
dst_roi
,
Mat
&
dstCoor_roi
,
int
sp
,
int
sr
,
cv
::
TermCriteria
crit
)
void
meanShiftProc_
(
const
Mat
&
src_roi
,
Mat
&
dst_roi
,
Mat
&
dstCoor_roi
,
int
sp
,
int
sr
,
cv
::
TermCriteria
crit
)
{
{
if
(
src_roi
.
empty
())
if
(
src_roi
.
empty
())
{
{
CV_Error
(
CV_StsBadArg
,
"The input image is empty"
);
CV_Error
(
CV_StsBadArg
,
"The input image is empty"
);
}
}
if
(
src_roi
.
depth
()
!=
CV_8U
||
src_roi
.
channels
()
!=
4
)
if
(
src_roi
.
depth
()
!=
CV_8U
||
src_roi
.
channels
()
!=
4
)
{
{
CV_Error
(
CV_StsUnsupportedFormat
,
"Only 8-bit, 4-channel images are supported"
);
CV_Error
(
CV_StsUnsupportedFormat
,
"Only 8-bit, 4-channel images are supported"
);
}
}
dst_roi
.
create
(
src_roi
.
size
(),
src_roi
.
type
());
dstCoor_roi
.
create
(
src_roi
.
size
(),
CV_16SC2
);
CV_Assert
((
src_roi
.
cols
==
dst_roi
.
cols
)
&&
(
src_roi
.
rows
==
dst_roi
.
rows
)
&&
CV_Assert
((
src_roi
.
cols
==
dst_roi
.
cols
)
&&
(
src_roi
.
rows
==
dst_roi
.
rows
)
&&
(
src_roi
.
cols
==
dstCoor_roi
.
cols
)
&&
(
src_roi
.
rows
==
dstCoor_roi
.
rows
));
(
src_roi
.
cols
==
dstCoor_roi
.
cols
)
&&
(
src_roi
.
rows
==
dstCoor_roi
.
rows
));
CV_Assert
(
!
(
dstCoor_roi
.
step
&
0x3
));
CV_Assert
(
!
(
dstCoor_roi
.
step
&
0x3
));
...
@@ -1008,8 +827,6 @@ PERFTEST(meanShiftProc)
...
@@ -1008,8 +827,6 @@ PERFTEST(meanShiftProc)
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; 8UC4 and CV_16SC2 "
;
SUBTEST
<<
size
<<
'x'
<<
size
<<
"; 8UC4 and CV_16SC2 "
;
gen
(
src
,
size
,
size
,
CV_8UC4
,
Scalar
::
all
(
0
),
Scalar
::
all
(
256
));
gen
(
src
,
size
,
size
,
CV_8UC4
,
Scalar
::
all
(
0
),
Scalar
::
all
(
256
));
gen
(
dst
[
0
],
size
,
size
,
CV_8UC4
,
Scalar
::
all
(
0
),
Scalar
::
all
(
256
));
gen
(
dst
[
1
],
size
,
size
,
CV_16SC2
,
Scalar
::
all
(
0
),
Scalar
::
all
(
256
));
meanShiftProc_
(
src
,
dst
[
0
],
dst
[
1
],
5
,
6
,
crit
);
meanShiftProc_
(
src
,
dst
[
0
],
dst
[
1
],
5
,
6
,
crit
);
...
...
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