wx_human_seg 3.0.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
wonxai::WXImage Class Reference

#include <wx_image.h>

Public Types

enum  DataFormat {
  UNK = 0 , RGB = 1 , RGBA , ALPHA8 ,
  FLOAT32
}
 

Public Member Functions

virtual void toFile (const std::string &fileName)
 
virtual void toEncodedData (std::string &encodedData, const std::string &imgType)
 
virtual int width ()
 
virtual int height ()
 
virtual uint8_t * data ()
 
virtual DataFormat dataFormat ()
 

Static Public Member Functions

static std::shared_ptr< WXImagefromFile (const std::string &fileName)
 
static std::shared_ptr< WXImagefromEncodedData (const uint8_t *data, size_t size)
 
static std::shared_ptr< WXImagefromColor (int width, int height, uint8_t r, uint8_t g, uint8_t b)
 
static std::shared_ptr< WXImagefromBuffer (int width, int height, const uint8_t *rgbData)
 
static std::shared_ptr< WXImagefromRGBAData (int width, int height, const uint8_t *rgbaData)
 
static std::shared_ptr< WXImagefromImage (WXImage *other)
 
static WXImagefromFile2 (const std::string &fileName)
 
static WXImagefromEncodedData2 (const uint8_t *data, size_t size)
 
static WXImagefromColor2 (int width, int height, uint8_t r, uint8_t g, uint8_t b)
 
static WXImagefromBuffer2 (int width, int height, const uint8_t *rgbData)
 
static WXImagefromRGBAData2 (int width, int height, const uint8_t *rgbaData)
 

Detailed Description

class WXImage

Member Enumeration Documentation

◆ DataFormat

图像数据格式

Enumerator
UNK 

未知格式

RGB 

三通道RGB格式

RGBA 

四通道RGBA格式

ALPHA8 

单通道ALPHA格式

FLOAT32 

单通道浮点值

Member Function Documentation

◆ data()

virtual uint8_t * wonxai::WXImage::data ( )
virtual

返回图片数据,调用者不能从外面释放

◆ dataFormat()

virtual DataFormat wonxai::WXImage::dataFormat ( )
virtual

返回图片数据格式 DataFormat

◆ fromBuffer()

static std::shared_ptr< WXImage > wonxai::WXImage::fromBuffer ( int  width,
int  height,
const uint8_t *  rgbData 
)
static

根据给定的图像像素数据,创建WXImage对象,数据格式必须为RGB三通道,且连续存储

Exceptions
WXException

◆ fromBuffer2()

static WXImage * wonxai::WXImage::fromBuffer2 ( int  width,
int  height,
const uint8_t *  rgbData 
)
static
See also
fromBuffer

◆ fromColor()

static std::shared_ptr< WXImage > wonxai::WXImage::fromColor ( int  width,
int  height,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
static

创建一副纯色图,颜色值由r,g,b三个值指定

Exceptions
WXException

◆ fromColor2()

static WXImage * wonxai::WXImage::fromColor2 ( int  width,
int  height,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)
static
See also
fromColor

◆ fromEncodedData()

static std::shared_ptr< WXImage > wonxai::WXImage::fromEncodedData ( const uint8_t *  data,
size_t  size 
)
static

从图片原数据(即图片编码数据)创建WXImage对象,支持jpg和png图片

Exceptions
WXException

◆ fromEncodedData2()

static WXImage * wonxai::WXImage::fromEncodedData2 ( const uint8_t *  data,
size_t  size 
)
static
See also
fromEncodedData

◆ fromFile()

static std::shared_ptr< WXImage > wonxai::WXImage::fromFile ( const std::string &  fileName)
static

从图片文件创建WXImage对象,支持jpg和png图片

Exceptions
WXException

◆ fromFile2()

static WXImage * wonxai::WXImage::fromFile2 ( const std::string &  fileName)
static
See also
fromFile

◆ fromImage()

static std::shared_ptr< WXImage > wonxai::WXImage::fromImage ( WXImage other)
static

从另外一个WXImage对象复制一个新的WXImage对象

Exceptions
WXException

◆ fromRGBAData()

static std::shared_ptr< WXImage > wonxai::WXImage::fromRGBAData ( int  width,
int  height,
const uint8_t *  rgbaData 
)
static

根据给定的图像像素数据,创建WXImage对象,数据格式必须为RGBA四通道,且连续存储

Exceptions
WXException

◆ fromRGBAData2()

static WXImage * wonxai::WXImage::fromRGBAData2 ( int  width,
int  height,
const uint8_t *  rgbaData 
)
static
See also
fromRGBAData

◆ height()

virtual int wonxai::WXImage::height ( )
virtual

返回图片高度

◆ toEncodedData()

virtual void wonxai::WXImage::toEncodedData ( std::string &  encodedData,
const std::string &  imgType 
)
virtual

将图片保存为编码后的数据,支持jpg和png格式 param[in] encodedData 用于接收编码后的二进制数据 param[in] imgType 图片编码类型:jpg or png

Exceptions
WXException

◆ toFile()

virtual void wonxai::WXImage::toFile ( const std::string &  fileName)
virtual

将图片保存到文件,支持jpg和png图片 param[in] fileName 目标文件路径,扩展名必须为".jpg"或者".png"(不区分大小写)

Exceptions
WXException

◆ width()

virtual int wonxai::WXImage::width ( )
virtual

返回图片宽度


The documentation for this class was generated from the following file: