open3d.t.geometry.Image

class open3d.t.geometry.Image

The Image class stores image with customizable rols, cols, channels, dtype and device.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self, rows=0, cols=0, channels=1, dtype=Float32, device=CPU:0)

    Row-major storage is used, similar to OpenCV. Use (row, col, channel) indexing order for image creation and accessing. In general, (r, c, ch) are the preferred variable names for consistency, and avoid using width, height, u, v, x, y for coordinates.

Parameters
  • rows (int, optional, default=0) – Number of rows of the image, i.e. image height. rows must be non-negative.

  • cols (int, optional, default=0) – Number of columns of the image, i.e. image width. cols must be non-negative.

  • channels (int, optional, default=1) – Number of channels of the image. E.g. for RGB image, channels == 3; for grayscale image, channels == 1. channels must be greater than 0.

  • dtype (open3d.core.Dtype, optional, default=Float32) – Data type of the image.

  • (open3d.core.Device (device) – 0): Device where the image is stored.

  • optional – 0): Device where the image is stored.

  • default=CPU – 0): Device where the image is stored.

  1. __init__(self, tensor)

    Construct from a tensor. The tensor won’t be copied and memory will be shared.

Parameters

tensor (open3d.core.Tensor) – Tensor of the image. The tensor must be contiguous. The tensor must be 2D (rows, cols) or 3D (rows, cols, channels).

as_tensor(self: open3d.cpu.pybind.t.geometry.Image)open3d.cpu.pybind.core.Tensor
clear(self)

Clear stored data.

Returns

open3d.t.geometry.Image

clip_transform(self: open3d.cpu.pybind.t.geometry.Image, scale: float, min_value: float, max_value: float, clip_fill: float = 0.0)open3d.cpu.pybind.t.geometry.Image

Preprocess a image of shape (rows, cols, channels=1), typically used for a depth image. UInt16 and Float32 Dtypes supported. Each pixel will be transformed by x = x / scale x = x < min_value ? clip_fill : x x = x > max_value ? clip_fill : x Use INF, NAN or 0.0 (default) for clip_fill

clone(self: open3d.cpu.pybind.t.geometry.Image)open3d.cpu.pybind.t.geometry.Image

Returns a copy of the Image on the same device.

colorize_depth(self: open3d.cpu.pybind.t.geometry.Image, scale: float, min_value: float, max_value: float)open3d.cpu.pybind.t.geometry.Image

Colorize an input depth image (with Dtype UInt16 or Float32). The image values are divided by scale, then clamped within (min_value, max_value) and finally converted to a 3 channel UInt8 RGB image using the Turbo colormap as a lookup table.

cpu(self: open3d.cpu.pybind.t.geometry.Image)open3d.cpu.pybind.t.geometry.Image

Transfer the Image to CPU. If the Image is already on CPU, no copy will be performed.

create_normal_map(self: open3d.cpu.pybind.t.geometry.Image, invalid_fill: float = 0.0)open3d.cpu.pybind.t.geometry.Image

Create a normal map of shape (rows, cols, channels=3) in Float32 from a vertex map of shape (rows, cols, channels=1) in Float32 using cross product of V(r, c+1)-V(r, c) and V(r+1, c)-V(r, c). The input vertex map is expected to be the output of create_vertex_map. You may need to start with a filtered depth image (e.g. with filter_bilateral) to obtain good results.

create_vertex_map(self: open3d.cpu.pybind.t.geometry.Image, intrinsics: open3d.cpu.pybind.core.Tensor, invalid_fill: float = 0.0)open3d.cpu.pybind.t.geometry.Image

Create a vertex map of shape (rows, cols, channels=3) in Float32 from an image of shape (rows, cols, channels=1) in Float32 using unprojection. The input depth is expected to be the output of clip_transform.

cuda(self: open3d.cpu.pybind.t.geometry.Image, device_id: int = 0)open3d.cpu.pybind.t.geometry.Image

Transfer the Image to a CUDA device. If the Image is already on the specified CUDA device, no copy will be performed.

dilate(self: open3d.cpu.pybind.t.geometry.Image, kernel_size: int = 3)open3d.cpu.pybind.t.geometry.Image

Return a new image after performing morphological dilation. Supported datatypes are UInt8, UInt16 and Float32 with {1, 3, 4} channels. An 8-connected neighborhood is used to create the dilation mask.

filter(self: open3d.cpu.pybind.t.geometry.Image, kernel: open3d.cpu.pybind.core.Tensor)open3d.cpu.pybind.t.geometry.Image

