简体   繁体   English

实时视频稳定 OpenCV

[英]Real-Time video stabilization OpenCV

I've searched a function in OpenCV (cv::videostab), that would allow me to do video stabilization in Real-Time.我在 OpenCV (cv::videostab) 中搜索了一个函数,它可以让我实时进行视频稳定。 But as I understand in OpenCV this is not yet available.但据我所知,在 OpenCV 中,这尚不可用。 So TwoPassStabilizer(OnePassStabilizer) require a whole video at once and not two consecutive frames.所以TwoPassStabilizer(OnePassStabilizer)需要一次完整的视频而不是两个连续的帧。

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

So I have to do this without the OpenCV video stabilization class.所以我必须在没有 OpenCV 视频稳定类的情况下做到这一点。 This is true?这是真的?

OpenCV library does not provide exclusive code/module for real-time video stabilization. OpenCV 库不提供用于实时视频稳定的专用代码/模块。

Being said that, If you're using python code then you can use my powerful & threaded VidGear Video Processing python library that now provides real-time Video Stabilization with minimalistic latency and at the expense of little to no additional computational power requirement with Stabilizer Class .话虽如此,如果您使用的是 python 代码,那么您可以使用我强大且线程化的VidGear视频处理 python 库,该库现在提供具有最小延迟的实时视频稳定,并且稳定器类几乎不需要额外的计算能力要求. Here's a basic usage example for your convenience:为了您的方便,这是一个基本的使用示例:

# 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

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

We created a module for video stabilization by fixing a coordinate system.我们通过固定坐标系创建了一个视频稳定模块。 It's open-source.它是开源的。 https://github.com/RnD-Oxagile/EvenVizion https://github.com/RnD-Oxagile/EvenVizion

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

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