Open3D (C++ API)  0.18.0+90810a3
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions
open3d::geometry::Image Class Reference

The Image class stores image with customizable width, height, num of channels and bytes per channel. More...

#include <Image.h>

Inheritance diagram for open3d::geometry::Image:
open3d::geometry::Geometry2D open3d::geometry::Geometry

Public Types

enum class  ColorToIntensityConversionType { Equal , Weighted }
 Specifies whether R, G, B channels have the same weight when converting to intensity. Only used for Image with 3 channels. More...
 
enum class  FilterType {
  Gaussian3 , Gaussian5 , Gaussian7 , Sobel3Dx ,
  Sobel3Dy
}
 Specifies the Image filter type. More...
 
- Public Types inherited from open3d::geometry::Geometry
enum class  GeometryType {
  Unspecified = 0 , PointCloud = 1 , VoxelGrid = 2 , Octree = 3 ,
  LineSet = 4 , MeshBase = 5 , TriangleMesh = 6 , HalfEdgeTriangleMesh = 7 ,
  Image = 8 , RGBDImage = 9 , TetraMesh = 10 , OrientedBoundingBox = 11 ,
  AxisAlignedBoundingBox = 12
}
 Specifies possible geometry types. More...
 

Public Member Functions

 Image ()
 Default Constructor. More...
 
 ~Image () override
 
ImageClear () override
 Clear all elements in the geometry. More...
 
bool IsEmpty () const override
 Returns true iff the geometry is empty. More...
 
Eigen::Vector2d GetMinBound () const override
 Returns min bounds for geometry coordinates. More...
 
Eigen::Vector2d GetMaxBound () const override
 Returns max bounds for geometry coordinates. More...
 
bool TestImageBoundary (double u, double v, double inner_margin=0.0) const
 Test if coordinate (u, v) is located in the inner_marge of the image. More...
 
virtual bool HasData () const
 Returns true if the Image has valid data. More...
 
ImagePrepare (int width, int height, int num_of_channels, int bytes_per_channel)
 Prepare Image properties and allocate Image buffer. More...
 
int BytesPerLine () const
 Returns data size per line (row, or the width) in bytes. More...
 
std::pair< bool, double > FloatValueAt (double u, double v) const
 
std::shared_ptr< ImageCreateFloatImage (Image::ColorToIntensityConversionType type=Image::ColorToIntensityConversionType::Weighted) const
 Return a gray scaled float type image. More...
 
template<typename T >
T * PointerAt (int u, int v) const
 Function to access the raw data of a single-channel Image. More...
 
template<typename T >
T * PointerAt (int u, int v, int ch) const
 Function to access the raw data of a multi-channel Image. More...
 
template<class T >
T * PointerAs () const
 
std::shared_ptr< ImageConvertDepthToFloatImage (double depth_scale=1000.0, double depth_trunc=3.0) const
 
std::shared_ptr< ImageTranspose () const
 
std::shared_ptr< ImageFlipHorizontal () const
 Function to flip image horizontally (from left to right). More...
 
std::shared_ptr< ImageFlipVertical () const
 Function to flip image vertically (upside down). More...
 
std::shared_ptr< ImageFilter (Image::FilterType type) const
 Function to filter image with pre-defined filtering type. More...
 
std::shared_ptr< ImageFilter (const std::vector< double > &dx, const std::vector< double > &dy) const
 Function to filter image with arbitrary dx, dy separable filters. More...
 
std::shared_ptr< ImageFilterHorizontal (const std::vector< double > &kernel) const
 
std::shared_ptr< ImageDownsample () const
 Function to 2x image downsample using simple 2x2 averaging. More...
 
std::shared_ptr< ImageDilate (int half_kernel_size=1) const
 Function to dilate 8bit mask map. More...
 
ImageLinearTransform (double scale=1.0, double offset=0.0)
 
ImageClipIntensity (double min=0.0, double max=1.0)
 
template<typename T >
std::shared_ptr< ImageCreateImageFromFloatImage () const
 
ImagePyramid CreatePyramid (size_t num_of_levels, bool with_gaussian_filter=true) const
 Function to create image pyramid. More...
 
std::shared_ptr< ImageCreateDepthBoundaryMask (double depth_threshold_for_discontinuity_check=0.1, int half_dilation_kernel_size_for_discontinuity_map=3) const
 Function to create a depthmap boundary mask from depth image. More...
 
- Public Member Functions inherited from open3d::geometry::Geometry2D
 ~Geometry2D () override
 
- Public Member Functions inherited from open3d::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 std::shared_ptr< ImageCreateDepthToCameraDistanceMultiplierFloatImage (const camera::PinholeCameraIntrinsic &intrinsic)
 
