Utils for Computer Vision
Project description
rutils
Utils for computer vision
Modules
Common
str2path
from argparse import ArgumentParser
from rutils.common import str2path
opt_parser = ArgumentParser()
opt_parser.add_argument('--txt_path', type=str2path)
opt = opt_parser.parse_args()
print(type(opt.txt_path))
Video
Read video
video_path = Path('./test.mp4')
video_reader = rutils.video.VideoReader(in_video_path=video_path)
print(video_reader.num_frame)
for _ in range(num_frame):
frame = video_reader.get_next_frame()
Write video
Support two method:
- Use OpenCV
video_writer = rutils.video.VideoWriter(
out_path,
video_w,
video_h,
fps=25,
encoding='H264',
video_bitrate='11M',
mode='opencv'
)
video_writer.write_frame(frame)
video_writer.release()
- Use FFMpeg
video_writer = rutils.video.VideoWriter(
out_path,
video_w,
video_h,
fps=25,
encoding='H264',
video_bitrate='11M',
mode='ffmpeg'
)
video_writer.write_frame(frame)
video_writer.release()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
rutils-0.1.1-py3-none-any.whl
(4.7 kB
view hashes)