For example i have an image matrix that looks like this one:
1 2 3
1 5 6
1 5 3
Assume that my intensity goes from 1 to 6, so I need to produce something like an array:
1 : 3
2 : 1
3 : 2
4 : 0
5 : 2
6 : 1
I tried using hist function of matlab but it produced something looks really weried to me.
Can anybosy help me on that?
Thank you very much
I suspect that you probably haven’t specified the correct histogram bins for
hist(by default it creates 10 equally spaced bins). If you’re interested in a simple histogram count, consider usinghistc:where
Ais your image matrix.valsis the first column in your desired output array, andcountis the the second.