static ImagePyramid FilterPyramid (const ImagePyramid &input, Image::FilterType type)
 Function to filter image pyramid. More...
 

Data Fields

int width_ = 0
 Width of the image. More...
 
int height_ = 0
 Height of the image. More...
 
int num_of_channels_ = 0
 Number of channels in the image. More...
 
int bytes_per_channel_ = 0
 Number of bytes per channel. More...
 
std::vector< uint8_t > data_
 Image storage buffer. More...
 

Protected Member Functions

void AllocateDataBuffer ()
 
- Protected Member Functions inherited from open3d::geometry::Geometry2D
 Geometry2D (GeometryType type)
 Parameterized Constructor. More...
 
- Protected Member Functions inherited from open3d::geometry::Geometry
 Geometry (GeometryType type, int dimension)
 Parameterized Constructor. More...
 

Detailed Description

The Image class stores image with customizable width, height, num of channels and bytes per channel.

Member Enumeration Documentation

◆ ColorToIntensityConversionType

Specifies whether R, G, B channels have the same weight when converting to intensity. Only used for Image with 3 channels.

When Weighted is used R, G, B channels are weighted according to the Digital ITU BT.601 standard: I = 0.299 * R + 0.587 * G + 0.114 * B.

Enumerator
Equal 

R, G, B channels have equal weights.

Weighted 

Weighted R, G, B channels: I = 0.299 * R + 0.587 * G + 0.114 * B.

◆ FilterType

Specifies the Image filter type.

Enumerator
Gaussian3 

Gaussian filter of size 3 x 3.

Gaussian5 

Gaussian filter of size 5 x 5.

Gaussian7 

Gaussian filter of size 7 x 7.

Sobel3Dx 

Sobel filter along X-axis.

Sobel3Dy 

Sobel filter along Y-axis.

Constructor & Destructor Documentation

◆ Image()

open3d::geometry::Image::Image ( )
inline

Default Constructor.

◆ ~Image()

open3d::geometry::Image::~Image ( )
inlineoverride

Member Function Documentation

◆ AllocateDataBuffer()

void open3d::geometry::Image::AllocateDataBuffer ( )
inlineprotected

◆ BytesPerLine()

int open3d::geometry::Image::BytesPerLine ( ) const
inline

Returns data size per line (row, or the width) in bytes.

◆ Clear()

Image & open3d::geometry::Image::Clear ( )
overridevirtual

Clear all elements in the geometry.

Implements open3d::geometry::Geometry2D.

◆ ClipIntensity()

Image & open3d::geometry::Image::ClipIntensity ( double  min = 0.0,
double  max = 1.0 
)

Function to clipping pixel intensities.

Parameters
minis lower bound.
maxis upper bound.

◆ ConvertDepthToFloatImage()

std::shared_ptr< Image > open3d::geometry::Image::ConvertDepthToFloatImage ( double  depth_scale = 1000.0,
double  depth_trunc = 3.0 
) const

◆ CreateDepthBoundaryMask()

std::shared_ptr< Image > open3d::geometry::Image::CreateDepthBoundaryMask ( double  depth_threshold_for_discontinuity_check = 0.1,
int  half_dilation_kernel_size_for_discontinuity_map = 3 
) const

Function to create a depthmap boundary mask from depth image.

◆ CreateDepthToCameraDistanceMultiplierFloatImage()

std::shared_ptr< Image > open3d::geometry::Image::CreateDepthToCameraDistanceMultiplierFloatImage ( const camera::PinholeCameraIntrinsic intrinsic)
static

Factory function to create a float image composed of multipliers that convert depth values into camera distances (ImageFactory.cpp) The multiplier function M(u,v) is defined as: M(u, v) = sqrt(1 + ((u - cx) / fx) ^ 2 + ((v - cy) / fy) ^ 2) This function is used as a convenient function for performance optimization in volumetric integration (see Core/Integration/TSDFVolume.h).

◆ CreateFloatImage()

std::shared_ptr< Image > open3d::geometry::Image::CreateFloatImage ( Image::ColorToIntensityConversionType  type = Image::ColorToIntensityConversionType::Weighted) const

Return a gray scaled float type image.

◆ CreateImageFromFloatImage()

template<typename T >
template std::shared_ptr< Image > open3d::geometry::Image::CreateImageFromFloatImage< uint16_t > ( ) const

Function to change data types of image crafted for specific usage such as single channel float image -> 8-bit RGB or 16-bit depth image.

◆ CreatePyramid()

ImagePyramid open3d::geometry::Image::CreatePyramid ( size_t  num_of_levels,
bool  with_gaussian_filter = true 
) const

Function to create image pyramid.

◆ Dilate()

