How can I change the values of certain segments to 0?

1 vue (au cours des 30 derniers jours)
Andrea Labudzki
Andrea Labudzki le 2 Fév 2022
Commenté : Andrea Labudzki le 3 Fév 2022
I have a segmented image, it looks like this:
and I would like to further filter out some parts of the image by "excluding" the segments in the image that do not fit certain dimensions (I have the certain dimensions figured out already). How can I change the values of these segments that I would like exclude to 0 instead of 1?

Réponse acceptée

Benjamin Thompson
Benjamin Thompson le 2 Fév 2022
An image is just a matrix in MATLAB. If you know the rows and columns in your image that correspond to segments you want to zero out, then use the colon notation to set portions of the matrix to zero:
A(rowStart:rowEnd,colStart:colEnd) = 0
  2 commentaires
Andrea Labudzki
Andrea Labudzki le 2 Fév 2022
of course! thanks a lot
Andrea Labudzki
Andrea Labudzki le 3 Fév 2022
Hi, I have a follow-up question for you. So I have this segmented image and I have the propertires of the regions (height and width). I've found which regions I would like to keep, meaning that I found which dimensions I would like to keep. How can I find which regions have these dimensions so I can set all the other regions to 0?

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by