Commit 90105169 authored by Balint Cristian's avatar Balint Cristian

Fix LSC crash, guard against invalid label index.

parent 38758066
......@@ -768,6 +768,8 @@ inline void SuperpixelLSCImpl::PostEnforceLabelConnectivity( int threshold )
double W = W1 + W2;
if ( (Label1 > 0) && (Label2 > 0) )
{
for ( int b = 0; b < m_nr_channels; b++ )
{
centerC1[b][Label2] = float((W2*centerC1[b][Label2] + W1*centerC1[b][Label1]) / W);
......@@ -785,6 +787,7 @@ inline void SuperpixelLSCImpl::PostEnforceLabelConnectivity( int threshold )
int y = (*S).yLoc[i];
m_klabels.at<int>(y,x) = Label2;
}
}
vector<Superpixel>::iterator Stmp;
Stmp = find( Sarray.begin(), Sarray.end(), Label2 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment