Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename T>
- class Image : public Eigen::Matrix <T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
- Image<RGB<unisgned char>> or Image<RGBA<float>>
- Image<unisgned char> image = ReadImage(const char* const filename);
- Image<unisgned char> image;
- bool b = ReadImage(const char* const filename, Image<unisgned char>& image)
- class BaseImage
- {
- public:
- inline BaseImage() {};
- virtual inline ~BaseImage() {};
- virtual inline int Width() const = 0;
- virtual inline int Height() const = 0;
- virtual inline int Depth() const = 0;
- etc...
- };
- template <typename T>
- class Image : public BaseImage, public Eigen::Matrix <T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
- class ImageFactory
- {
- typename <T>
- static BaseImage* createImage(const T* const src, const int& width, const int& height, const int& depth)
- {
- if (depth == 1)
- {
- return new Image<T>();
- }
- else if (depth == 3)
- {
- return new Image<RGB<T>>();
- }
- etc...
- }
- }
- class Image2
- {
- public:
- Image2(const char* const path)
- {
- // where ReadImage and external function that will call ImageFactory
- pBaseImage = ReadImage(path);
- }
- ~Image2();
- private:
- BaseImage* pBaseImage;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement