Connected Components Labeling on Label Matrix

3 次查看(过去 30 天)
Hello there.
I try to implement SLIC Superpixels Method on MATLAB. I've done the clustering part and as writers said in this paper I need to apply a connected components labeling algorithm to get rid of bad labels. Upper image is output of SLIC code written by writers of paper and the other one is output of my SLIC code but without connected components part. Input of the connected components algorithm must be the "Label Matrix" which has same size as image but contains only labels which have more values than just 0 or 1. So how can I correct the bad labels?

回答(2 个)

Image Analyst
Image Analyst 2017-6-4
superpixels() already gives the labeled (connected components) image. https://www.mathworks.com/help/images/ref/superpixels.html?s_tid=srchtitle
Show your code where you called superpixels().
Also define what it is that you think makes a label "bad" as opposed to good. It doesn't make sense to have labels as only 0 or 1. You will have numbers up as high as the number of superpixel regions that were found. Virtually every region in there will have label numbers more than 1.
And you say "Input of the connected components algorithm must be the "Label Matrix"" Not true. Labeling and determining the connected components are the same thing. There are two functions for that - bwlabel() and bwconncomp() - and they both work off binary images. It doesn't make sense to send an already-labeled image into bwlabel() or bwconncomp() as you said. Actually the output of the connected components algorithm will be the "Label Matrix", NOT the input.
Bottom line - I don't know what you need to do. Your said your overall task is "to implement SLIC Superpixels Method" and that is done by the superpixels() function. Use it, if you haven't already. I don't know what else to answer.
  4 个评论
Image Analyst
Image Analyst 2017-6-4
Sorry, but that looks like a substantial code base for me to delve into. I'm sorry that I won't be able to donate the time it might take to solve it for you. Generally I only spend a few minutes on code for each question, and it looks like your situation might take substantially more than that. Good luck with it. If it's important, perhaps you can hire the author to finish it or get it working for you.
Batuhan Hangun
Batuhan Hangun 2017-6-5
I do not have money to hire and even if I had money I do not think that he accept that. Thanks for your help anyway.

请先登录,再进行评论。


Alex Taylor
Alex Taylor 2017-6-5
If you want to implement SLIC yourself, rather than use the implementation that is already in the Image Processing Toolbox as superpixels(), then I would recommend looking at the following site which includes reference implementations of SLIC:
The MATLAB implementation of SLIC already performs the post-processing step you are referring to in which labeled regions below some minimum size are merged with adjacent regions.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by