Encapsulates an image.
More...
#include <Image.hh>
|
enum | PixelFormat {
UNKNOWN,
L_INT8,
L_INT16,
RGB_INT8,
RGBA_INT8,
BGRA_INT8,
RGB_INT16,
RGB_INT32,
BGR_INT8,
BGR_INT16,
BGR_INT32,
R_FLOAT16,
RGB_FLOAT16,
R_FLOAT32,
RGB_FLOAT32,
BAYER_RGGB8,
BAYER_RGGR8,
BAYER_GBRG8,
BAYER_GRBG8
} |
| Pixel formats enumeration. More...
|
|
|
| Image (const std::string &_filename="") |
| Constructor.
|
|
virtual | ~Image () |
| Destructor.
|
|
Color | GetAvgColor () |
| Get the average color.
|
|
unsigned int | GetBPP () const |
| Get the size of one pixel in bits.
|
|
void | GetData (unsigned char **_data, unsigned int &_count) const |
| Get the image as a data array.
|
|
std::string | GetFilename () const |
| Get the full filename of the image.
|
|
unsigned int | GetHeight () const |
| Get the height.
|
|
Color | GetMaxColor () |
| Get the max color.
|
|
int | GetPitch () const |
|
Color | GetPixel (unsigned int _x, unsigned int _y) |
| Get a pixel color value.
|
|
PixelFormat | GetPixelFormat () const |
| Get the pixel format.
|
|
void | GetRGBData (unsigned char **_data, unsigned int &_count) const |
| Get only the RGB data from the image.
|
|
unsigned int | GetWidth () const |
| Get the width.
|
|
int | Load (const std::string &_filename) |
| Load an image.
|
|
void | Rescale (int _width, int _height) |
| Rescale the image.
|
|
void | SavePNG (const std::string &_filename) |
| Save the image in PNG format.
|
|
void | SetFromData (const unsigned char *_data, unsigned int _width, unsigned int _height, Image::PixelFormat _format) |
| Set the image from raw data.
|
|
bool | Valid () const |
| Returns whether this is a valid image.
|
|
Pixel formats enumeration.
- Enumerator:
UNKNOWN |
|
L_INT8 |
|
L_INT16 |
|
RGB_INT8 |
|
RGBA_INT8 |
|
BGRA_INT8 |
|
RGB_INT16 |
|
RGB_INT32 |
|
BGR_INT8 |
|
BGR_INT16 |
|
BGR_INT32 |
|
R_FLOAT16 |
|
RGB_FLOAT16 |
|
R_FLOAT32 |
|
RGB_FLOAT32 |
|
BAYER_RGGB8 |
|
BAYER_RGGR8 |
|
BAYER_GBRG8 |
|
BAYER_GRBG8 |
|
gazebo::common::Image::Image |
( |
const std::string & |
_filename = "" | ) |
|
Constructor.
- Parameters
-
[in] | _filename | the path to the image |
virtual gazebo::common::Image::~Image |
( |
| ) |
|
|
virtual |
Color gazebo::common::Image::GetAvgColor |
( |
| ) |
|
Get the average color.
- Returns
- The average color
unsigned int gazebo::common::Image::GetBPP |
( |
| ) |
const |
Get the size of one pixel in bits.
- Returns
- The BPP of the image
void gazebo::common::Image::GetData |
( |
unsigned char ** |
_data, |
|
|
unsigned int & |
_count |
|
) |
| const |
Get the image as a data array.
- Parameters
-
[out] | _data | Pointer to a NULL array of char. |
[out] | _count | The resulting data array size |
std::string gazebo::common::Image::GetFilename |
( |
| ) |
const |
Get the full filename of the image.
- Returns
- The filename used to load the image
unsigned int gazebo::common::Image::GetHeight |
( |
| ) |
const |
Get the height.
- Returns
- The image height
Color gazebo::common::Image::GetMaxColor |
( |
| ) |
|
Get the max color.
- Returns
- The max color
int gazebo::common::Image::GetPitch |
( |
| ) |
const |
- Returns
- The pitch of the image
Color gazebo::common::Image::GetPixel |
( |
unsigned int |
_x, |
|
|
unsigned int |
_y |
|
) |
| |
Get a pixel color value.
- Parameters
-
[in] | _x | Column location in the image |
[in] | _y | Row location in the image |
PixelFormat gazebo::common::Image::GetPixelFormat |
( |
| ) |
const |
Get the pixel format.
- Returns
- PixelFormat
void gazebo::common::Image::GetRGBData |
( |
unsigned char ** |
_data, |
|
|
unsigned int & |
_count |
|
) |
| const |
Get only the RGB data from the image.
This will drop the alpha channel if one is present.
- Parameters
-
[out] | _data | Pointer to a NULL array of char. |
[out] | _count | The resulting data array size |
unsigned int gazebo::common::Image::GetWidth |
( |
| ) |
const |
Get the width.
- Returns
- The image width
int gazebo::common::Image::Load |
( |
const std::string & |
_filename | ) |
|
Load an image.
Return 0 on success
- Parameters
-
[in] | _filename | the path to the image file |
void gazebo::common::Image::Rescale |
( |
int |
_width, |
|
|
int |
_height |
|
) |
| |
Rescale the image.
- Parameters
-
[in] | _width | New image width |
[in] | _height | New image height |
void gazebo::common::Image::SavePNG |
( |
const std::string & |
_filename | ) |
|
Save the image in PNG format.
- Parameters
-
[in] | _filename | The name of the saved image |
void gazebo::common::Image::SetFromData |
( |
const unsigned char * |
_data, |
|
|
unsigned int |
_width, |
|
|
unsigned int |
_height, |
|
|
Image::PixelFormat |
_format |
|
) |
| |
Set the image from raw data.
- Parameters
-
[in] | _data | Pointer to the raw image data |
[in] | _width | Width in pixels |
[in] | _height | Height in pixels |
[in] | _format | Pixel format of the provided data |
bool gazebo::common::Image::Valid |
( |
| ) |
const |
Returns whether this is a valid image.
- Returns
- true if image has a bitmap
The documentation for this class was generated from the following file: