Image

class ocvproto.sources.image.Image(src: Union[int, str, <sphinx.ext.autodoc.importer._MockObject object at 0x7f886e166da0>, Frame] = None)

Bases: ocvproto.sources.base.Source

Represents an image.

Parameters:src – Source id (int), path (str) or frame (np array)
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
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(fpath: Union[str, pathlib.Path] = None)

Dumps frame into a file.

Parameters:fpath – Filepath to store image into. If not set, name is generated automatically.
fill(color: Union[int, str, Tuple[int, int, int]])

Fills the canvas with the given color.

Parameters:color
frame

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.image.Image

Read and return current frame.

resize(width: int, height: int) → ocvproto.frame.Frame

Resizes the current frame inplace.

Parameters:
  • width
  • height
width

Width