Represents a 2D image.
More...
#include <Image.h>
|
| Image (const aiTexture *const texture, const size_t &id) |
| Constructor from aiTexture. More...
|
|
virtual | ~Image () |
|
bool | inUse () const |
| Returns true if the image is in use. More...
|
|
void | bindToUnit (const GLenum unit) const |
| Bind this image to an OpenGL image unit. More...
|
|
const cv::Mat & | image () const |
| Returns this image as an OpenCV image. More...
|
|
|
| Image (const std::string &path) |
| Protected constructor for loading image from file. More...
|
|
| Image (const int rows, const int cols, const int type, const unsigned char *const data=NULL) |
| Protected constructor for creating image from raw data. More...
|
|
|
const size_t | id |
| Unique ID of this image.
|
|
cv::Mat | mat |
| OpenCV image.
|
|
size_t | usage |
| Internal usage counter, see get(), release() and inUse().
|
|
const std::string | path |
| File path from where the image was loaded.
|
|
gpu_coverage::Image::Image |
( |
const aiTexture *const |
texture, |
|
|
const size_t & |
id |
|
) |
| |
Constructor from aiTexture.
- Parameters
-
[in] | texture | The Assimp aiTexture from where to load this image. |
[in] | id | Unique ID for this image. |
For creating an Image from a file instead of an Assimp texture, use the static get() method.
virtual gpu_coverage::Image::~Image |
( |
| ) |
|
|
virtual |
gpu_coverage::Image::Image |
( |
const std::string & |
path | ) |
|
|
protected |
Protected constructor for loading image from file.
- Parameters
-
[in] | path | File path from where to load the image. |
Do not use this constructor, use the static get() method instead to allow for caching images.
gpu_coverage::Image::Image |
( |
const int |
rows, |
|
|
const int |
cols, |
|
|
const int |
type, |
|
|
const unsigned char *const |
data = NULL |
|
) |
| |
|
protected |
Protected constructor for creating image from raw data.
- Parameters
-
[in] | rows | Height of the image. |
[in] | cols | Width of the image. |
[in] | type | OpenCV image type. |
[in] | data | Raw data. |
void gpu_coverage::Image::bindToUnit |
( |
const GLenum |
unit | ) |
const |
Bind this image to an OpenGL image unit.
- Parameters
-
[in] | unit | The ID of the image unit. |
static const Image* gpu_coverage::Image::get |
( |
const std::string & |
path | ) |
|
|
static |
Construct and return an Image from a file.
- Parameters
-
[in] | path | File path from where to load the image. |
- Returns
- A new Image instance.
The image will be held in a cache. If this method gets called multiple times, the same instance will be returned from the cache and the usage counter will be incremented.
Call release() when the image is not needed anymore. If release() has been called the same number of times than the get() method, the Image will be deleted and removed from the cache.
const cv::Mat& gpu_coverage::Image::image |
( |
| ) |
const |
|
inline |
Returns this image as an OpenCV image.
- Returns
- OpenCV image.
bool gpu_coverage::Image::inUse |
( |
| ) |
const |
|
inline |
Returns true if the image is in use.
- Returns
- True if this image is in use.
- See also
- release()
static void gpu_coverage::Image::release |
( |
const Image * |
image | ) |
|
|
static |
Release the image.
- Parameters
-
[in] | image | The image to release. |
Calling this method decreases an internal usage counter. If release() has been called the same number of times than the get() method, the image will be deleted and removed from the cache.
The documentation for this class was generated from the following file: