0
点赞
收藏
分享

微信扫一扫

Matlab底层算法实现图像垂直镜像

沈芏 2022-03-20 阅读 34

公式

设图像的高度为height,则垂直镜像变换的映射关系为:
                                                                { x = x 0 y = h e i g h t − y 0 + 1 \left\{\begin{matrix} x=x_{0}\\ y=height-y_{0}+1 \end{matrix}\right. {x=x0y=heighty0+1

源代码

clc
image = imread('D:\2.png');
image_matrix=image(:,:,1);
image_matrix=double(image_matrix);
[height,width,channels]=size(image);
G=zeros(height,width);
for i=1:height
    for j=1:width
       G(i,j)=image_matrix(height-i+1,j);
    end
end
image_out = uint8(G);
%显示
subplot(1,2,1);
imshow(image);
subplot(1,2,2);
imshow(image_out);

效果图

在这里插入图片描述

举报

相关推荐

0 条评论