perspective-animation-ios
perspective-animation-ios copied to clipboard
Example of perspective photo animation from camera
📱 Perspective Animation
Example of perspective animation of a photo.
This is an implementation of how to detect a rectangle from a camera and animate a perspective.
Used frameworks
-
AVFoundation
for taking a photo. -
Vision
for on the fly rectangle detection from the camera. -
CoreImage
for filtering image.
Algorithm
- Launch a camera and observe output for rectangles.
- When a rectangle is detected, show it at the UI.
- Take a picture and apply a perspective correction filter to get the resulting image.
- Calculate the 4x4 transform matrix to animate from the initial image to the resulting image.
Implementation is simplified for clarity.
See also
Special thanks
- Alexander Khlebnikov for rectangle detection.
- Paul Zabelin for transform matrix calculator.
- Anton Glezman for the article resource.