Borrar filtros
Borrar filtros

problem of take out ROI while use Superpixels

1 visualización (últimos 30 días)
hajer jon
hajer jon el 23 de Oct. de 2019
Comentada: Uma Sharma el 14 de Jul. de 2022
Hi
i wrote code that select ROI then devide image to patches then appaly superpixels but the superpixels results show that non ROI is calcute superpixels on it how can i let not take the non ROI while counting???
I3=read(v,1);
BW = roipoly(I3);
for t=1:4
imca=im2patch{t}
figure;imshow(imca);
t=t+1;
[Lce,N] = superpixels(imca,500);
BWL1 = boundarymask(Lce);
masimg1=imoverlay(imca,BWL1);
figure;imshow(masimg1);
end;roiandsuperpicels.jpg

Respuestas (1)

Subhadeep Koley
Subhadeep Koley el 10 de En. de 2020
Hi, you are getting such output because you are applying super-pixel over segmentation on the whole image. You can use the function roifilt2 to apply your filtering only to the ROI. Refer the code below.
I = imread('peppers.png');
BW = roipoly(I);
imshow(BW);
% Create function handle
f = @(x)superpixels(x,500);
% Apply 2-D superpixel oversegmentation on the ROI
if size(I, 3) == 3
J = roifilt2(rgb2gray(I), BW, f);
else
J = roifilt2(I, BW, f);
end
% Create the mask
mask = boundarymask(J, 8);
% Overlay the mask above the image
figure;imshow(labeloverlay(I, mask, 'Transparency', 0.3, 'Colormap', 'parula'));
SLIC.png
Hope this helps!
  1 comentario
Uma Sharma
Uma Sharma el 14 de Jul. de 2022
Hi,
This response was very helpful! Using the function handle, how can I get the label and numIterations data from the superpixel function for the superpixels in the ROI? Please let me know if there are any solutions to this.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by