How can I access each superpixel of an image?

1 回表示 (過去 30 日間)
Algorithms Analyst
Algorithms Analyst 2015 年 8 月 5 日
コメント済み: Ad 2017 年 4 月 16 日
Hello
I have successfully segmented the superpixels of an image (having size 120x160) using SLIC algorithm. For instance,
segments = vl_slic(img,regionSize, regularizer);
This segments(having size 120x160) contain all the number of superpixels which are segmented from img using SLIC. And I segmented only 50 superpixels.
Now how can I access each superpixel from this segments?
For example, I want to make a cell array (let say l=cell(1,num_superpixels)) and keep all individual superpixels in each cell for further processing.
Any help is appreciated
Thanks in advance!
  2 件のコメント
SONAM TIPLE
SONAM TIPLE 2017 年 3 月 25 日
編集済み: SONAM TIPLE 2017 年 3 月 25 日
segmented_images = cell(1,max(max(L)));
rgb_label = repmat(L,[1 1 3]);
for k = 1:max(max(L)) %L-label matrix
color = im;%im-Color img
color(rgb_label ~= k) = 0; segmented_images{k} = color; end
imshow(segmented_images{1}), title('objects in cluster 1');% this will display your Superpixel or cluster no 1, %this way you can view your individual superpixel %check segmented_images in workspace you will find cell arrays.
Ad
Ad 2017 年 4 月 16 日
what is 'im'?

サインインしてコメントする。

回答 (1 件)

Huan Liang
Huan Liang 2017 年 4 月 12 日
idx=label2idx(L); and then you can use idx{i} to search each superpixel

Community Treasure Hunt

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

Start Hunting!

Translated by