ayooshkathuria / pytorch-yolo-v3

A PyTorch implementation of the YOLO v3 object detection algorithm
3.3k stars 1.06k forks source link

how to save detected video #114

Open deep0learning opened 5 years ago

deep0learning commented 5 years ago

Hi,

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

cartovarc commented 5 years ago

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()

airqualityanthony commented 5 years ago

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?