Video processing tools๏
Video processing tools
- members
- undoc-members
Multi-cropper
Crop each video of a specific file format (e.g., mp4) in a directory into N smaller cropped videos.
- param Union[str, os.PathLike] input_folder
Folder path holding videos to be cropped.
- param Literal[โaviโ, โmp4โ, โmovโ, โflvโ, โm4vโ] file_type
File type of input video files inside the
input_folderdirectory.- param Union[str, os.PathLike] output_folder
Directory where to store the cropped videos.
- param int crop_cnt
The number of cropped videos to create from each input video. Minimum: 2.
- param bool gpu
If True, use GPU codecs, else CPU. Default CPU.
- example
>>> cropper = MultiCropper(file_type='mp4', input_folder=r'C:/troubleshooting/mitra/test', output_folder=r'C:/troubleshooting/mitra/test/cropped', crop_cnt=2, gpu=True)
>>> cropper.run()
- members
- undoc-members
Crop ROI selector (rectangles)
A class for selecting and reflecting Regions of Interest (ROI) in an image. The selected region variables are stored in self: top_left, bottom_right, width, height etc.
- param Union[str, os.PathLike] path
Path to the image or video file. Can also be an image represented as a numpy array.
- param int thickness
Thickness of the rectangle border for visualizing the ROI.
- param Tuple[int, int, int] clr
BGR color tuple for visualizing the ROI. Default: deep pink.
- param Optional[str] title
Title of the drawing window. If None, then Draw ROI - Press ESC when drawn.
- param bool destroy
If True, destroy drawing window when completed. Default: True.
- example
>>> img_selector = ROISelector(path='/Users/simon/Desktop/compute_overlap.png', clr=(0, 255, 0), thickness=2)
>>> img_selector.run()
- members
- undoc-members
Crop ROI selector (circles)
Class for selecting a circular region of interest (ROI) within an image or video frame. The selected region variables are stored in self: circle_center, circle_radius.
- param Union[str, os.PathLike] path
Path to the image or video file. Can also be an image represented as a numpy array.
- param int thickness
Thickness of the circle border when visualizing the ROI.
- param Tuple[int, int, int] clr
BGR color tuple for visualizing the ROI. Default: deep pink.
- param Optional[str] title
Title of the drawing window. If None, then Draw ROI - Press ESC when drawn.
- raises InvalidFileTypeError
If the file type is not supported.
- raises CropWarning
If the selected ROI extends beyond the image boundaries or if the ROI radius equals zero.
Note
- example
>>> circle_selector = ROISelectorCircle(path='/Users/simon/Desktop/amber.png')
>>> circle_selector.run()
>>> circle_selector = ROISelectorCircle(path='/Users/simon/Desktop/Box2_IF19_7_20211109T173625_4_851_873_1_cropped.mp4')
>>> circle_selector.run()
>>> circle_selector = ROISelectorCircle(path=r"C: roubleshooting\mitra estล_MA109_Gi_CNO_0521.mp4")
>>> circle_selector.run()
- members
- undoc-members
Crop ROI selector (polygons)
Class for selecting a polygonal region of interest (ROI) within an image or video frame. The selected region vertices are stored in self: polygon_vertices.
- param Union[str, os.PathLike] path
Path to the image or video file. Can also be an image represented as a numpy array.
- param int thickness
Thickness of the polygon border when visualizing the ROI.
- param Tuple[int, int, int] clr
BGR color tuple for visualizing the ROI. Default: deep pink.
- param Optional[str] title
Title of the drawing window. If None, then Draw ROI - Press ESC when drawn.
- raises InvalidFileTypeError
If the file type is not supported.
- raises CropWarning
If the selected ROI extends beyond the image boundaries or if the number of vertices is less than 3.
- example
>>> polygon_selector = ROISelectorPolygon(path='/Users/simon/Desktop/amber.png')
>>> polygon_selector.run()
>>> polygon_selector = ROISelectorPolygon(path='/Users/simon/Desktop/Box2_IF19_7_20211109T173625_4_851_873_1_cropped.mp4')
>>> polygon_selector.run()
- members
- undoc-members
Interactive CLAHE
- members
- show-inheritance
Interactive brightness / contrast
- members
- show-inheritance
Batch video process executor
- members
- show-inheritance
Egocentrically rotate videos
- members
- show-inheritance
Asynchronous frame reader
- members
- show-inheritance
Asynchronous frame reader (GPU)