Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
90105169
Commit
90105169
authored
Mar 27, 2017
by
Balint Cristian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix LSC crash, guard against invalid label index.
parent
38758066
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
lsc.cpp
modules/ximgproc/src/lsc.cpp
+17
-14
No files found.
modules/ximgproc/src/lsc.cpp
View file @
90105169
...
...
@@ -768,22 +768,25 @@ inline void SuperpixelLSCImpl::PostEnforceLabelConnectivity( int threshold )
double
W
=
W1
+
W2
;
for
(
int
b
=
0
;
b
<
m_nr_channels
;
b
++
)
if
(
(
Label1
>
0
)
&&
(
Label2
>
0
)
)
{
centerC1
[
b
][
Label2
]
=
float
((
W2
*
centerC1
[
b
][
Label2
]
+
W1
*
centerC1
[
b
][
Label1
])
/
W
);
centerC2
[
b
][
Label2
]
=
float
((
W2
*
centerC2
[
b
][
Label2
]
+
W1
*
centerC2
[
b
][
Label1
])
/
W
);
}
centerX1
[
Label2
]
=
float
((
W2
*
centerX1
[
Label2
]
+
W1
*
centerX1
[
Label1
])
/
W
);
centerX2
[
Label2
]
=
float
((
W2
*
centerX2
[
Label2
]
+
W1
*
centerX2
[
Label1
])
/
W
);
centerY1
[
Label2
]
=
float
((
W2
*
centerY1
[
Label2
]
+
W1
*
centerY1
[
Label1
])
/
W
);
centerY2
[
Label2
]
=
float
((
W2
*
centerY2
[
Label2
]
+
W1
*
centerY2
[
Label1
])
/
W
);
for
(
int
b
=
0
;
b
<
m_nr_channels
;
b
++
)
{
centerC1
[
b
][
Label2
]
=
float
((
W2
*
centerC1
[
b
][
Label2
]
+
W1
*
centerC1
[
b
][
Label1
])
/
W
);
centerC2
[
b
][
Label2
]
=
float
((
W2
*
centerC2
[
b
][
Label2
]
+
W1
*
centerC2
[
b
][
Label1
])
/
W
);
}
centerX1
[
Label2
]
=
float
((
W2
*
centerX1
[
Label2
]
+
W1
*
centerX1
[
Label1
])
/
W
);
centerX2
[
Label2
]
=
float
((
W2
*
centerX2
[
Label2
]
+
W1
*
centerX2
[
Label1
])
/
W
);
centerY1
[
Label2
]
=
float
((
W2
*
centerY1
[
Label2
]
+
W1
*
centerY1
[
Label1
])
/
W
);
centerY2
[
Label2
]
=
float
((
W2
*
centerY2
[
Label2
]
+
W1
*
centerY2
[
Label1
])
/
W
);
centerW
[
Label2
]
=
(
float
)
W
;
for
(
size_t
i
=
0
;
i
<
(
*
S
).
xLoc
.
size
();
i
++
)
{
int
x
=
(
*
S
).
xLoc
[
i
];
int
y
=
(
*
S
).
yLoc
[
i
];
m_klabels
.
at
<
int
>
(
y
,
x
)
=
Label2
;
centerW
[
Label2
]
=
(
float
)
W
;
for
(
size_t
i
=
0
;
i
<
(
*
S
).
xLoc
.
size
();
i
++
)
{
int
x
=
(
*
S
).
xLoc
[
i
];
int
y
=
(
*
S
).
yLoc
[
i
];
m_klabels
.
at
<
int
>
(
y
,
x
)
=
Label2
;
}
}
vector
<
Superpixel
>::
iterator
Stmp
;
...
...
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