Opencv_contrib: ximgproc: SLIC out of bounds

Created on 4 Apr 2016  路  6Comments  路  Source: opencv/opencv_contrib

#include <opencv2/opencv.hpp>
#include <opencv2/ximgproc.hpp>
using namespace cv;
using namespace cv::ximgproc;

int main(int argc, char **argv)
{
    Mat image = imread("im/lena.png"); //512x512
    Ptr<SuperpixelSLIC> slic = createSuperpixelSLIC(image, SLICO, 10, 10.0f) ;
    return 0;
}

breaks here , m_numlabels=2621, m_kseedsx.size()=2601

actually, it works, when choosing a larger region, like 12

for context, see here

bug ximgproc

Most helpful comment

@berak ,

  • Will look into this.

All 6 comments

@berak ,

  • Will look into this.

@berak ,

Let me know the results.

@berak ,

  • Looking in more details (MSVC), seems linux to be fine.

@berak ,

  • Can check this patch ?
--- opencv_contrib/modules/ximgproc/src/slic.cpp    2015-12-23 11:30:53.359563158 +0200
+++ opencv_contrib/modules/ximgproc/src/slic.cpp    2016-04-05 17:31:29.774349783 +0300
@@ -226,11 +226,12 @@
     else
       CV_Error( Error::StsInternal, "No such algorithm" );

+    // update amount of labels now
+    m_numlabels = (int)m_kseeds[0].size();
+
     // perturb seeds given edges
     if ( perturbseeds ) PerturbSeeds( edgemag );

-    // update amount of labels now
-    m_numlabels = (int)m_kseeds[0].size();
 }

 void SuperpixelSLICImpl::iterate( int num_iterations )

@cbalint13 ,

K枚sz枚n枚m sz茅pen !
(Vielen dank !)

yes, demo code + patch are working nicely now.

incredibly fast ! thanks again.

Was this page helpful?
0 / 5 - 0 ratings