Convert Pixel Values Back to Matrix Indices?
Show older comments
I am taking a matrix of 1s and 0s and turning it into a binary image so that I can measure properties of the image using matlab's 'regionprops' function. I am getting the centroid and Major/Minor axis values of the binary image but those are all in terms of number of pixels. Is there a way to convert those values back to indices/matrix notation?
Answers (1)
Guillaume
on 5 Jul 2018
1 vote
Hum, a binary image is a matrix of 1s and 0s. There is nothing to do turn one into the other.
regionprops returns its output as (x, y) where x is the column index of your matrix, and y is the row index of your matrix. So all you have to do to convert regionprops output into matrix index is swap the two columns.
1 Comment
Andrew Poissant
on 6 Jul 2018
Categories
Find more on Region and Image Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!