pytorch-yolo-v3 icon indicating copy to clipboard operation
pytorch-yolo-v3 copied to clipboard

how to save detected video

Open deep0learning opened this issue 6 years ago • 2 comments
trafficstars

Hi,

How can I save the detected video? Thanks in advance.

deep0learning avatar Aug 07 '19 10:08 deep0learning

you can check VideoWriter: from cv2 import VideoWriter, VideoWriter_fourcc

Initialize video

w, h, fps = (1280, 720, 30)
fourcc = VideoWriter_fourcc(*'H264') 
self.video = VideoWriter('./test_video.mp4', fourcc, fps, (w, h))

you can save frame to frame where image_np is an numpy image of shape (h, w, 3) video.write(image_np)

and then release video.release()

cartovarc avatar Sep 03 '19 14:09 cartovarc

you can check VideoWriter: from cv2 import VideoWriter, VideoWriter_fourcc

Initialize video

w, h, fps = (1280, 720, 30)
fourcc = VideoWriter_fourcc(*'H264') 
self.video = VideoWriter('./test_video.mp4', fourcc, fps, (w, h))

you can save frame to frame where image_np is an numpy image of shape (h, w, 3) video.write(image_np)

and then release video.release()

Where do I put this code?

airqualityanthony avatar Nov 11 '19 20:11 airqualityanthony