Delete certain pixels in 3D matrix

3 visualizaciones (últimos 30 días)
Oded Scharf
Oded Scharf el 12 de Ag. de 2018
Respondida: Oded Scharf el 15 de Jul. de 2019
Hey, I need to clean a video by deleting specific pixels in each frame using 'regionprops'.
When I use 'PixelList' in the indexing it deletes whole squares and not the specific pixels:
for frame=1:size(bin_angiogram,3)
region_angiogram(:,:,frame)=bwlabel(bin_angiogram(:,:,frame));
stats=regionprops(region_angiogram(:,:,frame),'Area','PixelIdxList');
for region=1:size(stats,1)
if stats(region).Area<3000
region_angiogram(stats(region).PixelList(:,2),stats(region).PixelList(:,1),frame) =0;
end
end
end
and if I try to do it using 'PixelIdxList' it is extremely slow:
for frame=1:size(bin_angiogram,3)
region_angiogram(:,:,frame)=bwlabel(bin_angiogram(:,:,frame));
stats=regionprops(region_angiogram(:,:,frame),'Area','PixelList');
for region=1:size(stats,1)
if stats(region).Area<500
L = region_angiogram(:,:,frame);
L(stats(region).PixelIdxList) = 0;
region_angiogram(stats(region).PixelList,frame) =L;
end
end
end
bin_angiogram is atached.
Do you have any Idea how can I do it?
Tanks!

Respuesta aceptada

Oded Scharf
Oded Scharf el 15 de Jul. de 2019
I found that using PixelIdxList solves the problem

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by