Open3D (C++ API)
0.12.0
|
The Image class stores image with customizable width, height, num of channels and bytes per channel. More...
#include <Image.h>
Public Types | |
enum | ColorToIntensityConversionType { ColorToIntensityConversionType::Equal, ColorToIntensityConversionType::Weighted } |
Specifies whether R, G, B channels have the same weight when converting to intensity. Only used for Image with 3 channels. More... | |
enum | FilterType { FilterType::Gaussian3, FilterType::Gaussian5, FilterType::Gaussian7, FilterType::Sobel3Dx, FilterType::Sobel3Dy } |
Specifies the Image filter type. More... | |
Public Types inherited from open3d::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... | |
Public Member Functions | |
Image () | |
Default Constructor. More... | |
~Image () override | |
Image & | Clear () 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... | |
Image & | Prepare (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< Image > | CreateFloatImage (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< Image > | ConvertDepthToFloatImage (double depth_scale=1000.0, double depth_trunc=3.0) const |
std::shared_ptr< Image > | Transpose () const |
std::shared_ptr< Image > | FlipHorizontal () const |
Function to flip image horizontally (from left to right). More... | |
std::shared_ptr< Image > | FlipVertical () const |
Function to flip image vertically (upside down). More... | |
std::shared_ptr< Image > | Filter (Image::FilterType type) const |
Function to filter image with pre-defined filtering type. More... | |
std::shared_ptr< Image > | Filter (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< Image > | FilterHorizontal (const std::vector< double > &kernel) const |
std::shared_ptr< Image > | Downsample () const |
Function to 2x image downsample using simple 2x2 averaging. More... | |
std::shared_ptr< Image > | Dilate (int half_kernel_size=1) const |
Function to dilate 8bit mask map. More... | |
Image & | LinearTransform (double scale=1.0, double offset=0.0) |
Image & | ClipIntensity (double min=0.0, double max=1.0) |
template<typename T > | |
std::shared_ptr< Image > | CreateImageFromFloatImage () const |
ImagePyramid | CreatePyramid (size_t num_of_levels, bool with_gaussian_filter=true) const |
Function to create image pyramid. More... | |
std::shared_ptr< 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. 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< Image > | CreateDepthToCameraDistanceMultiplierFloatImage (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 chanels 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... | |
The Image class stores image with customizable width, height, num of channels and bytes per channel.
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. |
|
strong |
Specifies the Image filter type.
|
inline |
Default Constructor.
|
inlineoverride |
|
inlineprotected |
|
inline |
Returns data size per line (row, or the width) in bytes.
|
overridevirtual |
Clear all elements in the geometry.
Implements open3d::geometry::Geometry2D.
Image & open3d::geometry::Image::ClipIntensity | ( | double | min = 0.0 , |
double | max = 1.0 |
||
) |
Function to clipping pixel intensities.
min | is lower bound. |
max | is upper bound. |
std::shared_ptr< Image > open3d::geometry::Image::ConvertDepthToFloatImage | ( | double | depth_scale = 1000.0 , |
double | depth_trunc = 3.0 |
||
) | const |
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.
|
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).
std::shared_ptr< Image > open3d::geometry::Image::CreateFloatImage | ( | Image::ColorToIntensityConversionType | type = Image::ColorToIntensityConversionType::Weighted | ) | const |
Return a gray scaled float type image.
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.
ImagePyramid open3d::geometry::Image::CreatePyramid | ( | size_t | num_of_levels, |
bool | with_gaussian_filter = true |
||
) | const |
Function to create image pyramid.
std::shared_ptr< Image > open3d::geometry::Image::Dilate | ( | int | half_kernel_size = 1 | ) | const |
Function to dilate 8bit mask map.
std::shared_ptr< Image > open3d::geometry::Image::Downsample | ( | ) | const |
Function to 2x image downsample using simple 2x2 averaging.
std::shared_ptr< Image > open3d::geometry::Image::Filter | ( | Image::FilterType | type | ) | const |
Function to filter image with pre-defined filtering type.
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.
std::shared_ptr< Image > open3d::geometry::Image::FilterHorizontal | ( | const std::vector< double > & | kernel | ) | const |
|
static |
Function to filter image pyramid.
std::shared_ptr< Image > open3d::geometry::Image::FlipHorizontal | ( | ) | const |
Function to flip image horizontally (from left to right).
std::shared_ptr< Image > open3d::geometry::Image::FlipVertical | ( | ) | const |
Function to flip image vertically (upside down).
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.
|
overridevirtual |
Returns max bounds for geometry coordinates.
Implements open3d::geometry::Geometry2D.
|
overridevirtual |
Returns min bounds for geometry coordinates.
Implements open3d::geometry::Geometry2D.
|
inlinevirtual |
Returns true
if the Image has valid data.
|
overridevirtual |
Returns true
iff the geometry is empty.
Implements open3d::geometry::Geometry2D.
Image & open3d::geometry::Image::LinearTransform | ( | double | scale = 1.0 , |
double | offset = 0.0 |
||
) |
Function to linearly transform pixel intensities image_new = scale * image + offset.
|
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).
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.
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.
|
inline |
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.
u | Coordinate along the width dimension. |
v | Coordinate along the height dimension. |
inner_margin | The inner margin from the image boundary. |
true
if coordinate (u, v)
is located in the inner_marge of the image. std::shared_ptr< Image > open3d::geometry::Image::Transpose | ( | ) | const |
int open3d::geometry::Image::bytes_per_channel_ = 0 |
Number of bytes per channel.
std::vector<uint8_t> open3d::geometry::Image::data_ |
Image storage buffer.
int open3d::geometry::Image::height_ = 0 |
Height of the image.
int open3d::geometry::Image::num_of_channels_ = 0 |
Number of chanels in the image.
int open3d::geometry::Image::width_ = 0 |
Width of the image.