Minggu, 06 Desember 2009

MATRIKS

c=imread('reita.jpg');
asci=uint8(c)
asci(:,:,1)

LAPLACIAN

l2_1=fft(double(l));
figure(1)
clf(subplot(3,2,1),imshow(l));
title('Original image');
hold on;
subplot(3,2,2),imshow(l1);
title('Gray scale image ');

% creat filter matrix(3x3 window)
h=fspecial('prewitt');
l_pre=uint8(round(filter2(h,l1)));
l_pre_1=fft(double(l_pre));
subplot(3,2,3),imshow(l_pre)
title('Prewitt filtered image');

% creat filter matrix(3x3 window)
h=fspecial('sobel');
l_sobel=uint8(round(filter2(h,l1)));
l_sobel_1=fft(double(l_sobel));
subplot(3,2,4),imshow(l_sobel)
title('Sobel filtered image');

h=fspecial('log',5);
l_log=uint8(round(filter2(h,l1)));
l_log_1=fft(double(l_log));
subplot(3,2,5),imshow(l_log)
title('5x5 Laplacian of Guassian Filtered Image');

h=fspecial('log',3);
l_log3=uint8(round(filter2(h,l1)));
l_log3_1=fft(double(l_log3));
subplot(3,2,6),imshow(l_log3)
title('3x3 Laplacian of Guassian Filtered Image');

%suitable images are TIFF images ,png,jpgonly bmp is not suitable.
figure(2)
subplot(3,2,1),imshow(l2);
subplot(3,2,2),imshow(l2);
subplot(3,2,3),imshow(l_pre_1);
subplot(3,2,4),imshow(l_sobel_1);
subplot(3,2,5),imshow(l_log_1);
subplot(3,2,6),imshow(l_log3_1);

Minggu, 29 November 2009

MATLAB Putri 4ia03

Histogram

gambar=imread(‘gambarkoe.jpg’); %--------membaca file gambar
red=gambar(:,:,1); %memanggil matriks gambar yang hanya berisi piksel warna merah
green=gambar(:,:,2);% memanggil matriks gambar yang hanya berisi pikselwarna merah
blue=gambar(:,:,3); %memanggil matriks gambar yang hanya berisi pikselwarna merah
merahgray2=0.3*red+0.5*green+0.2*blue ;
imhist(red)
imhist(green)
imhist(blue)
imhist(gray)



Rgb2gray Histogram


[nama_file1,nama_path1]=
uigetfile(... {’*.bmp;*.jpg
’,’File Citra
(*.bmp,*.jpg)’;
’*.bmp’,’ File Bitmap
(*.bmp)’; ... ’*.jpg’,’File jpeg (*.jpg)’; ’*.*’,’
Semua File (*.*)’},...
’Buka File Citra
Host/Asli’); if ˜isequal(nama_file1,0)
handles.citra1=imread
(fullfile(nama_path1,nama_file1));
x=rgb2gray(handles.citra1);
guidata(hObject,handles); hold on;
axes(handles.sb_citra_asli);
imshow(x); hold on;
axes(handles.sb_hist_asli);
imhist(x); else
return; end set(handles.text9,
’string’ ,nama_file1);
set(handles.text10,’string’ ,
size(handles.citra1,1));
set(handles.text12,’string’ ,
size(handles.citra1,2));
x=rgb2gray(handles.citra1);
handles.citra2=histeq(x);
guidata(hObject,handles);
hold on;
axes(handles.sb_citra_perataan);
imshow(handles.citra2); hold on;
axes(handles.sb_hist_perataan);
imhist(handles.citra2);

RGB Histogram


uigetfile(...
{’*.bmp;*.jpg’,’File Citra
(*.bmp,*.jpg)’;
’*.bmp’,’File Bitmap
(*.bmp)’; ... ’*.jpg’,’File
jpeg (*.jpg)’;
’*.*’,’Semua File (*.*)’},...
’Buka File Citra
Host/Asli’);
if ˜isequal(nama_file1, 0)
handles.citra1=
imread(fullfile
(nama_path1,nama_file1));
[x,map]=rgb2ind(handles.citra1,256);
guidata(hObject,handles);
hold on; axes(handles.sb_citra_asli);
imshow(handles.citra1);
R=handles.citra1(:,:,1);
hold on;
axes(handles.sb_hist_red);
imhist(R); G=handles.citra1(:,:,2);
hold on;
axes(handles.sb_hist_green);
imhist(G);
B=handles.citra1(:,:,3);
hold on; axes(handles.sb_hist_blue);
imhist(B);
else return; end
set(handles.text10,’string’,nama_file1);
set(handles.text12,’string’
,size(handles.citra1,1));
set(handles.text14,’string’
,size(handles.citra1,2));