嗚嗚喔學習筆記: MATLAB-(讀圖 放大縮小 混色 補色)

搜尋此網誌

顯示具有 MATLAB-(讀圖 放大縮小 混色 補色) 標籤的文章。 顯示所有文章
顯示具有 MATLAB-(讀圖 放大縮小 混色 補色) 標籤的文章。 顯示所有文章

2013年10月4日 星期五

MATLAB初體驗(讀圖 放大縮小 混色 補色)





執行方法:





1.程式碼(讀圖):

clear all; clc;%清空%
filepath=['C:\Users\student\Desktop\caribou'] %圖片路徑%
c=imread(filepath,'tiff');%tiff = 副檔名%
imshow(c);%Show出圖片%



2.程式碼(放大縮小):

clear all; clc;
filepath=['C:\Users\student\Desktop\caribou'] %路徑%
x=imread(filepath,'tiff');%副檔名%

x2=imresize(imresize(x,1/2),2);%變 1/2 倍 在變2倍 會模糊圖片%
figure(3),imshow(x2);%輸出figure(3)->x2%

x3=imresize(imresize(x,1/16),16);
figure(4),imshow(x3);




3.程式碼(混色):

clear all; clc;
filepath=['C:\Users\student\Desktop\caribou'] %路徑%
x=imread(filepath,'tiff');%副檔名%
x=double(x);
D=[0 128; 192 64];
r=repmat(D,128,128);
x2=x>r;
imshow(x2);




4.程式碼(補色):
clear all; clc;
filepath=['C:\Users\student\Desktop\caribou'
b=imread(filepath,'tiff');

figure(1),imshow(b);
bc=imcomplement(b);%補色%
figure(2),imshow(bc);