类 TIEPass
Note:
- All methods of TIEPass must be called within the same GLThread. Always ensure to call all methods of TIEPass within the same GLThread to guarantee correct execution and avoid potential issues.
- The
render(int)
method should not be called before theinit(int, int)
method, and it should not be called after thedeInit()
method.
Usage:
- (In glThread) Create a TIEPass object using the constructor.
- (In glThread) Initialize the TIEPass object by calling the
init(int, int)
method. This method sets the input image width and height. - (In glThread) Perform image enhancement rendering on an input OpenGL texture by calling the
render(int)
method. This method returns the enhanced texture ID. - (In glThread) Release resources when the TIEPass object is no longer needed by calling the
deInit()
method. This ensures proper release of OpenGL-related resources.
Example:
// The code below must be executed in the same glThread. //----------------------GL Thread---------------------// // Create a TIEPass object using the constructor. TIEPass tiePass = new TIEPass(TIEPass.TIEAlgorithmType.PROFESSIONAL_HIGH_QUALITY); // Alternatively, create a TIEPass object with the professional fast rendering type. // TIEPass tiePass = new TIEPass(TIEPass.TIEAlgorithmType.PROFESSIONAL_FAST); // Initialize TIEPass and set the input image width and height. tiePass.init(inputWidth, inputHeight); // If the type of inputTexture is TextureOES, you must transform it to Texture2D. // Conversion code can be written according to actual requirements. // Perform image enhancement rendering on the input OpenGL texture and get the enhanced texture ID. int outputTextureId = tiePass.render(inputTextureId); // Release resources when the TIEPass object is no longer needed. tiePass.deInit(); //----------------------GL Thread---------------------//
-
嵌套类概要
修饰符和类型类说明static enum
The TIEAlgorithmType enum represents the algorithm running mode to be used for image enhancement. -
构造器概要
构造器说明TIEPass
(TIEPass.TIEAlgorithmType algorithmType) Constructs a TIEPass object for image enhancement. -
方法概要
修饰符和类型方法说明void
deInit()
Releases the resources associated with the TIEPass object.boolean
init
(int inputWidth, int inputHeight) Initializes the TIEPass object for image enhancement.int
render
(int textureId) Performs the image enhancement rendering operation on the input image.int
render
(int textureId, float[] transformMatrix) Performs the image enhancement rendering operation on the input image with a specified transform matrix.
-
构造器详细资料
-
TIEPass
Constructs a TIEPass object for image enhancement. This constructor should be called afterTSRSdk.init(long, int, TSRSdk.TSRSdkLicenseVerifyResultCallback, TSRLogger)
to ensure proper initialization. The created TIEPass object provides image enhancement functionality based on the specifiedTIEPass.TIEAlgorithmType
.- 参数:
algorithmType
- The TIEAlgorithmType enum value representing the algorithm running mode to be used for image enhancement. It can be either PROFESSIONAL_FAST or PROFESSIONAL_HIGH_QUALITY.- PROFESSIONAL_FAST mode prioritizes better performance in terms of speed, possibly sacrificing some image quality.
- PROFESSIONAL_HIGH_QUALITY mode prioritizes better image quality, even if the running speed is slower.
-
-
方法详细资料
-
init
public boolean init(int inputWidth, int inputHeight) Initializes the TIEPass object for image enhancement. This method must be called within the GLThread. The input parameters specify the dimensions of the input image to be enhanced.- 参数:
inputWidth
- The width of the input image to be enhanced. This value should be greater than zero.inputHeight
- The height of the input image to be enhanced. This value should be greater than zero.- 返回:
- A boolean value indicating the result of the initialization.
- Returns true if the initialization is successful.
- Returns false if the initialization fails.
-
render
public int render(int textureId) Performs the image enhancement rendering operation on the input image. This method must be called within the GLThread.This method applies the image enhancement rendering process to the input image, improving its quality. The processed image is rendered onto a texture within the TIEPass object, and the texture's ID is returned.
NOTE:
- The type of the texture corresponding to the textureId you pass in must be texture2D.
- The format of the input OpenGL texture must be GL_RGBA.
- The format of the output textureId is also GL_RGBA.
- 参数:
textureId
- The OpenGL textureId of the input image that needs to be processed for image enhancement. The corresponding texture is a texture2D texture with GL_RGBA format.- 返回:
- The textureId of the texture2D after image enhancement rendering, which is stored inside the TIEPass object. The format of the output texture is GL_RGBA. The size of the output texture is (inputWidth, inputHeight).
-
render
public int render(int textureId, float[] transformMatrix) Performs the image enhancement rendering operation on the input image with a specified transform matrix. This method must be called within the GLThread.This method applies the image enhancement rendering process to the input image, improving its quality, and uses the given transform matrix to manipulate the image during the rendering process. The processed image is rendered onto a texture within the TIEPass object, and the texture's ID is returned.
NOTE:
- The type of the texture corresponding to the textureId you pass in must be texture2D.
- The format of the input OpenGL texture must be GL_RGBA.
- The format of the output textureId is also GL_RGBA.
- 参数:
textureId
- The OpenGL textureId of the input image that needs to be processed for image enhancement. The corresponding texture is a texture2D texture with GL_RGBA format.transformMatrix
- A float array representing the transform matrix to be applied to the input image during the rendering process. The matrix should be in column-major order and of size 16. The transform matrix can be used to apply various transformations, such as rotation, scaling, and translation, to the input image during the rendering process.- 返回:
- The textureId of the texture2D after image enhancement rendering and applying the transform matrix, which is stored inside the TIEPass object. The format of the output texture is GL_RGBA. The size of the output texture is (inputWidth, inputHeight).
-
deInit
public void deInit()Releases the resources associated with the TIEPass object.This method should be called when the TIEPass object is no longer needed, to free up memory and other resources. Failing to call this method may lead to memory leaks or other issues.
After calling this method, the TIEPass object should not be used for any further operations.
-