當前位置:首頁 » 操作系統 » matlab圖像放大演算法

matlab圖像放大演算法

發布時間: 2023-05-31 12:17:50

❶ 如何用MATLAB對圖片進行縮放

MATLAB是美國MathWorks公司出品的商業數學軟體,用於演算法開發、數據可視化、數據分析以及數值計算的高級技術計算語言和互動式環境。

MATLAB和Mathematica、Maple並稱為三大數學軟體。它在數學類科技應用軟體培改中在數值計算方面首屈一指。無論是做項目還是寫論文,我們都會遇到把Matlab畫配拆判的圖形(默認為matlab自帶的圖像格式.fig)轉換為其他格式並導出的問題。

用的最多的圖片格式是eps格式(用latex編輯時用)和jpg(用word編輯時用)。御陵下面以matlab 2011b為例介紹多種縮放方法。

❷ 如何使用matlab的圖像放大功能

這是我做的一個很簡單的模擬的結果圖。

❸ 如何用matlab進行圖像拉伸

B=imresize(A,scale)

B=imresize(A,[mrowsncols])

B就是圖像A的拉伸或壓縮結果。

如果第二個輸入參數是1個標量值scale,圖像將保持縱橫比,

那麼當0<scale<1的時候B是A的縮小結果,如果scale>1,B是A的放大結果,

如果第二個輸入參量是一個想二元向量,

那麼說出的B的像素大小由[mrowsncols]決定,圖像不一定保持縱橫比。

❹ 怎樣對matlab做出的圖像橫向放大

在選擇團攜放大鏡之後在圖像上右鍵點擊出菜單~然後Zoom Options~Horizontal Zoom(2D-plot only)就可以只橫塌納伏向放大茄晌了~

❺ matlab 如何將圖像縮放到指定像素大小的函數

1、首先打開電腦,然後在電腦中找到並打開matlab軟體弊沖主界面,如圖所示。

❻ 如何用MATLAB編寫一個雙線性插值的演算法,用來放大縮小圖象

%% 4.圖像的縮放

% 思路:雙線性插值
kV = 0.5; % 垂直縮放系數
kH = 0.5; % 水平縮放系數

% 讀入圖像
I = imread('D:\lena.bmp'); % 注意修改文件路徑
II = double(I);

[m, n, r]=size(II);
OI=zeros(m*kV,n*kH, r);
rot=[kV 0 0;0 kH 0;0 0 1]; % 變換矩陣

for k=1:r
for i=1:m*kV
for j=1:n*kH
pix=[i j 1]/rot;
Y =pix(1)-floor(pix(1));
X =pix(2)-floor(pix(2));
% 邊界處理
if pix(1) < 1
pix(1) = 1;
end
if pix(1) > m
pix(1) = m;
end
if pix(2) < 1
pix(2) = 1;
end
if pix(2) > n
pix(2) =n;
end
% 四個鄰點
pix1 = [floor(pix(1))floor(pix(2))];
pix2 = [floor(pix(1))ceil(pix(2))];
pix3 = [ceil(pix(1))floor(pix(2))];
pix4 = [ceil(pix(1))ceil(pix(2))];
% 計算臨近四個點的權重
w1 = (1-X)*(1-Y);
w2 = X*(1-Y);
w3 = (1-X)*Y;
w4 = X*Y;
% 按權重進行雙線性插值
OI(i,j,k)=...
w1*II(pix1(1),pix1(2),k)+ ...
w2*II(pix2(1),pix2(2),k)+ ...
w3*II(pix3(1),pix3(2),k)+ ...
w4*II(pix4(1),pix4(2),k);
end
end
end
figure, imshow(uint8(II)), title('原圖')
figure, imshow(uint8(OI)), title('縮放後')

❼ 怎樣在matlab 中的圖像大小

如果是matlab輸出設置圖片大小,步驟如下:

  1. 輸入圖片讀入代碼:敬慧

