wx_human_seg 3.0.0
wx_human_matting.h
Go to the documentation of this file.
1
5#ifndef WX_HUMAN_MATTING_H_
6#define WX_HUMAN_MATTING_H_
7
8#include <cstdint>
9#include <memory>
10#include <string>
11#include "wx_api.h"
12#include "wx_exception.h"
13#include "wx_image.h"
14#ifdef ANDROID
15#include <jni.h>
16#endif
17namespace wonxai {
18class WXHumanMattingImpl;
19
20
21#ifdef ANDROID
32WX_API void WXSDKInitWithLicense(
33 JNIEnv *jniEnv, jobject applicationContext,
34 const char *appKey,
35 const char *licenseFilePath);
36
48WX_API void WXSDKInitWithLicense(
49 JNIEnv *jniEnv, jobject applicationContext,
50 const char *appKey,
51 uint8_t *licData, size_t licSize);
52#else
71WX_API void WXSDKInitWithLicense(const char *appKey,
72 const char* licenseFilePath);
73
93WX_API void WXSDKInitWithLicense(const char *appKey,
94 uint8_t *licData, size_t licSize);
95
96#endif
97
104WX_API void WXSDKTerminate();
105
112WX_API const char *WXSDKVersion();
113
117class WX_API WXSDKLicense {
118public:
119
130 static void setLicense(const std::string &licensePath);
131
143 static void setLicense(uint8_t *buffer, size_t size);
144
156 static void setLicense(const char *licensePath, const char *appKey);
157
170 static void setLicense(uint8_t *buffer, size_t size, const char *appKey);
171
180 static uint64_t validFrom();
181
190 static uint64_t expiredAt();
191
199 static const char *licenseId();
200private:
201 WXSDKLicense(){};
202};
203
207class WX_API WXHumanMatting final {
208public:
216 static void initialize();
217
224 static void terminate();
225
231 static const char *version();
232
240
242
254 void matting(const uint8_t *inRGB,
255 int width,
256 int height,
257 float *outAlpha);
258
273 std::shared_ptr<WXImage> removeBackground(const std::shared_ptr<WXImage> &inImage,
274 const std::shared_ptr<WXImage> &bkImage);
275
281 const WXImage *bkImage);
282
283private:
284 std::unique_ptr<WXHumanMattingImpl> _impl;
285};
286} //namespace wonxai
287
288#endif //WX_HUMAN_MATTING_H_
Definition: wx_human_matting.h:207
void matting(const uint8_t *inRGB, int width, int height, float *outAlpha)
matting函数,输入rgb像素图,输出alpha图
static void terminate()
进程结束前,调用此函数进行资源清理
std::shared_ptr< WXImage > removeBackground(const std::shared_ptr< WXImage > &inImage, const std::shared_ptr< WXImage > &bkImage)
图片去背景或换背景
static void initialize()
初始化SDK,调用其他接口(除license相关接口外)之前,需要先调用这个函数。
WXImage * removeBackground(const WXImage *inImage, const WXImage *bkImage)
图片去背景或换背景
WXHumanMatting(WXDeviceType deviceType=kDeviceCPU)
WXHumanMatting 构造函数
static const char * version()
返回SDK版本号
Definition: wx_image.h:15
Definition: wx_human_matting.h:117
static uint64_t expiredAt()
获取当前license文件的有效期过期时间戳
static void setLicense(const std::string &licensePath)
通过文件的方式,为SDK设置license,
static const char * licenseId()
获取当前license文件的licenseId
static void setLicense(uint8_t *buffer, size_t size)
通过内存的方式,为SDK设置license,
static void setLicense(uint8_t *buffer, size_t size, const char *appKey)
通过内存的方式,为SDK设置license,
static void setLicense(const char *licensePath, const char *appKey)
通过文件的方式,为SDK设置license,
static uint64_t validFrom()
获取当前license文件的有效期起始时间戳
WXDeviceType
Definition: wx_api.h:21
@ kDeviceCPU
Definition: wx_api.h:23
WX_API const char * WXSDKVersion()
进程结束前,调用此函数进行资源清理
WX_API void WXSDKTerminate()
进程结束前,调用此函数进行资源清理
WX_API void WXSDKInitWithLicense(const char *appKey, const char *licenseFilePath)
初始化SDK,并且通过文件方式,为SDK设置license,