From e5612c3c8748764ca9be9974bae30311340ea318 Mon Sep 17 00:00:00 2001 From: Balint Cristian Date: Tue, 22 Dec 2015 12:12:58 +0200 Subject: [PATCH] BugFix Issue No.481 related to SLIC, LSC contour mask values. --- modules/ximgproc/src/lsc.cpp | 6 +++--- modules/ximgproc/src/seeds.cpp | 2 +- modules/ximgproc/src/slic.cpp | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/ximgproc/src/lsc.cpp b/modules/ximgproc/src/lsc.cpp index 25247e0cc4..1575406a6f 100644 --- a/modules/ximgproc/src/lsc.cpp +++ b/modules/ximgproc/src/lsc.cpp @@ -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 }; @@ -309,7 +309,7 @@ void SuperpixelLSCImpl::getLabelContourMask(OutputArray _mask, bool _thick_line) } if( np > line_width ) { - mask.at(j,k) = -1; + mask.at(j,k) = (uchar)255; istaken[mainindex] = true; } mainindex++; diff --git a/modules/ximgproc/src/seeds.cpp b/modules/ximgproc/src/seeds.cpp index 90273adccb..f4ce79e72e 100644 --- a/modules/ximgproc/src/seeds.cpp +++ b/modules/ximgproc/src/seeds.cpp @@ -1214,7 +1214,7 @@ void SuperpixelSEEDSImpl::getLabelContourMask(OutputArray image, bool thick_line } } if( neighbors > 1 ) - *dst.ptr(j, k) = (uchar)-1; + *dst.ptr(j, k) = (uchar)255; } } } diff --git a/modules/ximgproc/src/slic.cpp b/modules/ximgproc/src/slic.cpp index d0ef004e01..a961b3aa14 100644 --- a/modules/ximgproc/src/slic.cpp +++ b/modules/ximgproc/src/slic.cpp @@ -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 }; @@ -293,7 +293,7 @@ void SuperpixelSLICImpl::getLabelContourMask(OutputArray _mask, bool _thick_line } if( np > line_width ) { - mask.at(j,k) = -1; + mask.at(j,k) = (uchar)255; istaken[mainindex] = true; } mainindex++;