jgh- / VideoCore-Inactive

*No longer in development* Please see https://github.com/unpause-live/SwiftVideo
MIT License
1.48k stars 541 forks source link

Stabilization Filters #147

Open ashokrkm opened 9 years ago

ashokrkm commented 9 years ago

It will be great to have video/image stabilization filters that will help 'deshake' or stabilize videos - as most handheld mobile videos suffer from this problem. Thanks again for a great library!

JALsnipe commented 9 years ago

OpenCV != OpenGL Embedded Systems.

Sent from my iPhone

On May 26, 2015, at 12:39 AM, KCastiglione notifications@github.com wrote:

There is a filter here, that looks very promising: http://nghiaho.com/?p=2093

— Reply to this email directly or view it on GitHub.

markmark1 commented 9 years ago

Shouldn't use opencv it should use accelerometer and gyroscope readings to zoom and crop video as necessary

jgh- commented 9 years ago

AFAIK there is no synchronization between the gyro/accelerometer and the camera, it may be tough to get such a system working correctly. OpenCV may work better. There is, however, a setting to enable camera stabilization via AVCaptureConnection.preferredVideoStabilizationMode

markmark1 commented 9 years ago

http://instagram-engineering.tumblr.com/post/95922900787/hyperlapse Instagram s hyper lapse uses the gyroscope and accelerometer to measure how much the device has shaked during capture and uses it to compensate for the shake by adaptive cropping and zooming as needed ; this approach is a lot lighter than using image processing or dsp

markmark1 commented 9 years ago

http://stackoverflow.com/questions/26043995/ios-8-avfoundation-how-to-enable-video-stabilization-on-capable-devices

markmark1 commented 9 years ago

i added the following lines

if([conn respondsToSelector:@selector(setPreferredVideoStabilizationMode )])
    [conn setPreferredVideoStabilizationMode:AVCaptureVideoStabilizationModeAuto];

here https://github.com/jgh-/VideoCore/blob/master/sources/iOS/CameraSource.mm#L150

and it seemed to be worse in the iphone 5 and not so much better in the iphone 6 , i believe the instagram approach might work better ie use gyroscope and accelerometer to measure how much the device has shaked during capture and uses it to compensate for the shake by adaptive cropping and zooming as needed ; this approach is a lot lighter than using image processing or dsp