Mirror/Symmetry effect on video using OpenCV

539 views Asked by At

I want to create a basic video editing application where the user can import video clips and then use symmetry (vertical or horizontal) and offsets on their videos. How feasible is this?

For instance, consider the following image:

enter image description here

Right-symmetry:

enter image description here

Image offset to the top-left:

enter image description here

If that last image is confusing, basically you can think of it as the images repeating one next to the the other in a grid, infinitely, such that they're symmetric. Then, you can select a window of this grid equal to the size of the original image. Eg. the red square represents the window:

enter image description here

2

There are 2 answers

0
joostblack On

This is very feasible. Opencv can do all of this frame by frame. Although it would probably take sometime for high quality/long videos. If you want to know how to do these operations, I would open seperate questions. mirroring can for example be done by cv2.flip().

1
Michele Dutto On

You can use the .flip () method present in the cv2 library. First enter the image with cv2.imread (path). Then to make the mirror effect you have to create a insert cv2.flip (image, 0). Just as reported below:

image = cv2.imread(path) 
mirrow = cv2.flip(image, 0)