I'm using zoul's solution to export UIImage array as a movie. But my frames all turns out distorted. Here's the original image:
Here's a similar distortion example:
I've read here that it has something to do with aspect ratio, but there's no explanation on how to fix it.
Image distortion is when the straight lines of an image appear to be deformed or curved unnaturally, creating different distortion types, including barrel, pincushion, and waveform. Distortion is often the result of the lens's geometrics and can significantly disrupt the image's quality.
The Lens Correction filter helps to counteract some of these imperfections.
As distortion is caused by the effects of perspective on the lens, the only way to correct for barrel lens distortion in-camera is to use a special "tilt and shift" lens, which is designed for architectural purposes. However, these lenses are costly, and only really make sense if you specialize in this field.
For those still doing the journey in 2020, and getting distortion in their movies because its not width 16px
change
CGContextRef context = CGBitmapContextCreate(pxdata,
width, height,
8, 4 * width,
rgbColorSpace,
kCGImageAlphaNoneSkipFirst);
to
CGContextRef context = CGBitmapContextCreate(pxdata,
width, height,
8, CVPixelBufferGetBytesPerRow(pxbuffer),
rgbColorSpace,
kCGImageAlphaNoneSkipFirst);
Credit to @Bluedays Output from AVAssetWriter (UIImages written to video) distorted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With