Sunteți pe pagina 1din 14

MUGA | 2014 

DIREKTORI KERJA
• Buat direktori kerja < Sertakan image yang akan kita panggil> 

Pilih folder 

Run Project 
SHOW IMAGE

a=imread(‘NamaFile.TypeFile’); 
figure; 
imshow(a); title(‘TitleFile'); 
 
Contoh : 
 
 
 
PERINTAH UBAH UKURAN IMAGE

a=imread (‘NamaFile.TypeFile’); 
imshow(a); 
  
b= (a, [250 300]); 
figure;  Perintah tulis file/save as>  
imshow(b); 
imwrite(b, ' NamaFile.TypeFile '); 
 
Contoh : 
 
 
 
GRAY SCALE IMAGE

b=rgb2gray(a); 
figure; 
imshow(b);title('gray'); 
 
Contoh : 
 
 
 
THRESHOLD IMAGE

c=im2bw(a) 
figure; 
imshow(c);title('treshold'); 
 
Contoh : 
 
 
 
BRIGTHNES IMAGE

b=imadd(a,180); 
  
c=imsubtract(a,128); 
 
Contoh : 
 
 
 
INVERT COLOURS

a=imread(‘namaFile.format'); 
b=imcomplement(a); 
  
imshow(b) 
 
Contoh : 
 
 
 
PENGGUNAAN SUB PLOT
a=imread('Koala_dua.png'); 
  
b=imadd(a,180); 
  
c=imsubtract(a,128); 
  
d=im2bw(a); 
  
  
subplot(2,2,1); imshow(a); title ('input image') 
subplot(2,2,2); imshow(b); title ('terang') 
subplot(2,2,3); imshow(c); title ('gelap') 
subplot(2,2,4); imshow(d); title ('binary') 
 
 
 
RGB COMPONENT
a=imread('bunga.jpg'); 
  
Red=a; 
Green=a; 
Blue=a; 
  
Red(:,:,2:3)=0;  
subplot(2,2,1);imshow(a);title('image input'); 
  
Green(:,:,1)=0; 
Green(:,:,3)=0; 
  
subplot(2,2,2);imshow(Red);title('red component'); 
  
  
subplot(2,2,3);imshow(Green);title('green component'); 
  
Blue(:,:,1)=0; 
Blue(:,:,2)=0; 
subplot(2,2,4);imshow(Blue);title('blue component'); 
 
 
 
BLUR IMAGE
gambar=imread('Koala.jpg'); 
gaussianFilter = fspecial('gaussian', [12, 12], 5) 
hasil = imfilter(gambar, gaussianFilter, 'symmetric', 'conv'); 
subplot(1,2,1), image(gambar); 
subplot(1,2,2), image(hasil), title('Blurred Turtle, blur matrix size 12'); 
 
 
 
EDGE DETECTION (Deteksi Tepian)

g = imread(‘namaFile.typeFile'); 
gray=rgb2gray(g); 
x = edge(gray,'log'); 
imshow(x); 
 
Contoh : 
 
METODE : 
 
• Metode Prewitt 
• Metode Sobel 
• Metode Roberts 
• Laplacian of  Gaussian (log) 
 
 
 
EDGE DETECTION (Deteksi Tepian)

a=imread('cameraman.tif'); 
 subplot(1,3,1); imshow(a); title('imput image'); 
 b=edge(a,'canny'); 
subplot(1,3,2); imshow(b); title('canny'); 
 c=edge(a,'sobel'); 
subplot(1,3,3); imshow(c); title(sobel'); 
 
Contoh : 
 
 
 
FLIP
a = imread('Koala.jpg'); 
b = flipdim(a ,2);           %# horizontal flip 
c = flipdim(a ,1);           %# vertical flip 
d = flipdim(c,2);    %# horizontal+vertical flip 
  
subplot(2,2,1), imshow(a) 
subplot(2,2,2), imshow(b) 
subplot(2,2,3), imshow(c) 
subplot(2,2,4), imshow(d) 
 
Contoh : 
 
 
 

S-ar putea să vă placă și