簡體   English   中英

我想將列表中的幀另存為視頻

[英]I want to save the frames from the list as a video

實際上,每當檢測到運動並且運動對象的大小超過500時,我便將所有這些幀附加到列表中。 以后我只想將那些幀保存為單個視頻。 任何人都可以通過一些代碼來建議如何做到這一點。

frames = []
fourcc = cv2.VideoWriter_fourcc(*'XVID')

for c in cnts:
    area = cv2.contourArea(c)
    if area >=500:
        frames.append(frame)

我檢查了這篇文章的第一個答案,似乎類似的東西應該起作用。

frames = []
# change the resolution with the desired resolution
out = cv2.VideoWriter('output.avi', -1, 20.0, (640,480))

for c in cnts:
    area = cv2.contourArea(c)
    if area >=500:
        frames.append(frame)
        out.write(frame)

out.release()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM