Azzera filtri
Azzera filtri

Delete certain pixels in 3D matrix

1 visualizzazione (ultimi 30 giorni)
Oded Scharf
Oded Scharf il 12 Ago 2018
Risposto: Oded Scharf il 15 Lug 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!

Risposta accettata

Oded Scharf
Oded Scharf il 15 Lug 2019
I found that using PixelIdxList solves the problem

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by