基于Matlab的图像几何变换实现

1、实现内容:图像旋转45度,向左偏移10像素,按照0.5比例进行缩放

2、Matlab编码实现

  1. 2.1、图像读取
  2. % 加载本地图片
    clc;
    clear all;
    figure;
    img = imread('C:\Temp\2012_004319.jpg');
    imshow(img);
    title('原图');

     2.2、图像旋转45度

% 图片旋转45°
img1 = imrotate(img,45,'bilinear','crop');
figure;
imshow(img1);
title('旋转45°后的图像');

  1. 2.3、向左偏移10像素
% 向左平移10像素
img2 = imtranslate(img,[-10,0]);
figure;
imshow(img2);
title('向左平移10像素后的图像');

  1. 2.4、按照0.5比例进行缩放
% 缩小到原来的0.5倍
img3 = imresize(img,0.5);
figure;
imshow(img3);
title('缩小0.5倍后的图像');

猜你喜欢

转载自blog.csdn.net/z1099043492/article/details/127110914