wed.chaptors.spread_tile module¶
This submodule contains a set of functions for editing the following image:
- class wed.chaptors.spread_tile.SpreadTileEditor(video_path: str = '/Users/iwasakishuto/Github/portfolio/Wed-Downtown-OP/data/materials/spread-tile.mp4', switching_timings: List[int] = [25, 25, 33], tile_nums: List[int] = [1, 2, 4], conversion_methods: List[str] = ['', 'nega', ''])[source]¶
Bases:
wed.chaptors.base_editor.BaseWedOPEditor
Editor which in charge of editing spread-tile.
- Parameters
video_path (str, optional) – Path to the video file for tile image. Defaults to
SPREAD_TILE_VIDEO_PATH
.switching_timings (List[int], optional) – When to change the tiles. Specify by the frame position of the template video at
OPENING_TEMPLATE_PATH
(FPS =30.
). Defaults to[25, 25, 33]
.tile_nums (List[int], optional) – Number of tiles at each timing corresponding to
switching_timings
. Defaults to[1, 2, 4]
.conversion_methods (List[str], optional) – Image conversion method at each timing corresponding to
switching_timings
. Defaults to["", "nega", ""]
.
- 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]
- spread_tile(frame: numpy.ndarray[Any, numpy.dtype[numpy.uint8]], pos: int, tile: numpy.ndarray[Any, numpy.dtype[numpy.uint8]], tile_num: int, conversion_method: str = '') → numpy.ndarray[Any, numpy.dtype[numpy.uint8]][source]¶
Spread tile.
- Parameters
frame (npt.NDArray[np.uint8]) – Input frame (BGR ndarray image). NOT USED.
pos (int) – The position of the frame to get.
tile (npt.NDArray[np.uint8]) – One tile image.
tile_num (int) – How many tiles to spread.
conversion_method (str, optional) – How to convert an
tile
. Usewed.utils.image_utils.image_conversion()
to convert image. Defaults to""
.
- Returns
frame
withtext
drawn.- Return type
npt.NDArray[np.uint8]
- audio_for_overlay_create(out_path: Optional[str] = None) → Tuple[int, str][source]¶
Create a tile (repeated) audio for overlaying based on
tile_video_path
attribute.- Parameters
out_path (Optional[str], optional) – The path to the created audio file. Defaults to
None
.- Returns
The path to the created audio file.
- Return type
str