Program Matlab Gambar Hitam Putih

function hitamputih
x=imread('moon.tif');
y=x;
x=double(x);
[baris kolom]=size(x);
for i=1:baris,
    for j=1:kolom,
        if x(i,j)
               x(i,j)=0;
            else
                x(i,j)=255;
            end
    end
end
out=uint8(x)
subplot (2,2,1), imshow (y);
subplot (2,2,2), imhist (y);
subplot (2,2,3), imshow(out);
subplot (2,2,4), imhist (out);
Previous
Next Post »