Langsung ke konten utama

Postingan

Menampilkan postingan dengan label Program Matlab

Program matlab sharpening citra

function sharpening A=imread('cameraman.tif'); %m=[0 -1 0;-1 4 -1;0 -1 0]; %m=[1/10 1/10 1/10;1/10 1/5 1/10;1/10 1/10 1/10]; m=[-1 -1 -1;-1 9 -1;-1 -1 -1]; A=double(A); d=A; [baris kolom]=size(A); for i=2:baris-1;     for j=2:kolom-1;         d(i,j)=A(i-1,j-1)*m(1,1)+A(i-1,j)*m(1,2)+A(i-1,j+1)*m(1,3)+A(i,j-1)*m(2,1)+A(i,j)*m(2,2)+A(i,j+1)*m(2,3)+A(i+1,j-1)*m(3,1)+A(i+1,j)*m(3,2)+A(i+1,j+1)*m(3,3);         if d(i,j)>255             d(i,j)=255;         else if d(i,j)                 d(i,j)=0;             end         end     end end C=uint8(A); subplot (2,2,1), imshow(C); subplot (2,2,2), imhist...

Program matlab smoothing citra

function smoothing A=imread('cameraman.tif'); %m=[0 -1 0;-1 4 -1;0 -1 0]; %m=[1/16 1/8 1/16;1/8 1/4 1/16 ;1/16 1/8 1/16] m=[1/10 1/10 1/10;1/10 1/5 1/10;1/10 1/10 1/10]; %m=[-1 -1 -1;-1 9 -1;-1 -1 -1]; A=double(A); d=A; [baris kolom]=size(A); for i=2:baris-1;     for j=2:kolom-1;         d(i,j)=A(i-1,j-1)*m(1,1)+A(i-1,j)*m(1,2)+A(i-1,j+1)*m(1,3)+A(i,j-1)*m(2,1)+A(i,j)*m(2,2)+A(i,j+1)*m(2,3)+A(i+1,j-1)*m(3,1)+A(i+1,j)*m(3,2)+A(i+1,j+1)*m(3,3);         if d(i,j)>255             d(i,j)=255;         else if d(i,j)                 d(i,j)=0;             end         end     end end C=uint8(A); subpl...

Program Matlab konvolusi

function konvolusidata A=[4 4 3 5 4;6 6 5 5 2;5 6 6 6 2;6 7 5 5 3;3 5 2 4 4]; m=[0 -1 0;-1 4 -1;0 -1 0]; d=A [baris kolom]=size(A); for i=2:baris-1; for j=2:kolom-1; d(i,j)=A(i-1,j-1)*m(1,1)+A(i-1,j)*m(1,2)+A(i-1,j+1)*m(1,3)+A(i,j-1)*m(2,1)+A(i,j)*m(2,2)+A(i,j-1)*m(2,3)+A(i+1,j-1)*m(3,1)+A(i+1,j)*m(3,2)+A(i+1,j+1)*m(3,3); if d(i,j)>255 d(i,j)=255; else if d(i,j) d(i,j) end end end end

Program Matlab Pencerahan Gambar

function terang1 x=imread('moon.tif'); y=x; x=double(x); [baris kolom]=size(x); for i=1:baris,     for j=1:kolom,         x(i,j)=x(i,j)+100;         if x(i,j)>255             x(i,j)=255;         else             if x(i,j)                 x(i,j)=0;             else                 x(i,j)=x(i,j);             end         end     end end out=uint8(x) subplot (2,2,1), imshow (y); subplot (2,2,2), imhist (y); subplot (2,2,3), imshow(out);...

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);