跑superpixel的程序

知乎上对superpixel的讲解还不错:https://www.zhihu.com/question/27623988

superpixel的算法有很多,opencv中也包含了很多,我找了一个比较经典的:SLIC

这是跑的github上的一个superpixel的例子:https://github.com/np-csu/SLIC-superpixel-with-OpenCV\

mkdir build,cd build,cmake ../,make就可以了

1._ASSERT( y < m_height && x < m_width && y >= 0 && x >= 0 );

   _ASSERT(klabels[j] >= 0);

   这两个行都注释掉

2.在char fname[_MAX_FNAME];前加int _MAX_FNAME = 1000; 因为没声明赋值这个变量

3._splitpath(filename.c_str(), NULL, NULL, fname, extn);注释掉

demo.cpp

4.img = imread("..\\sample_image\\bird.jpg");加cv::

5.sprintf_s(result_name, 128, "..\\result_image\\result_%d.jpg", numSuperpixel);注释掉

其他要改的就是在demo.cpp中改成你要处理的图片,跑程序直接使用build里面的./demo就可以了

但整体跑出来的效果不是特别好

 

http://ttic.uchicago.edu/%7Exren/research/superpixel/ 这个网址的superpixel的效果很不错,也有代码,但用edge跑出来的结果相当不错,就没去跑这个了

https://www.cs.sfu.ca/%7Emori/research/superpixels/这个的效果也很好,也有代码

 

感想:超像素在一些点云的文章中也有提及,以后可以继续关注一下.SLIC这种搜索方式的算法,我觉得还是可以在之后的求上边缘中继续用到,可以继续关注一下.

posted @ 2018-05-14 15:15  有梦就要去实现他  阅读(358)  评论(0编辑  收藏  举报