*******************************

clear all;

clc;

I=imread('E:Matlab2010imageobject.jpg'); %圖片的讀入,路徑由圖片位置確定

figure;imshow(I);

***************************************

2.點擊F5運行,然後會輸出一個圖像,在左上角菜單欄找到File>>ExportSetup會彈出一個對話框

❽ 跪求matlab程序:用插值演算法的 雙線性插值演算法 與 雙三次插值演算法 進行圖像放大 放大四倍

雙線性插灶賣虧值
A=imread('');
B=imresize(A,4,'bilinear');
imshow(B);
雙三次插值
A=imread('');
B=imresize(A,4,'隱神bicubic'配殲);
imshow(B);

❾ matlab中用imshow顯示16*16矩陣圖像,怎麼樣把圖顯示得大一些,如何設置

解決方法:
imshow(I/256); -----------將圖像矩陣轉化到0-1之間;
imshow(I,[]); -----------自動調整數據的范圍以便於顯示;
imshow(A,'InitialMagnification','fit')。

matlab簡介:
MATLAB是美國MathWorks公司出品的商業數學軟體,用於演算法開發、數據可視化、數據分核慶敗析以及數值計算的高級技術計算語言和互動式環境,主要包括MATLAB和Simulink兩大部分。
MATLAB是matrix&laboratory兩個詞的組合,意為矩陣工廠(矩陣實驗室)。是由美國mathworks公司發布的主要面對科學計算、可視化以及互動式程序設計的高科技計算環境。它將數值分析、矩陣計算、科學數據可視化以及非線性動態系統的建模和模擬等諸多強大功能集成在一個易於差段使用的視窗環境中,為科學研究、工程設計以及必須進行有效數值計算的眾多科學領域提供了一種全面的解決方案,並在很大程度上擺脫了傳統非互動式程序設計語言(如C、Fortran)的編輯模改顫式,代表了當今國際科學計算軟體的先進水平。

❿ matlab 調用圖像放大命令

Matlab圖像處理函數 匯總1
1.applylut

功能:

在二進制圖像中利用lookup表進行邊沿操作.

語法:

A = applylut(BW,lut)

舉例

lut = makelut('sum(x(:)) == 4',2);

BW1 = imread('text.tif');

BW2 = applylut(BW1,lut);

imshow(BW1)

figure, imshow(BW2)

相關命令:

makelut

2.bestblk

功能:

確定進行塊操作的塊大小.

語法:

siz = bestblk([m n],k)

[mb,nb] = bestblk([m n],k)

舉例

siz = bestblk([640 800],72)

siz =

64 50

相關命令:

blkproc

3.blkproc

功能:

MATLAB高級應用——圖形及影像處螞李理 320

實現圖像的顯式塊操作.

語法:

B = blkproc(A,[m n],fun)

B = blkproc(A,[m n],fun,P1,P2,...)

B = blkproc(A,[m n],[mborder nborder],fun,...)

B = blkproc(A,'indexed',...)

舉例

I = imread('alumgrns.tif');

I2 = blkproc(I,[8 8],'std2(x)*ones(size(x))');

imshow(I)

figure, imshow(I2,[]);

相關命令:

colfilt, nlfilter,inline

4.brighten

功能:

增加或降低顏色映像表的亮度.

語法:

brighten(beta)

newmap = brighten(beta)

newmap = brighten(map,beta)

brighten(fig,beta)

相關命令:

imadjust, rgbplot

5.bwarea

功能:

計算二進制圖像對象的面積.

語法:

total = bwarea(BW)

舉例

BW = imread('行謹circles.tif');

imshow(BW);

附錄 MATLAB圖像處理命令 321

bwarea(BW)

ans =

15799

相關命令:

bweuler, bwperim

6.bweuler.

功能:

計算二進制圖像的歐拉數.

語法:

eul = bweuler(BW,n)

舉例

