简体   繁体   English

OpenCV:图像稳定

[英]OpenCV: image stabilization

I am attempting to post process a video in OpenCV. 我正在尝试在OpenCV中发布视频。 Since my camera is not fixed (must be mobile), the resulting video is very jittery due to vibrations and panning. 由于我的相机不是固定的(必须是可移动的),因此由于振动和摇摄而导致的视频非常抖动。 As such, every frame that I try to look at has blurs that will make my detection less accurate if it can even detect some of the blurry images. 因此,我尝试查看的每个帧都有模糊,即使它可以检测到某些模糊图像,也会使检测的准确性降低。

I've searched online and there seem to be a lot of discussion on compensating for the camera motion with gyroscopes. 我在网上搜索过,关于使用陀螺仪补偿摄像机运动似乎有很多讨论。

Are there any cameras that will help this out? 是否有任何相机可以帮助解决此问题? I've been using a GoPro. 我一直在使用GoPro。

Are there any algorithms that could help process the video? 是否有任何算法可以帮助处理视频?

I have no background in image stabilization and don't know where to start. 我没有图像稳定方面的背景,也不知道从哪里开始。 Would appreciate any recommendations. 将不胜感激任何建议。

Image stabilization algorithms usually works as follows: 图像稳定算法通常按以下方式工作:

  • Find the transformation from previous to current frame (often using optical flow for all frames). 查找从前一帧到当前帧的转换(通常对所有帧使用光流)。 The transformation consists of some parameters such as dx (movement along the horizontal direction), dy (vertical), da (rotation angle). 转换包含一些参数,例如dx (沿水平方向的移动), dy (垂直), da (旋转角度)。 Basically it is a rigid Euclidean transform, with no scaling and no sharing. 基本上,这是一个严格的欧几里德变换,没有缩放和共享。
  • Accumulate the transformations to get the “trajectory” for x, y, angle, at each frame. 累积变换以获得每个帧的x,y,角度的“轨迹”。
  • Smooth out the trajectory using a sliding average window. 使用滑动平均窗口平滑轨迹。 The user defines the window radius, where the radius is the number of frames used for smoothing. 用户定义窗口半径,其中半径是用于平滑的帧数。
  • Create a new transformation such that new_transformation = transformation + (smoothed_trajectory – trajectory) . 创建一个新的转换,使new_transformation = transformation + (smoothed_trajectory – trajectory)
  • Apply the new transformation to the image sequence 将新的变换应用于图像序列

Here you have two version of this idea: 在这里,您有两种想法:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM