function f = treshold(filename) a = imread(filename); [rows cols] = size(a); for r = 1:rows for c = 1:cols if a(r,c) > 100 a(r,c) = 255; else a(r,c) = 0; end end end imagesc(a)