天天看点

图像旋转-不同插值法比较——MATLAB

%不同插值法比较

clear all;

img = imread(‘g0.jpg’);

rotateimg1=imrotate(img,30,’nearest’);%最邻近插值

rotateimg2=imrotate(img,-30,’bilinear’);%双线性插值

rotateimg3=imrotate(img,50,’bicubic’);%三次插值

subplot(2,2,1),imshow(img);

title(‘orginal’);

subplot(2,2,2),imshow(rotateimg1);

title(‘nearest’);

subplot(2,2,3),imshow(rotateimg2);

title(‘bilinear’);

subplot(2,2,4),imshow(rotateimg3);

title(‘bicubic’);

处理结果:

图像旋转-不同插值法比较——MATLAB

当图像灰度有明显变化时,最邻近插值法的锯齿边较为明显,此时双线性插值法和三线性插值法能很好的保持图像的细节。相对于运算时间而言,三线性插值法花费的时间最长。

继续阅读