Skip to content

Commit

Permalink
BugFix Issue No.481 related to SLIC, LSC contour mask values.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbalint13 committed Dec 22, 2015
1 parent e8937cc commit e5612c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions modules/ximgproc/src/lsc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ void SuperpixelLSCImpl::getLabelContourMask(OutputArray _mask, bool _thick_line)

if ( !_thick_line ) line_width = 1;

_mask.create( m_height, m_width, CV_8SC1 );
_mask.create( m_height, m_width, CV_8UC1 );
Mat mask = _mask.getMat();

mask.setTo(1);
mask.setTo(0);

const int dx8[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dy8[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
Expand Down Expand Up @@ -309,7 +309,7 @@ void SuperpixelLSCImpl::getLabelContourMask(OutputArray _mask, bool _thick_line)
}
if( np > line_width )
{
mask.at<char>(j,k) = -1;
mask.at<char>(j,k) = (uchar)255;
istaken[mainindex] = true;
}
mainindex++;
Expand Down
2 changes: 1 addition & 1 deletion modules/ximgproc/src/seeds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ void SuperpixelSEEDSImpl::getLabelContourMask(OutputArray image, bool thick_line
}
}
if( neighbors > 1 )
*dst.ptr<uchar>(j, k) = (uchar)-1;
*dst.ptr<uchar>(j, k) = (uchar)255;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions modules/ximgproc/src/slic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ void SuperpixelSLICImpl::getLabelContourMask(OutputArray _mask, bool _thick_line

if ( !_thick_line ) line_width = 1;

_mask.create( m_height, m_width, CV_8SC1 );
_mask.create( m_height, m_width, CV_8UC1 );
Mat mask = _mask.getMat();

mask.setTo(1);
mask.setTo(0);

const int dx8[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dy8[8] = { 0, -1, -1, -1, 0, 1, 1, 1 };
Expand Down Expand Up @@ -293,7 +293,7 @@ void SuperpixelSLICImpl::getLabelContourMask(OutputArray _mask, bool _thick_line
}
if( np > line_width )
{
mask.at<char>(j,k) = -1;
mask.at<char>(j,k) = (uchar)255;
istaken[mainindex] = true;
}
mainindex++;
Expand Down

0 comments on commit e5612c3

Please sign in to comment.