Turn pixels in connected components to zero based on logical array
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Region and Image Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!