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
6b5df895
Commit
6b5df895
authored
Oct 13, 2010
by
Alexey Spizhevoy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored mean shift segmentation a little
parent
41246333
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
mssegmentation.cpp
modules/gpu/src/mssegmentation.cpp
+14
-15
No files found.
modules/gpu/src/mssegmentation.cpp
View file @
6b5df895
...
@@ -379,11 +379,10 @@ void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int mins
...
@@ -379,11 +379,10 @@ void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int mins
{
{
for
(
int
e_it
=
g
.
start
[
v
];
e_it
!=
-
1
;
e_it
=
g
.
edges
[
e_it
].
next
)
for
(
int
e_it
=
g
.
start
[
v
];
e_it
!=
-
1
;
e_it
=
g
.
edges
[
e_it
].
next
)
{
{
int
comp1
=
comps
.
find
(
v
);
int
c1
=
comps
.
find
(
v
);
int
comp2
=
comps
.
find
(
g
.
edges
[
e_it
].
to
);
int
c2
=
comps
.
find
(
g
.
edges
[
e_it
].
to
);
if
(
comp1
!=
comp2
&&
g
.
edges
[
e_it
].
val
.
dr
<
hr
if
(
c1
!=
c2
&&
g
.
edges
[
e_it
].
val
.
dr
<
hr
&&
g
.
edges
[
e_it
].
val
.
dsp
<
hsp
)
&&
g
.
edges
[
e_it
].
val
.
dsp
<
hsp
)
comps
.
merge
(
c1
,
c2
);
comps
.
merge
(
comp1
,
comp2
);
}
}
}
}
...
@@ -396,14 +395,15 @@ void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int mins
...
@@ -396,14 +395,15 @@ void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int mins
LOG2
(
"initedges:"
,
clock
()
-
start
);
LOG2
(
"initedges:"
,
clock
()
-
start
);
DBG
(
start
=
clock
());
DBG
(
start
=
clock
());
// Prepare edges connecting differnet components
for
(
int
v
=
0
;
v
<
g
.
numv
;
++
v
)
for
(
int
v
=
0
;
v
<
g
.
numv
;
++
v
)
{
{
int
c
omp
1
=
comps
.
find
(
v
);
int
c1
=
comps
.
find
(
v
);
for
(
int
e_it
=
g
.
start
[
v
];
e_it
!=
-
1
;
e_it
=
g
.
edges
[
e_it
].
next
)
for
(
int
e_it
=
g
.
start
[
v
];
e_it
!=
-
1
;
e_it
=
g
.
edges
[
e_it
].
next
)
{
{
int
c
omp
2
=
comps
.
find
(
g
.
edges
[
e_it
].
to
);
int
c2
=
comps
.
find
(
g
.
edges
[
e_it
].
to
);
if
(
c
omp1
!=
comp
2
)
if
(
c
1
!=
c
2
)
edges
.
push_back
(
SegmLink
(
c
omp1
,
comp
2
,
g
.
edges
[
e_it
].
val
));
edges
.
push_back
(
SegmLink
(
c
1
,
c
2
,
g
.
edges
[
e_it
].
val
));
}
}
}
}
...
@@ -417,13 +417,12 @@ void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int mins
...
@@ -417,13 +417,12 @@ void meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int mins
DBG
(
start
=
clock
());
DBG
(
start
=
clock
());
// Exclude small components (starting from the nearest couple)
// Exclude small components (starting from the nearest couple)
vector
<
SegmLink
>::
iterator
e_it
=
edges
.
begin
();
for
(
size_t
i
=
0
;
i
<
edges
.
size
();
++
i
)
for
(;
e_it
!=
edges
.
end
();
++
e_it
)
{
{
int
c
omp1
=
comps
.
find
(
e_it
->
from
);
int
c
1
=
comps
.
find
(
edges
[
i
].
from
);
int
c
omp2
=
comps
.
find
(
e_it
->
to
);
int
c
2
=
comps
.
find
(
edges
[
i
].
to
);
if
(
c
omp1
!=
comp2
&&
(
comps
.
size
[
comp1
]
<
minsize
||
comps
.
size
[
comp
2
]
<
minsize
))
if
(
c
1
!=
c2
&&
(
comps
.
size
[
c1
]
<
minsize
||
comps
.
size
[
c
2
]
<
minsize
))
comps
.
merge
(
c
omp1
,
comp
2
);
comps
.
merge
(
c
1
,
c
2
);
}
}
LOG2
(
"excludesmall:"
,
clock
()
-
start
);
LOG2
(
"excludesmall:"
,
clock
()
-
start
);
...
...
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