How should I convertNDArray to a ndarray
I want to capture several frames in a video and convert them into images. I want to use cv2.imwrite to save my those images. But I got the following errors.
- img is not a numpy array, neither a scalar
- Expected Ptrcv::UMat for argument 'img'
and my code is like this
vr = VideoReader(video_path) fps = vr.get_avg_fps() frame_num = len(vr) duration = int(frame_num // fps) height, width, _ = vr[0].shape
print('fps', fps, 'frame_num', frame_num, 'duration', duration)
for i in range(len(vr)): # the video reader will handle seeking and skipping in the most efficient manner frame = vr[i] print(frame.shape) cv2.imwrite('test.jpg', frame)
breakpoint()
I need some support. Thanks a lot
vr[i].asnumpy()
# where i is an `int` or `slice`
I wonder why @zhreshold doesn't close solved issues like this. Amazon must be keeping him busy - Hey Joshua, your repo is popular! Please help your people out :D