Shortcuts

mmedit.utils.bbox2mask

mmedit.utils.bbox2mask(img_shape, bbox, dtype='uint8')[source]

Generate mask in np.ndarray from bbox.

The returned mask has the shape of (h, w, 1). ‘1’ indicates the hole and ‘0’ indicates the valid regions.

We prefer to use uint8 as the data type of masks, which may be different from other codes in the community.

Parameters
  • img_shape (tuple[int]) – The size of the image.

  • bbox (tuple[int]) – Configuration tuple, (top, left, height, width)

  • np.dtype (str) – Indicate the data type of returned masks. Default: ‘uint8’

Returns

Mask in the shape of (h, w, 1).

Return type

mask (np.ndarray)

Read the Docs v: zyh/doc-notfound-extend
Versions
master
latest
stable
zyh-doc-notfound-extend
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.