【问题标题】:Real-Time video stabilization OpenCV实时视频稳定 OpenCV
【发布时间】:2018-08-22 15:18:49
【问题描述】:

我在 OpenCV (cv::videostab) 中搜索了一个函数,它可以让我实时进行视频稳定。但正如我在 OpenCV 中所了解的那样,这还不可用。所以 TwoPassStabilizer(OnePassStabilizer) 需要一次完整的视频,而不是两个连续的帧。

Ptr<VideoFileSource> source = makePtr<VideoFileSource>(inputPath); //it's whole video
TwoPassStabilizer *twopassStabilizer = new TwoPassStabilizer();
twoPassStabilizer->setFrameSource(source); 

所以我必须在没有 OpenCV 视频稳定类的情况下执行此操作。这是真的吗?

【问题讨论】:

    标签: python opencv video-processing image-stabilization


    【解决方案1】:

    OpenCV 库不提供用于实时视频稳定的专有代码/模块。

    话虽如此,如果您使用的是 Python 代码,那么您可以使用我强大的线程化 VidGear 视频处理 Python 库,该库现在提供实时视频稳定,延迟极低,而且几乎不需要额外的计算Stabilizer Class 的电源要求。为方便起见,这里有一个基本用法示例:

    # import libraries
    from vidgear.gears import VideoGear
    from vidgear.gears import WriteGear
    import cv2
    
    stream = VideoGear(source=0, stabilize = True).start() # To open any valid video stream(for e.g device at 0 index)
    
    # infinite loop
    while True:
    
        frame = stream.read()
        # read stabilized frames
    
        # check if frame is None
        if frame is None:
            #if True break the infinite loop
            break
    
        # do something with stabilized frame here
    
        cv2.imshow("Stabilized Frame", frame)
        # Show output window
    
        key = cv2.waitKey(1) & 0xFF
        # check for 'q' key-press
        if key == ord("q"):
            #if 'q' key-pressed break out
            break
    
    cv2.destroyAllWindows()
    # close output window
    
    stream.stop()
    # safely close video stream
    

    更高级的用法可以在这里找到:https://github.com/abhiTronix/vidgear/wiki/Real-time-Video-Stabilization#real-time-video-stabilization-with-vidgear

    【讨论】:

      【解决方案2】:

      我们通过固定坐标系创建了一个视频稳定模块。它是开源的。 https://github.com/RnD-Oxagile/EvenVizion

      【讨论】:

      • 虽然理论上这可以回答这个问题,it would be preferable 在这里包含答案的基本部分,并提供链接以供参考。
      猜你喜欢
      • 1970-01-01
      • 2017-04-27
      • 2016-05-10
      • 1970-01-01
      • 2011-03-26
      • 2021-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多