mmpose.apis.webcam.utils.copy_and_paste¶
- mmpose.apis.webcam.utils.copy_and_paste(img: numpy.ndarray, background_img: numpy.ndarray, mask: numpy.ndarray, bbox: Optional[List] = None, effect_region: Tuple = (0.2, 0.2, 0.8, 0.8), min_size: Tuple = (20, 20)) → numpy.ndarray[source]¶
Copy the image region and paste to the background.
- Parameters
img (np.ndarray) – Image data.
background_img (np.ndarray) – Background image data.
mask (ndarray) – instance segmentation result.
bbox (list, optional) – instance bbox in (x1, y1, x2, y2). If not given, the bbox will be obtained by
_find_bbox()
. Default:None
effect_region (tuple) – The region to apply mask, the coordinates are normalized (x1, y1, x2, y2). Default: (0.2, 0.2, 0.8, 0.8)
min_size (tuple) – The minimum region size (w, h) in pixels. Default: (20, 20)
- Returns
The background with pasted image region.
- Return type
np.ndarray