Open3D (C++ API)
0.12.0
|
The Image class stores image with customizable rols, cols, channels, dtype and device. More...
#include <Image.h>
Public Member Functions | |
Image (int64_t rows=0, int64_t cols=0, int64_t channels=1, core::Dtype dtype=core::Dtype::Float32, const core::Device &device=core::Device("CPU:0")) | |
Constructor for image. More... | |
Image (const core::Tensor &tensor) | |
Construct from a tensor. The tensor won't be copied and memory will be shared. More... | |
virtual | ~Image () override |
Image & | Clear () override |
bool | IsEmpty () const override |
Returns true if rows * cols * channels == 0. More... | |
int64_t | GetRows () const |
Get the number of rows of the image. More... | |
int64_t | GetCols () const |
Get the number of columns of the image. More... | |
int64_t | GetChannels () const |
Get the number of channels of the image. More... | |
core::Dtype | GetDtype () const |
Get dtype of the image. More... | |
core::Device | GetDevice () const |
Get device of the image. More... | |
core::Tensor | At (int64_t r, int64_t c) const |
core::Tensor | At (int64_t r, int64_t c, int64_t ch) const |
Get pixel(s) in the image. Returns a tensor with shape {}. More... | |
void * | GetDataPtr () |
Get raw buffer of the Image data. More... | |
const void * | GetDataPtr () const |
Get raw buffer of the Image data. More... | |
core::Tensor | AsTensor () const |
Retuns the underlying Tensor of the Image. More... | |
core::Tensor | GetMinBound () const |
Compute min 2D coordinates for the data (always {0, 0}). More... | |
core::Tensor | GetMaxBound () const |
Compute max 2D coordinates for the data ({rows, cols}). More... | |
open3d::geometry::Image | ToLegacyImage () const |
Convert to legacy Image type. More... | |
std::string | ToString () const |
Text description. More... | |
Public Member Functions inherited from open3d::t::geometry::Geometry | |
virtual | ~Geometry () |
GeometryType | GetGeometryType () const |
Returns one of registered geometry types. More... | |
int | Dimension () const |
Returns whether the geometry is 2D or 3D. More... | |
std::string | GetName () const |
void | SetName (const std::string &name) |
Static Public Member Functions | |
static Image | FromLegacyImage (const open3d::geometry::Image &image_legacy, const core::Device &Device=core::Device("CPU:0")) |
Create from a legacy Open3D Image. More... | |
Protected Attributes | |
core::Tensor | data_ |
Additional Inherited Members | |
Public Types inherited from open3d::t::geometry::Geometry | |
enum | GeometryType { GeometryType::Unspecified = 0, GeometryType::PointCloud = 1, GeometryType::VoxelGrid = 2, GeometryType::Octree = 3, GeometryType::LineSet = 4, GeometryType::MeshBase = 5, GeometryType::TriangleMesh = 6, GeometryType::HalfEdgeTriangleMesh = 7, GeometryType::Image = 8, GeometryType::RGBDImage = 9, GeometryType::TetraMesh = 10, GeometryType::OrientedBoundingBox = 11, GeometryType::AxisAlignedBoundingBox = 12 } |
Specifies possible geometry types. More... | |
Protected Member Functions inherited from open3d::t::geometry::Geometry | |
Geometry (GeometryType type, int dimension) | |
Parameterized Constructor. More... | |
The Image class stores image with customizable rols, cols, channels, dtype and device.
open3d::t::geometry::Image::Image | ( | int64_t | rows = 0 , |
int64_t | cols = 0 , |
||
int64_t | channels = 1 , |
||
core::Dtype | dtype = core::Dtype::Float32 , |
||
const core::Device & | device = core::Device("CPU:0") |
||
) |
Constructor for image.
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.
rows | Number of rows of the image, i.e. image height. rows must be non-negative. |
cols | Number of columns of the image, i.e. image width. cols must be non-negative. |
channels | 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 | Data type of the image. |
device | Device where the image is stored. |
open3d::t::geometry::Image::Image | ( | const core::Tensor & | tensor | ) |
Construct from a tensor. The tensor won't be copied and memory will be shared.
tensor | Tensor of the image. The tensor must be contiguous. The tensor must be 2D (rows, cols) or 3D (rows, cols, channels). |
|
inlineoverridevirtual |
|
inline |
Retuns the underlying Tensor of the Image.
|
inline |
Get pixel(s) in the image. If channels == 1, returns a tensor with shape {}, otherwise returns a tensor with shape {channels,}. The returned tensor is a slice of the image's tensor, so when modifying the slice, the original tensor will also be modified.
|
inline |
Get pixel(s) in the image. Returns a tensor with shape {}.
|
inlineoverridevirtual |
Clear image contents by resetting the rows and cols to 0, while keeping channels, dtype and device unchanged.
Implements open3d::t::geometry::Geometry.
|
static |
Create from a legacy Open3D Image.
|
inline |
Get the number of channels of the image.
|
inline |
Get the number of columns of the image.
|
inline |
Get raw buffer of the Image data.
|
inline |
Get raw buffer of the Image data.
|
inline |
Get device of the image.
|
inline |
Get dtype of the image.
|
inline |
Compute max 2D coordinates for the data ({rows, cols}).
|
inline |
Compute min 2D coordinates for the data (always {0, 0}).
|
inline |
Get the number of rows of the image.
|
inlineoverridevirtual |
Returns true if rows * cols * channels == 0.
Implements open3d::t::geometry::Geometry.
open3d::geometry::Image open3d::t::geometry::Image::ToLegacyImage | ( | ) | const |
Convert to legacy Image type.
std::string open3d::t::geometry::Image::ToString | ( | ) | const |
Text description.
|
protected |