19 class PinholeCameraIntrinsic;
87 inline virtual bool IsEmpty()
const override {
return !HasData(); }
104 return width_ > 0 && height_ > 0 &&
105 data_.size() == size_t(height_ * BytesPerLine());
112 int bytes_per_channel) {
115 num_of_channels_ = num_of_channels;
116 bytes_per_channel_ = bytes_per_channel;
117 AllocateDataBuffer();
123 return width_ * num_of_channels_ * bytes_per_channel_;
140 static std::shared_ptr<Image>
150 template <
typename T>
154 template <
typename T>
158 double depth_scale = 1000.0,
double depth_trunc = 3.0)
const;
171 std::shared_ptr<Image>
Filter(
const std::vector<double> &dx,
172 const std::vector<double> &dy)
const;
175 const std::vector<double> &kernel)
const;
181 std::shared_ptr<Image>
Dilate(
int half_kernel_size = 1)
const;
196 template <
typename T>
205 bool with_gaussian_filter =
true)
const;
209 double depth_threshold_for_discontinuity_check = 0.1,
210 int half_dilation_kernel_size_for_discontinuity_map = 3)
const;
214 data_.resize(width_ * height_ * num_of_channels_ * bytes_per_channel_);
223 int num_of_channels_ = 0;
225 int bytes_per_channel_ = 0;
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Hierarchical CLOUDVIEWER Object.
Contains the pinhole camera intrinsic parameters.
The Image class stores image with customizable width, height, num of channels and bytes per channel.
void AllocateDataBuffer()
virtual bool IsEmpty() const override
std::shared_ptr< Image > CreateFloatImage(Image::ColorToIntensityConversionType type=Image::ColorToIntensityConversionType::Weighted) const
Return a gray scaled float type image.
ColorToIntensityConversionType
Specifies whether R, G, B channels have the same weight when converting to intensity....
@ Weighted
Weighted R, G, B channels: I = 0.299 * R + 0.587 * G + 0.114 * B.
Image & Prepare(int width, int height, int num_of_channels, int bytes_per_channel)
Prepare Image properties and allocate Image buffer.
std::shared_ptr< Image > FlipVertical() const
Function to flip image vertically (upside down).
std::shared_ptr< Image > Filter(Image::FilterType type) const
Function to filter image with pre-defined filtering type.
std::shared_ptr< Image > Transpose() const
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
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.
Image(const char *name="Image")
Default Constructor.
int BytesPerLine() const
Returns data size per line (row, or the width) in bytes.
virtual bool isSerializable() const override
Returns whether object is serializable of not.
std::shared_ptr< Image > FilterHorizontal(const std::vector< double > &kernel) const
virtual Eigen::Vector2d GetMax2DBound() const override
virtual bool HasData() const
Returns true if the Image has valid data.
virtual void drawMeOnly(CC_DRAW_CONTEXT &context) override
Draws the entity only (not its children)
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.
std::vector< uint8_t > data_
Image storage buffer.
static std::shared_ptr< Image > CreateDepthToCameraDistanceMultiplierFloatImage(const camera::PinholeCameraIntrinsic &intrinsic)
std::shared_ptr< Image > FlipHorizontal() const
Function to flip image horizontally (from left to right).
std::shared_ptr< Image > Dilate(int half_kernel_size=1) const
Function to dilate 8bit mask map.
std::pair< bool, double > FloatValueAt(double u, double v) const
std::shared_ptr< Image > ConvertDepthToFloatImage(double depth_scale=1000.0, double depth_trunc=3.0) const
std::shared_ptr< Image > CreateImageFromFloatImage() const
ImagePyramid CreatePyramid(size_t num_of_levels, bool with_gaussian_filter=true) const
Function to create image pyramid.
Image & ClipIntensity(double min=0.0, double max=1.0)
FilterType
Specifies the Image filter type.
std::shared_ptr< Image > Downsample() const
Function to 2x image downsample using simple 2x2 averaging.
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.
static ImagePyramid FilterPyramid(const ImagePyramid &input, Image::FilterType type)
Function to filter image pyramid.
virtual Eigen::Vector2d GetMin2DBound() const override
virtual CV_CLASS_ENUM getClassID() const override
Returns unique class ID.
Image & LinearTransform(double scale=1.0, double offset=0.0)
T * PointerAt(int u, int v) const
Function to access the raw data of a single-channel Image.
T * PointerAt(int u, int v, int ch) const
Function to access the raw data of a multi-channel Image.
virtual void onDeletionOf(const ccHObject *obj) override
This method is called when another object is deleted.
std::vector< std::shared_ptr< Image > > ImagePyramid
Typedef and functions for ImagePyramid.
Generic file read and write utility for python interface.