std::shared_ptr< Image > open3d::geometry::Image::Dilate ( int  half_kernel_size = 1) const

Function to dilate 8bit mask map.

◆ Downsample()

std::shared_ptr< Image > open3d::geometry::Image::Downsample ( ) const

Function to 2x image downsample using simple 2x2 averaging.

◆ Filter() [1/2]

std::shared_ptr< Image > open3d::geometry::Image::Filter ( const std::vector< double > &  dx,
const std::vector< double > &  dy 
) const

Function to filter image with arbitrary dx, dy separable filters.

◆ Filter() [2/2]

std::shared_ptr< Image > open3d::geometry::Image::Filter ( Image::FilterType  type) const

Function to filter image with pre-defined filtering type.

◆ FilterHorizontal()

std::shared_ptr< Image > open3d::geometry::Image::FilterHorizontal ( const std::vector< double > &  kernel) const

◆ FilterPyramid()

ImagePyramid open3d::geometry::Image::FilterPyramid ( const ImagePyramid input,
Image::FilterType  type 
)
static

Function to filter image pyramid.

◆ FlipHorizontal()

std::shared_ptr< Image > open3d::geometry::Image::FlipHorizontal ( ) const

Function to flip image horizontally (from left to right).

◆ FlipVertical()

std::shared_ptr< Image > open3d::geometry::Image::FlipVertical ( ) const

Function to flip image vertically (upside down).

◆ FloatValueAt()

std::pair< bool, double > open3d::geometry::Image::FloatValueAt ( double  u,
double  v 
) const

Function to access the bilinear interpolated float value of a (single-channel) float image. Returns a tuple, where the first bool indicates if the u,v coordinates are within the image dimensions, and the second double value is the interpolated pixel value.

◆ GetMaxBound()

Eigen::Vector2d open3d::geometry::Image::GetMaxBound ( ) const
overridevirtual

Returns max bounds for geometry coordinates.

Implements open3d::geometry::Geometry2D.

◆ GetMinBound()

Eigen::Vector2d open3d::geometry::Image::GetMinBound ( ) const
overridevirtual

Returns min bounds for geometry coordinates.

Implements open3d::geometry::Geometry2D.

◆ HasData()

virtual bool open3d::geometry::Image::HasData ( ) const
inlinevirtual

Returns true if the Image has valid data.

◆ IsEmpty()

bool open3d::geometry::Image::IsEmpty ( ) const
overridevirtual

Returns true iff the geometry is empty.

Implements open3d::geometry::Geometry2D.

◆ LinearTransform()

Image & open3d::geometry::Image::LinearTransform ( double  scale = 1.0,
double  offset = 0.0 
)

Function to linearly transform pixel intensities image_new = scale * image + offset.

◆ PointerAs()

template<class T >
T* open3d::geometry::Image::PointerAs ( ) const
inline

Reinterpret the internal data buffer. The resulting type's size must be the same as bytes_per_channel_. This is similar to PointerAt<T>(0, 0).

◆ PointerAt() [1/2]

template<typename T >
template uint16_t * open3d::geometry::Image::PointerAt< uint16_t > ( int  u,
int  v 
) const

Function to access the raw data of a single-channel Image.

◆ PointerAt() [2/2]

template<typename T >
template uint16_t * open3d::geometry::Image::PointerAt< uint16_t > ( int  u,
int  v,
int  ch 
) const

Function to access the raw data of a multi-channel Image.

◆ Prepare()

Image& open3d::geometry::Image::Prepare ( int  width,
int  height,
int  num_of_channels,
int  bytes_per_channel 
)
inline

Prepare Image properties and allocate Image buffer.

◆ TestImageBoundary()

bool open3d::geometry::Image::TestImageBoundary ( double  u,
double  v,
double  inner_margin = 0.0 
) const

Test if coordinate (u, v) is located in the inner_marge of the image.

Parameters
uCoordinate along the width dimension.
vCoordinate along the height dimension.
inner_marginThe inner margin from the image boundary.
Returns
Returns true if coordinate (u, v) is located in the inner_marge of the image.

◆ Transpose()

std::shared_ptr< Image > open3d::geometry::Image::Transpose ( ) const

Field Documentation

◆ bytes_per_channel_

int open3d::geometry::Image::bytes_per_channel_ = 0

Number of bytes per channel.

◆ data_

std::vector<uint8_t> open3d::geometry::Image::data_

Image storage buffer.

◆ height_

int open3d::geometry::Image::height_ = 0

Height of the image.

◆ num_of_channels_

int open3d::geometry::Image::num_of_channels_ = 0

Number of channels in the image.

◆ width_

int open3d::geometry::Image::width_ = 0

Width of the image.


The documentation for this class was generated from the following files: