MATLAB: Histogram plot is emplty

image processingImage Processing Toolbox

I have errors in displaying the histogram for a matrix (3648×5472). The histogram displayed is blank. The matrix value is in uint8.

Best Answer

You can use imhist, or you can also use histogram(). They will both work. What is probably happening is that your V is having every one of its pixels replaced by true or false (1 or 0). So there are only two bins. Now one of them, the zero bin, is so high, and it's at the very left of the chart that it looks like the Y axis. If you use imhist() you will have 256 bins and the 0 and 1 bin will be so small and at the edge of the chart box that you probably don't notice them. If you use histogram, you should see two fat bars - one at 0 and one at 1.