Return a new image after filtering with the given kernel.

filter_bilateral(self: open3d.cpu.pybind.t.geometry.Image, kernel_size: int = 3, value_sigma: float = 20.0, dist_sigma: float = 10.0)open3d.cpu.pybind.t.geometry.Image

Return a new image after bilateral filtering.Note: CPU (IPP) and CUDA (NPP) versions are inconsistent: CPU uses a round kernel (radius = floor(kernel_size / 2)), while CUDA uses a square kernel (width = kernel_size). Make sure to tune parameters accordingly.

filter_gaussian(self: open3d.cpu.pybind.t.geometry.Image, kernel_size: int = 3, sigma: float = 1.0)open3d.cpu.pybind.t.geometry.Image

Return a new image after Gaussian filtering. Possible kernel_size: odd numbers >= 3 are supported.

filter_sobel(self: open3d.cpu.pybind.t.geometry.Image, kernel_size: int = 3)Tuple[open3d.cpu.pybind.t.geometry.Image, open3d.cpu.pybind.t.geometry.Image]

Return a pair of new gradient images (dx, dy) after Sobel filtering. Possible kernel_size: 3 and 5.

static from_legacy_image(image_legacy: open3d.cpu.pybind.geometry.Image, device: open3d.cpu.pybind.core.Device = CPU:0)open3d.cpu.pybind.t.geometry.Image

Create a Image from a legacy Open3D Image.

get_max_bound(self)

Compute max 2D coordinates for the data ({rows, cols}).

Returns

open3d.core.Tensor

get_min_bound(self)

Compute min 2D coordinates for the data (always {0, 0}).

Returns

open3d.core.Tensor

is_empty(self)

Is any data stored?

Returns

bool

linear_transform(self, scale=1.0, offset=0.0)

Function to linearly transform pixel intensities in place: image = scale * image + offset.

Parameters
  • scale (float, optional, default=1.0) – First multiply image pixel values with this factor. This should be positive for unsigned dtypes.

  • offset (float, optional, default=0.0) – Then add this factor to all image pixel values.

Returns

open3d.t.geometry.Image

pyrdown(self: open3d.cpu.pybind.t.geometry.Image)open3d.cpu.pybind.t.geometry.Image

Return a new downsampled image with pyramid downsampling formed by a chained Gaussian filter (kernel_size = 5, sigma = 1.0) and a resize (ratio = 0.5) operation.

resize(self: open3d.cpu.pybind.t.geometry.Image, sampling_rate: float = 0.5, interp_type: open3d.cpu.pybind.t.geometry.InterpType = InterpType.Nearest)open3d.cpu.pybind.t.geometry.Image

Return a new image after resizing with specified interpolation type. Downsample if sampling rate is < 1. Upsample if sampling rate > 1. Aspect ratio is always kept.

rgb_to_gray(self: open3d.cpu.pybind.t.geometry.Image)open3d.cpu.pybind.t.geometry.Image

Converts a 3-channel RGB image to a new 1-channel Grayscale image by I = 0.299 * R + 0.587 * G + 0.114 * B.

to(*args, **kwargs)

Overloaded function.

  1. to(self, device, copy=False)

    Transfer the Image to a specified device. A new image is always created if copy is true, else it is avoided when the original image is already on the target device.

Parameters
  • device (open3d.core.Device) –

  • copy (bool, optional, default=False) – If true, a new tensor is always created; if false, the copy is avoided when the original tensor already has the targeted dtype.

Returns

open3d.t.geometry.Image

  1. to(self, dtype, scale=None, offset=0.0, copy=False)

    Returns an Image with the specified Dtype.

Parameters
  • dtype (open3d.core.Dtype) – The targeted dtype to convert to.

  • scale (bool, optional, default=None) – Optional scale value. This is 1./255 for UInt8 -> Float{32,64}, 1./65535 for UInt16 -> Float{32,64} and 1 otherwise

  • offset (Optional[float], optional, default=0.0) – Optional shift value. Default 0.

  • copy (float, optional, default=False) – If true, a new tensor is always created; if false, the copy is avoided when the original tensor already has the targeted dtype.

Returns

open3d.t.geometry.Image

to_legacy_image(self)

Convert to legacy Image type.

Returns

open3d.geometry.Image

property channels

Get the number of channels of the image.

property columns

Get the number of columns of the image.

property device

Get the device of the image.

property dtype

Get dtype of the image

property rows

Get the number of rows of the image.