Effacer les filtres
Effacer les filtres

Delete certain pixels in 3D matrix

1 vue (au cours des 30 derniers jours)
Oded Scharf
Oded Scharf le 12 Août 2018
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!

Réponse acceptée

Oded Scharf
Oded Scharf le 15 Juil 2019
I found that using PixelIdxList solves the problem

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by