BW = imread('circles.tif'檔物基);

imshow(BW);

bweuler(BW)

ans =

-2

相關命令:

bwmorph, bwperim

7.bwfill

功能:

填充二進制圖像的背景色.

語法:

BW2 = bwfill(BW1,c,r,n)

BW2 = bwfill(BW1,n)

[BW2,idx] = bwfill(...)

BW2 = bwfill(x,y,BW1,xi,yi,n)

[x,y,BW2,idx,xi,yi] = bwfill(...)

BW2 = bwfill(BW1,'holes',n)

[BW2,idx] = bwfill(BW1,'holes',n)

舉例

MATLAB高級應用——圖形及影像處理 322

BW1 =[1 0 0 0 0 0 0 0

1 1 1 1 1 0 0 0

1 0 0 0 1 0 1 0

1 0 0 0 1 1 1 0

1 1 1 1 0 1 1 1

1 0 0 1 1 0 1 0

1 0 0 0 1 0 1 0

1 0 0 0 1 1 1 0]

BW2 = bwfill(BW1,3,3,8)

BW2 =

1 0 0 0 0 0 0 0

1 1 1 1 1 0 0 0

1 1 1 1 1 0 1 0

1 1 1 1 1 1 1 0

1 1 1 1 0 1 1 1

1 0 0 1 1 0 1 0

1 0 0 0 1 0 1 0

1 0 0 0 1 1 1 0

I = imread('blood1.tif');

BW3 = ~im2bw(I);

BW4 = bwfill(BW3,'holes');

imshow(BW3)

figure, imshow(BW4)

相關命令:

bwselect, roifill

8.bwlabel

功能:

標注二進制圖像中已連接的部分.

語法:

附錄 MATLAB圖像處理命令 323

L = bwlabel(BW,n)

[L,num] = bwlabel(BW,n)

舉例

BW = [1 1 1 0 0 0 0 0

1 1 1 0 1 1 0 0

1 1 1 0 1 1 0 0

1 1 1 0 0 0 1 0

1 1 1 0 0 0 1 0

1 1 1 0 0 0 1 0

1 1 1 0 0 1 1 0

1 1 1 0 0 0 0 0]

L = bwlabel(BW,4)

L =

1 1 1 0 0 0 0 0

1 1 1 0 2 2 0 0

1 1 1 0 2 2 0 0

1 1 1 0 0 0 3 0

1 1 1 0 0 0 3 0

1 1 1 0 0 0 3 0

1 1 1 0 0 3 3 0

1 1 1 0 0 0 0 0

[r,c] = find(L==2);

rc = [r c]

rc =

2 5

3 5

2 6

3 6

相關命令:

bweuler, bwselect

9.bwmorph

功能:

提取二進制圖像的輪廓.

語法:

BW2 = bwmorph(BW1,operation)

BW2 = bwmorph(BW1,operation,n)

舉例

BW1 = imread('circles.tif');

MATLAB高級應用——圖形及影像處理 324

imshow(BW1);

BW2 = bwmorph(BW1,'remove');

BW3 = bwmorph(BW1,'skel',Inf);

imshow(BW2)

figure, imshow(BW3)

相關命令:

bweuler, bwperim, dilate, erode

10.bwperim

功能:

計算二進制圖像中對象的周長.

語法:

BW2 = bwperim(BW1,n)

舉例

BW1 = imread('circbw.tif');

BW2 = bwperim(BW1,8);

imshow(BW1)

figure, imshow(BW2)

附錄 MATLAB圖像處理命令 325

相關命令:

bwarea, bweuler, bwfill

11.bwselect

功能:

在二進制圖像中選擇對象.

語法:

BW2 = bwselect(BW1,c,r,n)

BW2 = bwselect(BW1,n)

[BW2,idx] = bwselect(...)

舉例

BW1 = imread('text.tif');

c = [16 90 144];

r = [85 197 247];

