wx_human_seg 3.0.0
wx_image.h
Go to the documentation of this file.
1
6#ifndef WX_IMAGE_H_
7#define WX_IMAGE_H_
8#include <memory>
9#include <string>
10#include "wx_api.h"
11
12namespace wonxai {
13
15class WX_API WXImage {
16public:
20 UNK = 0,
21
23 RGB = 1,
24
27
30
32 FLOAT32
33 };
34
39 static std::shared_ptr<WXImage> fromFile(const std::string &fileName);
40
45 static std::shared_ptr<WXImage> fromEncodedData(const uint8_t *data, size_t size);
46
51 static std::shared_ptr<WXImage> fromColor(int width, int height,
52 uint8_t r, uint8_t g, uint8_t b);
53
58 static std::shared_ptr<WXImage> fromBuffer(int width, int height,
59 const uint8_t *rgbData);
60
65 static std::shared_ptr<WXImage> fromRGBAData(int width, int height,
66 const uint8_t *rgbaData);
67
72 static std::shared_ptr<WXImage> fromImage(WXImage *other);
73
77 static WXImage* fromFile2(const std::string &fileName);
78
82 static WXImage* fromEncodedData2(const uint8_t *data, size_t size);
83
87 static WXImage* fromColor2(int width, int height,
88 uint8_t r, uint8_t g, uint8_t b);
89
93 static WXImage* fromBuffer2(int width, int height,
94 const uint8_t *rgbData);
95
99 static WXImage* fromRGBAData2(int width, int height,
100 const uint8_t *rgbaData);
101
102 virtual ~WXImage();
103
109 virtual void toFile(const std::string &fileName);
110
117 virtual void toEncodedData(std::string &encodedData,
118 const std::string &imgType /* "jpg" or "png" */);
119
121 virtual int width();
122
124 virtual int height();
125
127 virtual uint8_t *data();
128
131
132protected:
133 WXImage();
134
135};
136
137}
138
139#endif //WX_IMAGE_H_
Definition: wx_image.h:15
static WXImage * fromColor2(int width, int height, uint8_t r, uint8_t g, uint8_t b)
virtual void toEncodedData(std::string &encodedData, const std::string &imgType)
static WXImage * fromEncodedData2(const uint8_t *data, size_t size)
DataFormat
Definition: wx_image.h:18
@ ALPHA8
Definition: wx_image.h:29
@ RGBA
Definition: wx_image.h:26
static WXImage * fromBuffer2(int width, int height, const uint8_t *rgbData)
virtual int height()
static std::shared_ptr< WXImage > fromImage(WXImage *other)
virtual DataFormat dataFormat()
virtual uint8_t * data()
static std::shared_ptr< WXImage > fromFile(const std::string &fileName)
static std::shared_ptr< WXImage > fromBuffer(int width, int height, const uint8_t *rgbData)
static WXImage * fromRGBAData2(int width, int height, const uint8_t *rgbaData)
static std::shared_ptr< WXImage > fromColor(int width, int height, uint8_t r, uint8_t g, uint8_t b)
virtual void toFile(const std::string &fileName)
static std::shared_ptr< WXImage > fromEncodedData(const uint8_t *data, size_t size)
static std::shared_ptr< WXImage > fromRGBAData(int width, int height, const uint8_t *rgbaData)
virtual int width()
static WXImage * fromFile2(const std::string &fileName)