Video¶
-
class
ocvproto.sources.video.
Property
(cv_prop: int, *, max: int = None)¶ Bases:
object
Represents a capture video property with restrictions.
-
class
ocvproto.sources.video.
Video
(src: Union[str, <sphinx.ext.autodoc.importer._MockObject object at 0x7f886e166da0>])¶ Bases:
ocvproto.sources.base.Source
Represents a video.
-
absdiff
(frame: Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f886e166da0>, Frame]) → ocvproto.frame.Frame¶ Returns absolute difference between the current and a given frame as a new Source.
Parameters: frame –
-
blur
(ksize: Tuple[int, int]) → ocvproto.frame.Frame¶ Blures the current frame inplace.
Parameters: ksize – Kernel size tuple (width, height)
-
canny
(thr_1: int, thr_2: int) → ocvproto.frame.Frame¶ Applies Canny Edge Detection algorithm to the current frame inplace.
Parameters: - thr_1 –
- thr_2 –
-
codec
¶ FOURCC codec alias.
-
describe_properties
() → Dict[str, Any]¶ Returns descriptions for CV properties found in the class of this object and its bases.
One can initialize trackbars with these descriptions: see Window.add_trackbar_group()
-
dilate
(element: Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f886e166da0>, Frame], iterations: int = None) → ocvproto.frame.Frame¶ Dilates the current frame inplace.
Parameters: - element –
- iterations –
-
draw_rectangle
(*, pos: Tuple[int, int], width: int, height: int, color: Union[int, str, Tuple[int, int, int]] = None)¶ Draws a rectangle.
Parameters: - pos – Top left corner (x, y).
- width –
- height –
- color –
-
dump
(frame: Union[<sphinx.ext.autodoc.importer._MockObject object at 0x7f886e166da0>, Frame] = None)¶ Writes the current or the given frame. Automatically configures writer object is needed.
-
dump_image
(fpath: Union[str, pathlib.Path] = None)¶ Dumps the image into a file.
Parameters: fpath – Filepath to store image into. If not set, name is generated automatically.
-
dump_setup
(fpath: Union[str, pathlib.Path] = 'ocvproto.avi', *, width: int = None, height: int = None, fps: Union[int, float] = None, codec: str = 'XVID') → <sphinx.ext.autodoc.importer._MockObject object at 0x7f886dff45c0>¶ Configures write parameters. Returns opencv writer object.
Parameters: - fpath – Filepath.
- width –
- height –
- fps – Frames per second.
- codec – FOURCC codec alias.
-
fill
(color: Union[int, str, Tuple[int, int, int]])¶ Fills the canvas with the given color.
Parameters: color –
-
focus
¶ Focus
-
fps
¶ FPS
-
frame
¶ Current frame.
-
gamma
¶ Gamma
-
get_image
() → ocvproto.sources.image.Image¶ Returns image object from the current frame.
-
height
¶ Height
-
make_gray
() → ocvproto.frame.Frame¶ Makes the current frame grayscale inplace.
-
make_rgb
() → ocvproto.frame.Frame¶ Makes the current frame RGB inplace.
-
read
() → ocvproto.sources.video.Video¶ Read and return current frame.
-
resize
(width: int, height: int) → ocvproto.frame.Frame¶ Resizes the current frame inplace.
Parameters: - width –
- height –
-
set_property
(name: str, value: int)¶ Helper method to set property value.
Parameters: - name – Property name.
- value –
-
sharpness
¶ Sharpness
-
width
¶ Width
-
zoom
¶ Zoom
-