BW2 = bwselect(BW1,c,r,4);

imshow(BW1)

figure, imshow(BW2)

相關命令:

bwfill, bwlabel, impixel, roipoly, roifill

12.cmpermute

MATLAB高級應用——圖形及影像處理 326

功能:

調整顏色映像表中的顏色.

語法:

[Y,newmap] = cmpermute(X,map)

[Y,newmap] = cmpermute(X,map,index)

舉例

To order a colormap by luminance, use:

ntsc = rgb2ntsc(map);

[m,index] = sort(ntsc(:,1));

[Y,newmap] = cmpermute(X,map,index);

相關命令:

randperm

13.cmunique

功能:

查找顏色映像表中特定的顏色及相應的圖像.

語法:

[Y,newmap] = cmunique(X,map)

[Y,newmap] = cmunique(RGB)

[Y,newmap] = cmunique(I)

相關命令:

gray2ind, rgb2ind

14.col2im

功能:

將矩陣的列重新組織到塊中.

語法:

A = col2im(B,[m n],[mm nn],block_type)

A = col2im(B,[m n],[mm nn])

相關命令:

blkproc, colfilt, im2col, nlfilter

15.colfilt

功能:

利用列相關函數進行邊沿操作.

語法:

B = colfilt(A,[m n],block_type,fun)

B = colfilt(A,[m n],block_type,fun,P1,P2,...)

B = colfilt(A,[m n],[mblock nblock],block_type,fun,...)

B = colfilt(A,'indexed',...)

附錄 MATLAB圖像處理命令 327

相關命令:

blkproc, col2im, im2col, nlfilter

16.colorbar

功能:

顯示顏色條.

語法:

colorbar('vert')

colorbar('horiz')

colorbar(h)

colorbar

h = colorbar(...)

舉例

I = imread('blood1.tif');

h = fspecial('log');

I2 = filter2(h,I);

imshow(I2,[]), colormap(jet(64)), colorbar

17.conv2

功能:

進行二維卷積操作.

語法:

C = conv2(A,B)

C = conv2(hcol,hrow,A)

C = conv2(...,shape)

舉例

A = magic(5)

A =

17 24 1 8 15

23 5 7 14 16

4 6 13 20 22

MATLAB高級應用——圖形及影像處理 328

10 12 19 21 3

11 18 25 2 9

B = [1 2 1;0 2 0;3 1 3]

B =

1 2 1

0 2 0

3 1 3

C = conv2(A,B)

C =

17 58 66 34 32 38 15

23 85 88 35 67 76 16

55 149 117 163 159 135 67

79 78 160 161 187 129 51

23 82 153 199 205 108 75

30 68 135 168 91 84 9

33 65 126 85 104 15 27

相關命令:

filter2

18.convmtx2

功能:

計算二維卷積矩陣.

語法:

T = convmtx2(H,m,n)

T = convmtx2(H,[m n])

相關命令:

conv2

19.convn

功能: 計算n維卷積.

語法:

C = convn(A,B)

C = convn(A,B,shape)

相關命令:

conv2

20.corr2

功能:

計算兩個矩陣的二維相關系數.

附錄 MATLAB圖像處理命令 329

語法:

r = corr2(A,B)

相關命令:

std2

21.dct2

功能:

進行二維離散餘弦變換.

語法:

B = dct2(A)

B = dct2(A,m,n)

B = dct2(A,[m n])

舉例

RGB = imread('autumn.tif');

I = rgb2gray(RGB);

J = dct2(I);

imshow(log(abs(J)),[]), colormap(jet(64)), colorbar

J(abs(J) < 10) = 0;

K = idct2(J)/255;

imshow(K)

相關命令:

fft2, idct2, ifft2

22.dctmtx

功能:

MATLAB高級應用——圖形及影像處理 330

計算離散餘弦變換矩陣.

語法:

D = dctmtx(n)

相關命令:

