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
cbfee83b
Commit
cbfee83b
authored
Aug 08, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: GFF same as cpu greedy implementation
parent
49062223
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
test_labeling.cpp
modules/gpu/test/test_labeling.cpp
+19
-24
No files found.
modules/gpu/test/test_labeling.cpp
View file @
cbfee83b
...
...
@@ -91,7 +91,7 @@ namespace {
int
height
=
image
.
rows
;
for
(
int
j
=
0
;
j
<
image
.
rows
;
++
j
)
for
(
int
i
=
0
;
i
<
image
.
cols
;
++
i
)
for
(
int
i
=
0
;
i
<
image
.
cols
;
++
i
)
{
if
(
dist_labels
[
j
*
pitch
+
i
]
!=
-
1
)
continue
;
...
...
@@ -130,6 +130,23 @@ namespace {
delete
[]
stack
;
}
void
checkCorrectness
(
cv
::
Mat
gpu
)
{
cv
::
Mat
diff
=
gpu
-
_labels
;
int
outliers
=
0
;
for
(
int
j
=
0
;
j
<
image
.
rows
;
++
j
)
for
(
int
i
=
0
;
i
<
image
.
cols
;
++
i
)
{
if
(
(
_labels
.
at
<
int
>
(
j
,
i
)
==
gpu
.
at
<
int
>
(
j
,
i
+
1
))
&&
(
diff
.
at
<
int
>
(
j
,
i
)
!=
diff
.
at
<
int
>
(
j
,
i
+
1
)))
{
outliers
++
;
// std::cout << j << " " << i << " " << _labels.at<int>(j,i) << " " << gpu.at<int>(j,i + 1) << " " << diff.at<int>(j, i) << " " << diff.at<int>(j,i + 1) << std::endl;
}
}
ASSERT_FALSE
(
outliers
);
}
cv
::
Mat
image
;
cv
::
Mat
_labels
;
};
...
...
@@ -161,10 +178,6 @@ TEST_P(Labeling, ConnectedComponents)
GreedyLabeling
host
(
image
);
host
(
host
.
_labels
);
double
minVal
,
maxVal
;
cv
::
minMaxLoc
(
host
.
_labels
,
&
minVal
,
&
maxVal
);
std
::
cout
<<
minVal
<<
" "
<<
maxVal
<<
std
::
endl
;
cv
::
gpu
::
GpuMat
mask
;
mask
.
create
(
image
.
rows
,
image
.
cols
,
CV_8UC1
);
...
...
@@ -175,25 +188,7 @@ TEST_P(Labeling, ConnectedComponents)
ASSERT_NO_THROW
(
cv
::
gpu
::
labelComponents
(
mask
,
components
));
for
(
int
j
=
0
;
j
+
32
<
components
.
rows
;
j
+=
32
)
for
(
int
i
=
0
;
i
+
32
<
components
.
cols
;
i
+=
32
)
{
std
::
cout
<<
"Tile: "
<<
i
<<
" "
<<
j
<<
std
::
endl
;
std
::
cout
<<
cv
::
Mat
(
image
,
cv
::
Rect
(
i
,
j
,
32
,
32
))
<<
std
::
endl
;
std
::
cout
<<
cv
::
Mat
(
host
.
_labels
,
cv
::
Rect
(
i
,
j
,
32
,
32
))
<<
std
::
endl
;
// std::cout << cv::Mat(cv::Mat(components), cv::Rect(i,j,32,32)) << std::endl;
}
// for debug
// cv::imshow("test", image);
// cv::waitKey(0);
// cv::imshow("test", host._labels * 5);
// cv::waitKey(0);
// // cv::imshow("test", cv::Mat(mask) * 10);
// // cv::waitKey(0);
// cv::imshow("test", cv::Mat(components) * 2);
// cv::waitKey(0);
host
.
checkCorrectness
(
cv
::
Mat
(
components
));
}
INSTANTIATE_TEST_CASE_P
(
ConnectedComponents
,
Labeling
,
ALL_DEVICES
);
...
...
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