vision_utils
RandomScale
Rescale the input PIL.Image to the given size.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
minsize |
sequence or int
|
Desired min output size. If size is a sequence like (w, h), output size will be matched to this. If size is an int, smaller edge of the image will be matched to this number. i.e, if height > width, then image will be rescaled to (size * height / width, size) |
required |
maxsize |
sequence or int
|
Desired max output size. If size is a sequence like (w, h), output size will be matched to this. If size is an int, smaller edge of the image will be matched to this number. i.e, if height > width, then image will be rescaled to (size * height / width, size) |
required |
interpolation |
int
|
Desired interpolation. Default is |
Image.BILINEAR
|
Source code in omnigibson/utils/vision_utils.py
__call__(img)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img |
PIL.Image
|
Image to be scaled. |
required |
Returns:
Type | Description |
---|---|
PIL.Image: Rescaled image. |
Source code in omnigibson/utils/vision_utils.py
randomize_colors(N, bright=True)
Modified from https://github.com/matterport/Mask_RCNN/blob/master/mrcnn/visualize.py#L59 Generate random colors. To get visually distinct colors, generate them in HSV space then convert to RGB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
N |
int
|
Number of colors to generate |
required |
Returns:
Name | Type | Description |
---|---|---|
bright |
bool
|
whether to increase the brightness of the colors or not |
Source code in omnigibson/utils/vision_utils.py
segmentation_to_rgb(seg_im, N, colors=None)
Helper function to visualize segmentations as RGB frames. NOTE: assumes that geom IDs go up to N at most - if not, multiple geoms might be assigned to the same color.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seg_im |
W, H)-array
|
Segmentation image |
required |
N |
int
|
Maximum segmentation ID from @seg_im |
required |
colors |
None or list of 3-array
|
If specified, colors to apply to different segmentation IDs. Otherwise, will be generated randomly |
None
|