GPUImage

Inheritance diagram of GPUImage

GPUImage inheritance diagram

class savant.utils.image.GPUImage(image, cuda_stream=None)

Image data container. GPU version.

property gpu_mat
property width: int

Returns image width. :return: image width

property height: int

Returns image height. :return: image height

to_cpu()
cut(bbox)

Cuts image by bbox :param bbox: cutout bbox :return:

concat(image, axis=0)

Concatenates images along axis.

Parameters:
  • image (GPUImage) – image to concatenate

  • axis (int) – axis to concatenate. 0 - is vertical, 1 - is horizontal

Returns:

concatenated image

Return type:

GPUImage

paste(image, point)

Pastes image on current image.

Parameters:
rotate(angle, bbox=None)

Rotates image on angle. If bbox is not None, image will be rotated around center point of image.

Parameters:
  • angle (float) – angle to rotate in degrees

  • bbox (Optional[RBBox]) – bounding box on image

Returns:

rotated image

Return type:

Tuple[GPUImage, RBBox]

resize(resolution, method='fit', interpolation=cv2.INTER_LINEAR)

Resizes image to resolution.

Parameters:
  • resolution (Tuple[int, int]) – resolution to resize [width, height]

  • method (str) – method to resize one of [‘fit’, ‘scale’]

  • interpolation (int) – interpolation method. Oone of [cv2.INTER_NEAREST, cv2.INTER_AREA, cv2.INTER_LINEAR, cv2.INTER_CUBIC, cv2.INTER_LANCZOS4]

Returns:

resized image

Return type:

GPUImage