MATLAB实现图像镜像变换的源代码!

    xiaoxiao2021-12-14  17

    转自http://blog.csdn.net/wenhao_ir/article/details/51406150

    还是直接上源码和运行结果吧!

    [plain] view plain copy print ? clear all;    close all;    clc;    A=imread('pout_gray.png');    [height,width,dim]=size(A);  tform=maketform('affine',[-1 0 0;0 1 0;width 0 1]);  B=imtransform(A,tform,'nearest');%B中存储的是经过水平镜像变换后的图像  tform2=maketform('affine',[1 0 0;0 -1 0;0 height 1]);  C=imtransform(A,tform2,'nearest');%C中存储的是经过竖直镜像变换后的图像  subplot(1,3,1),imshow(A);  title('原图像');  subplot(1,3,2),imshow(B);  title('水平镜像');  subplot(1,3,3),imshow(C);  title('坚直镜像');   clear all; close all; clc; A=imread('pout_gray.png'); [height,width,dim]=size(A); tform=maketform('affine',[-1 0 0;0 1 0;width 0 1]); B=imtransform(A,tform,'nearest');%B中存储的是经过水平镜像变换后的图像 tform2=maketform('affine',[1 0 0;0 -1 0;0 height 1]); C=imtransform(A,tform2,'nearest');%C中存储的是经过竖直镜像变换后的图像 subplot(1,3,1),imshow(A); title('原图像'); subplot(1,3,2),imshow(B); title('水平镜像'); subplot(1,3,3),imshow(C); title('坚直镜像');

    -------------------------------------------

    欢迎大家加入图像识别技术交流群:271891601,另外,特别欢迎成都从事图像识别工作的朋友交流,我的QQ号2487872782

    转载请注明原文地址: https://ju.6miu.com/read-969566.html

    最新回复(0)