フィルターのクリア

Delete certain pixels in 3D matrix

1 回表示 (過去 30 日間)
Oded Scharf
Oded Scharf 2018 年 8 月 12 日
回答済み: Oded Scharf 2019 年 7 月 15 日
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!

採用された回答

Oded Scharf
Oded Scharf 2019 年 7 月 15 日
I found that using PixelIdxList solves the problem

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by