47 Image(int64_t rows = 0,
106 return data_[r][c][0];
114 return data_[r][c][ch];
156 double offset = 0.0)
const;
218 float value_sigma = 20.0f,
219 float distance_sigma = 10.0f)
const;
231 std::pair<Image, Image>
FilterSobel(
int kernel_size = 3)
const;
271 float clip_fill = 0.0f)
const;
286 float invalid_fill = 0.0f);
337 static constexpr
bool HAVE_IPP =
true;
static Tensor Zeros(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with zeros.
Device GetDevice() const override
SizeVector GetShape() const
Tensor To(Dtype dtype, bool copy=false) const
The Image class stores image with customizable width, height, num of channels and bytes per channel.
The Image class stores image with customizable rows, cols, channels, dtype and device.
Image Dilate(int kernel_size=3) const
Return a new image after performing morphological dilation.
Image ClipTransform(float scale, float min_value, float max_value, float clip_fill=0.0f) const
Return new image after scaling and clipping image values.
InterpType
Image interpolation algorithms.
@ Super
Super sampling interpolation (only downsample).
@ Lanczos
Lanczos filter interpolation.
@ Linear
Bilinear interpolation.
@ Nearest
Nearest neighbors interpolation.
@ Cubic
Bicubic interpolation.
static constexpr bool HAVE_IPP
Do we use IPP for accelerating image processing operations?
Image PyrDown() const
Return a new downsampled image with pyramid downsampling.
std::string ToString() const
Text description.
Image PyrDownDepth(float diff_threshold, float invalid_fill=0.f) const
Edge and invalid value preserving downsampling by 2 specifically for depth images.
static Image FromLegacy(const cloudViewer::geometry::Image &image_legacy, const core::Device &Device=core::Device("CPU:0"))
Create from a legacy CloudViewer Image.
Image Resize(float sampling_rate=0.5f, InterpType interp_type=InterpType::Nearest) const
Return a new image after resizing with specified interpolation type.
Image CPU() const
Backward-compatible convenience method to obtain a CPU-resident copy.
core::Tensor At(int64_t r, int64_t c) const
Get pixel(s) in the image.
Image & Reset(int64_t rows=0, int64_t cols=0, int64_t channels=1, core::Dtype dtype=core::Float32, const core::Device &device=core::Device("CPU:0"))
Reinitialize image with new parameters.
cloudViewer::geometry::Image ToLegacy() const
Convert to legacy Image type.
Image ColorizeDepth(float scale, float min_value, float max_value)
Colorize an input depth image (with Dtype UInt16 or Float32).
core::Tensor GetMinBound() const
Compute min 2D coordinates for the data (always {0, 0}).
core::Tensor At(int64_t r, int64_t c, int64_t ch) const
Get pixel(s) in the image. Returns a tensor with shape {}.
Image CreateVertexMap(const core::Tensor &intrinsics, float invalid_fill=0.0f)
Create a vertex map from a depth image using unprojection.
Image(int64_t rows=0, int64_t cols=0, int64_t channels=1, core::Dtype dtype=core::Float32, const core::Device &device=core::Device("CPU:0"))
Constructor for image.
core::Device GetDevice() const override
Get device of the image.
Image FilterGaussian(int kernel_size=3, float sigma=1.0f) const
Return a new image after Gaussian filtering.
core::Tensor GetMaxBound() const
Compute max 2D coordinates for the data ({rows, cols}).
void * GetDataPtr()
Get raw buffer of the Image data.
bool IsEmpty() const override
Returns true if rows * cols * channels == 0.
Image & LinearTransform(double scale=1.0, double offset=0.0)
Function to linearly transform pixel intensities in place.
Image RGBToGray() const
Converts a 3-channel RGB image to a new 1-channel Grayscale image.
Image Clone() const
Returns copy of the image on the same device.
Image To(const core::Device &device, bool copy=false) const
Transfer the image to a specified device.
Image CreateNormalMap(float invalid_fill=0.0f)
Create a normal map from a vertex map.
core::Dtype GetDtype() const
Get dtype of the image.
std::pair< Image, Image > FilterSobel(int kernel_size=3) const
Return a pair of new gradient images (dx, dy) after Sobel filtering.
core::Tensor AsTensor() const
Returns the underlying Tensor of the Image.
int64_t GetChannels() const
Get the number of channels of the image.
Image & Clear() override
Clear image contents by resetting the rows and cols to 0, while keeping channels, dtype and device un...
virtual ~Image() override
Image FilterBilateral(int kernel_size=3, float value_sigma=20.0f, float distance_sigma=10.0f) const
Return a new image after bilateral filtering.
int64_t GetCols() const
Get the number of columns of the image.
Image Filter(const core::Tensor &kernel) const
Return a new image after filtering with the given kernel.
int64_t GetRows() const
Get the number of rows of the image.
const void * GetDataPtr() const
Get raw buffer of the Image data.
constexpr nullopt_t nullopt
Generic file read and write utility for python interface.