公式
设图像的高度为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=height−y0+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);