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

来源:互联网 发布:商之翼yii2源码 编辑:程序博客网 时间:2024/06/07 18:10

%不同插值法比较
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’);
处理结果:
这里写图片描述
当图像灰度有明显变化时,最邻近插值法的锯齿边较为明显,此时双线性插值法和三线性插值法能很好的保持图像的细节。相对于运算时间而言,三线性插值法花费的时间最长。

原创粉丝点击