Turn pixels in connected components to zero based on logical array
显示 更早的评论
I want to switch all pixels in connected components to zero, based on a logical array.
I have CC.PixelIdxList obtained from bwconncomp performed on binary image BW.
I have a logical array, X, the size of CC.PixelIdxList, based on which I would like to turn pixels in CC.PixelIdxList{y} to zero if the value in X=0 at index y.
I tried this:
BW(CC.PixelIdxList{y}) =X;
where y is just an array of numbers from 1 to the size of CC.PixelIdxList.
But it is not working, there must be another way that I cant think of.
Appreciate any suggestions. Thanks.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Region and Image Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!