dct2

23.dilate

功能:

放大二進制圖像.

語法:

BW2 = dilate(BW1,SE)

BW2 = dilate(BW1,SE,alg)

BW2 = dilate(BW1,SE,...,n)

舉例

BW1 = imread('text.tif');

SE = ones(6,2);

BW2 = dilate(BW1,SE);

imshow(BW1)

figure, imshow(BW2)

相關命令:

bwmorph, erode

24.dither

功能:

通過抖動增加外觀顏色解析度,轉換圖像.

語法:

X = dither(RGB,map)

BW = dither(I)

相關命令:

rgb2ind

25.double

附錄 MATLAB圖像處理命令 331

功能:

轉換數據為雙精度型.

語法:

B = double(A)

舉例

A = imread('saturn.tif');

B = sqrt(double(A));

相關命令:

im2double, im2uint, uint8

26.edge

功能:

識別強度圖像中的邊界.

語法:

BW = edge(I,'sobel')

BW = edge(I,'sobel',thresh)

BW = edge(I,'sobel',thresh,direction)

[BW,thresh] = edge(I,'sobel',...)

BW = edge(I,'prewitt')

BW = edge(I,'prewitt',thresh)

BW = edge(I,'prewitt',thresh,direction)

[BW,thresh] = edge(I,'prewitt',...)

BW = edge(I,'roberts')

BW = edge(I,'roberts',thresh)

[BW,thresh] = edge(I,'roberts',...)

BW = edge(I,'log')

BW = edge(I,'log',thresh)

BW = edge(I,'log',thresh,sigma)

[BW,threshold] = edge(I,'log',...)

BW = edge(I,'zerocross',thresh,h)

[BW,thresh] = edge(I,'zerocross',...)

BW = edge(I,'canny')

BW = edge(I,'canny',thresh)

BW = edge(I,'canny',thresh,sigma)

MATLAB高級應用——圖形及影像處理 332

[BW,threshold] = edge(I,'canny',...)

舉例

I = imread('rice.tif');

BW1 = edge(I,'prewitt');

BW2 = edge(I,'canny');

imshow(BW1);

figure, imshow(BW2)

27.erode

功能:

弱化二進制圖像的邊界.

語法:

BW2 = erode(BW1,SE)

BW2 = erode(BW1,SE,alg)

BW2 = erode(BW1,SE,...,n)

舉例

BW1 = imread('text.tif');

SE = ones(3,1);

BW2 = erode(BW1,SE);

imshow(BW1)

figure, imshow(BW2)

相關命令:

bwmorph, dilate

附錄 MATLAB圖像處理命令 333

28.fft2

功能:

進行二維快速傅里葉變換.

語法:

B = fft2(A)

B = fft2(A,m,n)

舉例

load imdemos saturn2

imshow(saturn2)

B = fftshift(fft2(saturn2));

imshow(log(abs(B)),[]), colormap(jet(64)), colorbar

相關命令:

dct2, fftshift, idct2, ifft2

熱點內容
scratch少兒編程課程 發布:2025-04-16 17:11:44 瀏覽:640
榮耀x10從哪裡設置密碼 發布:2025-04-16 17:11:43 瀏覽:368
java從入門到精通視頻 發布:2025-04-16 17:11:43 瀏覽:86
php微信介面教程 發布:2025-04-16 17:07:30 瀏覽:310
android實現陰影 發布:2025-04-16 16:50:08 瀏覽:794
粉筆直播課緩存 發布:2025-04-16 16:31:21 瀏覽:346
機頂盒都有什麼配置 發布:2025-04-16 16:24:37 瀏覽:213
編寫手游反編譯都需要學習什麼 發布:2025-04-16 16:19:36 瀏覽:816
proteus編譯文件位置 發布:2025-04-16 16:18:44 瀏覽:367
土壓縮的本質 發布:2025-04-16 16:13:21 瀏覽:594