public class QueenEngine
extends java.lang.Object
Constructor and Description |
---|
QueenEngine(Context context) |
QueenEngine(Context context,
boolean toScreen) |
QueenEngine(Context context,
boolean withContext,
boolean toScreen) |
QueenEngine(Context context,
long instancePtr,
QueenConfig queenConfig) |
QueenEngine(Context context,
QueenConfig config) |
Modifier and Type | Method and Description |
---|---|
boolean |
addMaterial(java.lang.String path)
Add sticker resources
|
long |
allocateNativeBuffer(byte[] javaBuffer)
Pass the java memory to the native side and allocate the corresponding native memory
|
Texture2D |
autoGenOutTexture() |
Texture2D |
autoGenOutTexture(boolean keepInputDirection) |
void |
cleanScreen4ArWriting()
Clean Screen for ArWriting
|
long |
copyNativeBuffer(long nativeBufferPtr,
long bufferSize)
Pass the java memory to the native side and allocate the corresponding native memory
|
Texture2D |
createTexture2D()
Create texture handle
|
void |
enableBeautyType(int type,
boolean enable)
Turn on or off the beauty module
|
void |
enableBeautyType(int type,
boolean enable,
boolean debug)
Turn on or off the beauty module
|
void |
enableBeautyType(int type,
boolean enable,
boolean debug,
int mode)
Turn on or off the beauty module
|
void |
enableBeautyType(int type,
boolean enable,
int mode)
Turn on or off the beauty module
|
void |
enableDebugLog() |
void |
enableDetectPointDebug(int algId,
boolean enablePoint)
Turn on the detection point debugging mode to display vertices such as faces/gestures/bones
|
void |
enableFacePointDebug(boolean facepoint)
Deprecated.
|
float |
getBeautyParam(int type)
Get the current beauty parameters
|
Context |
getContext()
Get the Android Context instance
|
long |
getEngineHandler()
Get Engine Handler In Native
|
long |
getLicenseExpirationTime() |
boolean |
isRenderAsync()
Whether to render asynchronously
|
void |
release()
Release All Resource
|
void |
releaseNativeBuffer(long nativeBuffer)
free native memory
|
boolean |
removeMaterial(java.lang.String path)
Remove sticker resources
|
int |
render()
render
The return value is defined as follows:
QUEEN_OK = 0,
QUEEN_FAIL = -1,
QUEEN_INVALID_HANDLE = -2,
QUEEN_INVALID_PARAMS = -3,
QUEEN_TIMEOUT = -4,
QUEEN_FILE_ERROR = -5,
QUEEN_FILE_NOT_EXIST = -6,
QUEEN_UNZIP_ERROR = -7,
QUEEN_NET_ERROR = -8,
QUEEN_INVALID_LICENSE = -9,
QUEEN_NO_EFFECT = -10
|
int |
renderTexture(float[] transformMatrix)
Update the matrix of the input texture and render
The return value is defined as follows:
QUEEN_OK = 0,
QUEEN_FAIL = -1,
QUEEN_INVALID_HANDLE = -2,
QUEEN_INVALID_PARAMS = -3,
QUEEN_TIMEOUT = -4,
QUEEN_FILE_ERROR = -5,
QUEEN_FILE_NOT_EXIST = -6,
QUEEN_UNZIP_ERROR = -7,
QUEEN_NET_ERROR = -8,
QUEEN_INVALID_LICENSE = -9,
QUEEN_NO_EFFECT = -10
|
void |
resetBodySportPoseDetectCount(boolean resetCount)
Reset The Count of Body Sport Pose Detect
|
void |
setAISegmentForegroundPadding(int padding) |
void |
setAlgAsych(int algType,
boolean enable) |
void |
setAlgResourcePath(int algType,
java.lang.String path)
Set Algorithm Type
|
void |
setArWriting(boolean enable,
int mode)
Switch of ArWriting
|
void |
setBeautyParam(int type,
float value)
Set beauty parameters
|
void |
setBodyPoseDetectType(int type)
Set What Type For Body Pose Detect
|
void |
setFilter(java.lang.String path)
Set the filter image path
|
void |
setFilter(java.lang.String path,
boolean flipY)
Set the filter image path
|
void |
setGreenScreen(java.lang.String backgroundPath,
boolean blueScreenEnabled,
float threshold,
boolean autoThresholdEnabled)
Set the green screen matting parameters.
|
void |
setHairColor(float red,
float green,
float blue)
Set hair color
|
void |
setInputBitMap(Bitmap bitmap)
Setting input by bitmap, the first setting will render in the downward direction by default
|
void |
setInputFlip(int flip) |
void |
setInputTexture(int texture,
int width,
int height,
boolean isOES)
Setting Input Texture
|
void |
setMakeupAlpha(int type,
float alpha,
float maleAlpha)
Set Makeup transparency
|
void |
setMakeupImage(int type,
java.lang.String[] path,
int blend,
int fps)
Set beauty material
|
void |
setOutputRect(int originX,
int originY,
int width,
int height) |
void |
setPowerSaving(boolean enable)
Set energy saving mode: reduce the amount of computation
Note: Please call before initializing and setting beauty parameters
|
void |
setPureColorToBackground(java.lang.String backgroundPath,
int colorType,
float threshold) |
void |
setRenderAndFaceFlip(int renderFlip,
int faceFlip)
Default rendering up, info down in Android
|
void |
setScreenViewport(int left,
int bottom,
int width,
int height)
Set the rendered viewport, if not set the default, use the initial width and height
|
void |
setSegmentBackgroundProcessType(int type) |
void |
setSegmentInfoFlipY(boolean segmentInfoFlipY)
Set whether to flip the green screen cutout background
|
void |
setSegmentPerformanceMode(int mode)
Choose performance mode for background segment.
|
void |
updateBodyShape(int type,
float level) |
void |
updateFaceShape(int type,
float level)
Set shaping parameters
|
void |
updateInputDataAndRunAlg(Bitmap bitmap) |
void |
updateInputDataAndRunAlg(byte[] imageData,
int format,
int width,
int height,
int stride,
int intputAngle,
int outAngle,
int flipAxis)
Update the input data and run the algorithm
|
void |
updateInputDataAndRunAlg(byte[] imageData,
int format,
int width,
int height,
int stride,
int inputAngle,
int outAngle,
int flipAxis,
boolean reuseData)
Video frame data update processing, used for data processing of engine algorithm layer
|
void |
updateInputDataAndRunAlg(byte[] imageData,
int format,
int width,
int height,
int stride,
int inputAngle,
int outAngle,
int flipAxis,
boolean reuseData,
boolean usePreviousFrame)
Video frame data update processing, used for data processing of engine algorithm layer
|
void |
updateInputMatrix(float[] transformMatrix) |
void |
updateInputNativeBufferAndRunAlg(long imageNativeBuffer,
int format,
int width,
int height,
int stride,
int inputAngle,
int outAngle,
int flipAxis)
Video frame data update processing, used for data processing of engine algorithm layer
|
void |
updateInputTexture(int texture)
Update the texture id if the id is changed
|
void |
updateInputTextureBufferAndRunAlg(int inputAngle,
int outAngle,
int flipAxis,
boolean usePreviousFrame)
Video frame data update processing, used for data processing of engine algorithm layer
|
void |
updateOutTexture(int textureId,
int width,
int height)
When the texture created by the access party needs to be used, update through this interface
|
void |
updateOutTexture(int textureId,
int width,
int height,
boolean keepInputDirection)
Update the output texture
|
public QueenEngine(Context context) throws InitializationException
InitializationException
public QueenEngine(Context context, boolean toScreen) throws InitializationException
context
- toScreen
- Is Need To Render To Screen(FBO)InitializationException
public QueenEngine(Context context, boolean withContext, boolean toScreen) throws InitializationException
context
- withContext
- Is Need To Created GL By EnginetoScreen
- Is Need To Render To Screen(FBO)InitializationException
public QueenEngine(Context context, QueenConfig config) throws InitializationException
InitializationException
public QueenEngine(Context context, long instancePtr, QueenConfig queenConfig) throws InitializationException
InitializationException
public long getEngineHandler()
public void setAlgResourcePath(@AlgType int algType, java.lang.String path)
algType
- path
- public void setInputTexture(int texture, int width, int height, boolean isOES)
texture
- Input Texture Idwidth
- Width of Textureheight
- Height of TextureisOES
- Is Oes Texturepublic void updateInputTexture(int texture)
texture
- The new texture idpublic void setInputBitMap(Bitmap bitmap)
bitmap
- public void setScreenViewport(int left, int bottom, int width, int height)
left
- bottom
- width
- height
- public void setOutputRect(int originX, int originY, int width, int height)
public void updateOutTexture(int textureId, int width, int height)
textureId
- new textureIdwidth
- The output texture width, which needs to be consistent with the output texture size specified when setting the input textureheight
- The output texture width, which needs to be consistent with the output texture size specified when setting the input texturepublic void updateOutTexture(int textureId, int width, int height, boolean keepInputDirection)
textureId
- out put textureIDwidth
- The output texture width, which needs to be consistent with the output texture size specified when setting the input textureheight
- The output texture height, which needs to be consistent with the output texture size specified when setting the input texturekeepInputDirection
- 保持与输入纹理方向一致public void setRenderAndFaceFlip(@Flip int renderFlip, @Flip int faceFlip)
renderFlip
- rendering directionfaceFlip
- direction of faceinfopublic void enableBeautyType(@BeautyFilterType int type, boolean enable)
type
- Feature Typeenable
- Turn on or offpublic void enableBeautyType(@BeautyFilterType int type, boolean enable, boolean debug)
type
- Feature Typeenable
- Turn on or offdebug
- Is debug modepublic void enableBeautyType(@BeautyFilterType int type, boolean enable, @BeautyFilterMode int mode)
type
- Feature Typeenable
- Turn on or offmode
- BeautyFilterModepublic void enableBeautyType(@BeautyFilterType int type, boolean enable, boolean debug, @BeautyFilterMode int mode)
type
- Feature Typeenable
- Turn on or offdebug
- Is debug modemode
- BeautyFilterModepublic void setBeautyParam(@BeautyParams int type, float value)
type
- beauty featurevalue
- valuespublic float getBeautyParam(@BeautyParams int type)
type
- public void setMakeupImage(@MakeupType int type, java.lang.String[] path, @BlendType int blend, int fps)
type
- type of makeuppath
- the path of materialblend
- the mode of blendfps
- Reserved parameters (dynamic material), fill in 15 by defaultpublic void setMakeupAlpha(@MakeupType int type, float alpha, float maleAlpha)
type
- type of makeupalpha
- alphamaleAlpha
- NOT SUPPORTpublic void updateFaceShape(@FaceShapeType int type, float level)
type
- level
- public void updateBodyShape(@BodyShapeType int type, float level)
public void setInputFlip(@Flip int flip)
public void updateInputMatrix(float[] transformMatrix)
@QueenResult public int render()
public Texture2D autoGenOutTexture()
public Texture2D autoGenOutTexture(boolean keepInputDirection)
@QueenResult public int renderTexture(float[] transformMatrix)
transformMatrix
- 纹理矩阵public boolean isRenderAsync()
public void updateInputDataAndRunAlg(byte[] imageData, @ImageFormat int format, int width, int height, int stride, int intputAngle, int outAngle, int flipAxis)
public void updateInputTextureBufferAndRunAlg(int inputAngle, int outAngle, int flipAxis, boolean usePreviousFrame)
inputAngle
- : The angle entered at the current frameoutAngle
- : The angle that the output data needs to be transformedflipAxis
- : The xy-axis flip processing of the output data, 0 is no rotation, 1 is the x-axis flip, 2 is the y-axis flipusePreviousFrame
- : Whether to multiplex the data of the previous framepublic void updateInputDataAndRunAlg(byte[] imageData, @ImageFormat int format, int width, int height, int stride, int inputAngle, int outAngle, int flipAxis, boolean reuseData)
imageData
- : 当前帧数据format
- : input formatwidth
- : frame data widthheight
- : frame data highstride
- : The stride (in pixels) of the image used for detection, i.e. the number of bytes per line, set to 0 by defaultinputAngle
- : The angle entered at the current frameoutAngle
- : The angle that the output data needs to be transformedflipAxis
- : The xy-axis flip processing of the output data, 0 is no rotation, 1 is the x-axis flip, 2 is the y-axis flipreuseData
- : Whether the current frame data needs to be reused later, if it needs to be reused (true), the engine will not directly modify the frame data, and will copy a copy internally; if it is not needed to be reused (false), the engine will use the copy directly Buffer data, do not copy data, to improve performancepublic void updateInputDataAndRunAlg(byte[] imageData, @ImageFormat int format, int width, int height, int stride, int inputAngle, int outAngle, int flipAxis, boolean reuseData, boolean usePreviousFrame)
imageData
- : current frame dataformat
- : input formatwidth
- : frame data widthheight
- : frame data highstride
- : The stride (in pixels) of the image used for detection, i.e. the number of bytes per line, set to 0 by defaultinputAngle
- : The angle entered at the current frameoutAngle
- : The angle that the output data needs to be transformedflipAxis
- : The xy-axis flip processing of the output data, 0 is no rotation, 1 is the x-axis flip, 2 is the y-axis flipreuseData
- : Whether the current frame data needs to be reused later, if it needs to be reused (true), the engine will not directly modify the frame data, and will copy a copy internally; if it is not needed to be reused (false), the engine will use the copy directly Buffer data, do not copy data, to improve performanceusePreviousFrame
- : Whether to multiplex the data of the previous framepublic void updateInputDataAndRunAlg(Bitmap bitmap)
public void updateInputNativeBufferAndRunAlg(long imageNativeBuffer, @ImageFormat int format, int width, int height, int stride, int inputAngle, int outAngle, int flipAxis)
imageNativeBuffer
- : the native buffer for current frame dataformat
- : input formatwidth
- : frame data widthheight
- : frame data highstride
- : The stride (in pixels) of the image used for detection, i.e. the number of bytes per line, set to 0 by defaultinputAngle
- : The angle entered at the current frameoutAngle
- : The angle that the output data needs to be transformedflipAxis
- : The xy-axis flip processing of the output data, 0 is no rotation, 1 is the x-axis flip, 2 is the y-axis flippublic long allocateNativeBuffer(byte[] javaBuffer)
javaBuffer
- public long copyNativeBuffer(long nativeBufferPtr, long bufferSize)
nativeBufferPtr
- bufferSize
- public void releaseNativeBuffer(long nativeBuffer)
nativeBuffer
- public void setFilter(java.lang.String path)
path
- Filter source pathpublic void setFilter(java.lang.String path, boolean flipY)
path
- Filter source pathflipY
- public void setAISegmentForegroundPadding(int padding)
public void setSegmentBackgroundProcessType(@BackgroundProcessType int type)
public void setSegmentPerformanceMode(@SegmentPerformanceMode int mode)
public void enableDebugLog()
public void setAlgAsych(@AlgType int algType, boolean enable)
public boolean addMaterial(java.lang.String path)
path
- public boolean removeMaterial(java.lang.String path)
path
- public Texture2D createTexture2D()
public void release()
@Deprecated public void enableFacePointDebug(boolean facepoint)
facepoint
- public void enableDetectPointDebug(@AlgType int algId, boolean enablePoint)
enablePoint
- public Context getContext()
public void setHairColor(float red, float green, float blue)
red
- [0,1]green
- [0,1]blue
- [0,1]public void setGreenScreen(java.lang.String backgroundPath, boolean blueScreenEnabled, float threshold, boolean autoThresholdEnabled)
backgroundPath
- blueScreenEnabled
- threshold
- Curtain sensitivity [1,10], default 1autoThresholdEnabled
- Whether to dynamically calculate the sensitivity of the screen according to the environment, if it is true, the adjustment parameter threshold will be invalid, and if it is false, the adjustment parameter threshold will take effect.public void setPureColorToBackground(java.lang.String backgroundPath, int colorType, float threshold)
public void setSegmentInfoFlipY(boolean segmentInfoFlipY)
segmentInfoFlipY
- public void setArWriting(boolean enable, int mode)
enable
- mode
- 1 - writing, 2 - paintingpublic void cleanScreen4ArWriting()
public void setBodyPoseDetectType(int type)
public void resetBodySportPoseDetectCount(boolean resetCount)
public void setPowerSaving(boolean enable)
enable
- public long getLicenseExpirationTime()