31 #ifndef INCLUDE_ARTICULATION_IMAGE_H_ 32 #define INCLUDE_ARTICULATION_IMAGE_H_ 34 #include <assimp/scene.h> 39 #include <opencv2/core/core.hpp> 46 #define GL_BGRA GL_RGBA 54 Mat() : rows(0), cols(0), type(0), data(NULL) {}
55 Mat(
const int rows,
const int cols,
const int type,
const void *
const data) : rows(rows), cols(cols), type(type), data(NULL), allocatedData(false) {
57 case CV_8UC3: nchannels = 3;
break;
58 case CV_8UC4: nchannels = 4;
break;
59 default:
throw std::invalid_argument(
"Unknown type");
61 this->data = (
unsigned char *) data;
63 Mat(
const int rows,
const int cols,
const int type) : rows(rows), cols(cols), type(type), data(NULL), allocatedData(true) {
65 case CV_8UC3: nchannels = 3;
break;
66 case CV_8UC4: nchannels = 4;
break;
67 default:
throw std::invalid_argument(
"Unknown type");
69 data = (
unsigned char *) calloc(rows * cols * nchannels,
sizeof(
unsigned char));
71 Mat(
const Mat& other) : data(NULL), allocatedData(true) {
75 nchannels = other.nchannels;
76 data = (
unsigned char *) calloc(rows * cols * nchannels,
sizeof(
unsigned char));
77 memcpy(data, other.data, rows * cols * nchannels);
86 inline const int& channels()
const {
111 Image(
const aiTexture *
const texture,
const size_t&
id);
132 static const Image *
get(
const std::string& path);
143 static void release(
const Image * image);
158 void bindToUnit(
const GLenum unit)
const;
175 Image(
const std::string& path);
184 Image(
const int rows,
const int cols,
const int type,
const unsigned char *
const data = NULL);
Represents a 2D image.
Definition: Image.h:102
bool inUse() const
Returns true if the image is in use.
Definition: Image.h:150
const cv::Mat & image() const
Returns this image as an OpenCV image.
Definition: Image.h:164
const size_t id
Unique ID of this image.
Definition: Image.h:186
Definition: AbstractCamera.h:41
const std::string path
File path from where the image was loaded.
Definition: Image.h:189
size_t usage
Internal usage counter, see get(), release() and inUse().
Definition: Image.h:188
cv::Mat mat
OpenCV image.
Definition: Image.h:187