wed.chaptors.smartphone module

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

_images/freedom1.png
class wed.chaptors.smartphone.SmartphoneEditor(video_path: str = '/Users/iwasakishuto/Github/portfolio/Wed-Downtown-OP/data/materials/smartphone.mp4', image_path: str = '/Users/iwasakishuto/Github/portfolio/Wed-Downtown-OP/data/materials/smartphone.png', touch_image_path: str = '/Users/iwasakishuto/Github/portfolio/Wed-Downtown-OP/data/materials/smartphone-touch.png', touch_timings: Dict[int, Tuple[int]] = {158: (140, 220), 167: (140, 300), 179: (125, 290), 205: (225, 280), 211: (280, 100)}, touch_start_pos: Tuple[int, int] = (430, 200), touch_end_pos: Tuple[int, int] = (430, 200), positions: Tuple[int, int] = (152, 211), smartphone_tblr: Tuple[int, int, int, int] = [72, 536, 17, 283], transition: int = 3, smartphone_pos_margin_top: int = 10)[source]

Bases: wed.chaptors.base_editor.BaseWedOPEditor

edit(frame: numpy.ndarray[Any, numpy.dtype[numpy.uint8]], pos: int, span: int = 20)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]

set_smartphone_box(margin_top: int = 10)None[source]
get_touch_pos(pos: int)Tuple[int, int][source]
paste_smartphone_movie(frame: numpy.ndarray[Any, numpy.dtype[numpy.uint8]], pos: int, box: Tuple[int, int] = (160, 10))numpy.ndarray[Any, numpy.dtype[numpy.uint8]][source]

Paste a smartphone movie.

Parameters
  • frame (npt.NDArray[np.uint8]) – Input frame (BGR ndarray image). NOT USED.

  • pos (int) – The position of the frame to get.

Returns

frame with text drawn.

Return type

npt.NDArray[np.uint8]