內插是在放大、收縮、旋轉和幾何校正等任務中廣泛應用的基本工具。
最近鄰內插法(nearest): 原圖像中尋找最接近的像素,並把該像素的灰度賦給新像素。
雙線性內插法(bilinear):用4個最近鄰去估計給定位置的灰度。(最實用)
v(x, y) = ax + by + cxy + d;
v(x, y)灰度值; a,b,c,d通過四個最近鄰點求得。
雙三次內插法(bicubic):用16個最近鄰點賦予給定位置的灰度值.(商業圖像編輯程序的標准內插方法).(數字圖像處理(P37))
v(x, y) = ∑∑aijxiyj
v(x, y)灰度值; 0≤i≤3; 0≤j≤3; aij通過四個最近鄰點求得。
Matlab Keyword: imresize
code:
Image_original = imread('D:\圖像處理\image\rice1.jpg');
Image_shrink2_1 = imresize(Image_original,[128 128]);
Image_shrink2_2 = imresize(Image_original,0.5);
Image_enlarge2_nearest = imresize(Image_original,2,'nearest');
Image_enlarge2_bilinear = imresize(Image_original,2,'bilinear');
Image_enlarge2_bicubic = imresize(Image_original,2,'bicubic');
subplot(231)
imshow(Image_original)
title('Original')
subplot(232)
imshow(Image_shrink2_1)
title('Shrink 2 times_1')
subplot(233)
imshow(Image_shrink2_2)
title('Shrink 2 times_2')
subplot(234)
imshow(Image_enlarge2_nearest)
title('Enlarge 2 times.nearest')
subplot(235)
imshow(Image_enlarge2_bilinear)
title('Enlarge 2 times.bilinear')
subplot(236)
imshow(Image_enlarge2_bicubic)
title('Enlarge 2 times.bicubic')
處理結果:

相關鏈接:http://blog.csdn.net/zhengxiaoyang995926/article/details/79375254
