Go to the documentation of this file.
26 #include <ignition/math/Color.hh>
42 "UNKNOWN_PIXEL_FORMAT",
70 UNKNOWN_PIXEL_FORMAT = 0,
97 const std::string &_format);
101 public:
explicit Image(
const std::string &_filename=
"");
109 public:
int Load(
const std::string &_filename);
113 public:
void SavePNG(
const std::string &_filename);
122 unsigned int _height,
129 unsigned int &_count)
const;
136 unsigned int &_count)
const;
166 public: ignition::math::Color
Pixel(
const unsigned int _x,
167 const unsigned int _y)
const;
180 public:
void Rescale(
int _width,
int _height);
187 private:
void GetDataImpl(
unsigned char **_data,
unsigned int &_count,
188 FIBITMAP *_img)
const;
192 private:
static int count;
195 private: FIBITMAP *bitmap;
198 private: std::string fullName;
ignition::math::Color AvgColor()
Get the average color.
unsigned int GetBPP() const
Get the size of one pixel in bits.
bool Valid() const
Returns whether this is a valid image.
@ BAYER_BGGR8
Definition: Image.hh:86
Forward declarations for the common classes.
Definition: Animation.hh:27
@ R_FLOAT32
Definition: Image.hh:83
void GetRGBData(unsigned char **_data, unsigned int &_count) const
Get only the RGB data from the image.
Image(const std::string &_filename="")
Constructor.
@ RGBA_INT8
Definition: Image.hh:74
@ BGR_INT16
Definition: Image.hh:79
common
Definition: FuelModelDatabase.hh:37
void Rescale(int _width, int _height)
Rescale the image.
@ PIXEL_FORMAT_COUNT
Definition: Image.hh:89
void GetData(unsigned char **_data, unsigned int &_count) const
Get the image as a data array.
@ RGB_INT32
Definition: Image.hh:77
@ R_FLOAT16
Definition: Image.hh:81
Encapsulates an image.
Definition: Image.hh:66
static Image::PixelFormat ConvertPixelFormat(const std::string &_format)
Convert a string to a Image::PixelFormat.
@ RGB_INT16
Definition: Image.hh:76
PixelFormat
Pixel formats enumeration.
Definition: Image.hh:69
@ RGB_FLOAT16
Definition: Image.hh:82
@ BAYER_GBRG8
Definition: Image.hh:87
@ BGRA_INT8
Definition: Image.hh:75
PixelFormat GetPixelFormat() const
Get the pixel format.
std::string GetFilename() const
Get the full filename of the image.
@ L_INT8
Definition: Image.hh:71
void SavePNG(const std::string &_filename)
Save the image in PNG format.
@ L_INT16
Definition: Image.hh:72
@ BGR_INT32
Definition: Image.hh:80
virtual ~Image()
Destructor.
@ BAYER_RGGB8
Definition: Image.hh:85
@ BAYER_GRBG8
Definition: Image.hh:88
@ BGR_INT8
Definition: Image.hh:78
@ UNKNOWN_PIXEL_FORMAT
Definition: Image.hh:70
unsigned int GetWidth() const
Get the width.
ignition::math::Color Pixel(const unsigned int _x, const unsigned int _y) const
Get a pixel color value.
unsigned int GetHeight() const
Get the height.
void SetFromData(const unsigned char *_data, unsigned int _width, unsigned int _height, Image::PixelFormat _format)
Set the image from raw data.
static std::string PixelFormatNames[]
String names for the pixel formats.
Definition: Image.hh:40
int Load(const std::string &_filename)
Load an image.
ignition::math::Color MaxColor() const
Get the max color.
@ RGB_FLOAT32
Definition: Image.hh:84
@ RGB_INT8
Definition: Image.hh:73