wed.chaptors.rotating_rectangle module

This submodule contains a set of functions for editing the following image:

_images/rotating-rectangle.png
class wed.chaptors.rotating_rectangle.RotatingRectangleEditor(square_image_path: str = '/Users/iwasakishuto/Github/portfolio/Wed-Downtown-OP/data/materials/rotating-square.jpg', atol: int = 50, rotating_start_pos: int = 220)[source]

Bases: wed.chaptors.base_editor.BaseWedOPEditor

Editor which in charge of editing rotating rectangle.

_images/rotating-rectangle.png
Parameters
  • square_image_path (str, optional) – The path to the image for embedding. Defaults to ROTATING_SQUARE_IMAGE_PATH.

  • atol (int, optional) – Absolute tolerance to recognize where to embed a square image. Defaults to 50.

  • rotating_start_pos (int, optional) – The number of the frame where the rotation starts. Defaults to 220.

MASKED_COLOR

BGR Color of the part to be masked.

Type

Tuple[int,int,int]

MASKED_COLOR: Tuple[int, int, int] = (248, 232, 217)
edit(frame: numpy.ndarray[Any, numpy.dtype[numpy.uint8]], pos: int)numpy.ndarray[Any, numpy.dtype[numpy.uint8]][source]

Edit the image if it is an assigned chapter (pos)

Parameters
  • frame (npt.NDArray[np.uint8]) – Current frame (BGR image) in the video.

  • pos (int) – Current position in the video.

Returns

Edited frame.

Return type

npt.NDArray[np.uint8]

embed_image(frame: numpy.ndarray[Any, numpy.dtype[numpy.uint8]], pos: int)numpy.ndarray[Any, numpy.dtype[numpy.uint8]][source]

Embed a square image in the following gray square:

_images/rotating-rectangle.png
Parameters
  • frame (npt.NDArray[np.uint8]) – Current frame (BGR image) in the video.

  • pos (int) – Current position in the video.

Returns

Edited frame.

Return type

npt.NDArray[np.uint8]