% create own histogram I = imread('cameraman.bmp'); x = 0 : 255; y = zeros(1, 256); for i = 1 : 256 for j = 1 : 256 temp = I(i,j); y(temp+1) = y(temp+1) + 1; endfor endfor stem(x,y) grid on y