function f = histogram(filename) a = imread(filename); hist = zeros(1,256); [rows cols] = size(a); for r = 1:rows for c = 1:cols index = a(r,c); hist(index+1) = hist(index+1)+1; end end bar(hist)