How should I convertNDArray to a ndarray
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
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 Ptr 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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.