Welcome to Raspberry Pi 4B repository
4.Picture Mirroring
Picture mirroring
There are two types of picture mirroring transformation: horizontal mirror image and vertical mirror image.
Horizontal mirroring uses the vertical center line of the picture as the axis to swap the pixels of the picture, that is, to swap the left half and the right half of the picture.
Vertical mirroring takes the horizontal center line of the image as the axis, and swaps the upper half of the image with the lower part.
Transformation principle:
Set the width of the image be width and the length be height. (x, y) is the transformed coordinates, (x0, y0) is the coordinates of the original picture.
Horizontal mirror transformation
Forward mapping
Inverse transformation
Backward mapping
Vertical mirror transformation
Inverse transformation
We take the vertical transformation as an example.
Code:
|
|
|
As shown below.