We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

ImageSuperResolution

Class Info

com.huawei.hiai.vision.image.sr.ImageSuperResolution

Performs super-resolution processing on the input image, and returns the processed image, as well as the execution result code.

Public Constructor Summary

Constructor Name

ImageSuperResolution(Context context)

Constructs an ImageSuperResolution object.

Public Method Summary

Qualifier and Type

Method Name

void

setScale(float scale)

(Compatible with the earlier aar package, not recommended) Sets the scale of super resolution.

void

setQuality(int quality)

(Compatible with the earlier aar package, not recommended) Sets the quality of super resolution.

void

setSuperResolutionConfiguration(SuperResolutionConfiguration superResolutionConfiguration)

(Compatible with the earlier aar package, not recommended) Sets super resolution parameters. If this function is not called, 1x super resolution is used by default.

ImageResult

doSuperResolution(Frame frame, IVisionCallback cb)

(Compatible with the earlier aar package, not recommended) Performs super resolution processing on an image and returns the result.

void

setBitmap(Bitmap bitmap)

(Compatible with the earlier aar package, not recommended) Sets the result Bitmap.

void

setResultCode(int resultCode)

(Compatible with the earlier aar package, not recommended) Sets the result code.

float

getScale()

(Compatible with the earlier aar package, not recommended) Obtains the scale of super resolution.

int

getQuality()

(Compatible with the earlier aar package, not recommended) Obtains the quality of super resolution.

Bitmap

getBitmap()

(Compatible with the earlier aar package, not recommended) Obtains the result Bitmap of super resolution.

int

getResultCode()

(Compatible with the earlier aar package, not recommended) Obtains the result code.

void

setScale(float scale)

(EMUI 10.0 or later) Sets the scale of super resolution.

void

setQuality(int quality)

(EMUI 10.0 or later) Sets the quality of super resolution.

void

setSuperResolutionConfiguration(SISRConfiguration config)

(EMUI 10.0 or later) Sets super resolution parameters. If this function is not called, or the input is null, 1x super resolution with the highest quality is used by default.

int

doSuperResolution(VisionImage image, ImageResult result, VisionCallback<ImageResult> sisrCallback)

(EMUI 10.0 or later) Performs super resolution processing on an image and returns the result code.

void

setBitmap(Bitmap bitmap)

(EMUI 10.0 or later) Sets the result Bitmap.

float

getScale()

(EMUI 10.0 or later) Obtains the scale of super resolution.

int

getQuality()

(EMUI 10.0 or later) Obtains the quality of super resolution.

Bitmap

getBitmap()

(EMUI 10.0 or later) Obtains the result Bitmap.

Public Constructors

TxtImageSuperResolution

Constructor

public ImageSuperResolution(Context context)

Creates an image super-resolution constructor instance.

Parameters

Name

Description

context

App context.

Public Methods

setScale

Method

public void setScale(float scale)

(Compatible with the earlier aar package, not recommended) Sets the scale of super resolution.

Parameters

Name

Description

scale

The super resolution scale. Currently, SuperResolutionConfiguration.SISR_SCALE_1X and SuperResolutionConfiguration.SISR_SCALE_3X are supported.

setQuality

Method

public void setQuality(int quality)

(Compatible with the earlier aar package, not recommended) Sets the quality of super resolution.

Parameters

Name

Description

quality

Super resolution quality. This parameter is reserved. The highest quality is always used for now.

setSuperResolutionConfiguration

Method

public void setSuperResolutionConfiguration(SuperResolutionConfiguration superResolutionConfiguration)

(Compatible with the earlier aar package, not recommended) Sets super resolution parameters. If this function is not called, 1x super resolution is used by default.

Parameters

Name

Description

superResolutionConfiguration

Type from com.huawei.hiai.vision.visionkit.image.sr, which describes the super resolution configurations. If the input is null, the default value 1x is used.

doSuperResolution

Method

public ImageResult doSuperResolution(Frame frame, IVisionCallback cb)

(Compatible with the earlier aar package, not recommended) Performs super resolution processing on an image and returns the result.

Parameters

Name

Description

frame

Type from com.huawei.hiai.vision.visionkit.common, which describes the input image. Currently, grayscale images and RGB images are supported. In Java, the Bitmap is in ALPHA_8 or ARGB_8888 format. For details about the supported maximum image size, see the restrictions in the Service Introduction.

cb

Callback function used to return the result in asynchronous processing. Asynchronous processing is not supported at present. You can set this parameter to null.

Return

Type

Description

ImageResult

The super-resolution processing result. The result Bitmap is encapsulated internally, and the get or set method can be called. It should have the same pixel format as the Bitmap in the input frame. If the input parameters do not meet the preceding requirements, the processing fails and the returned result is null.

setBitmap

Method

public void setBitmap(Bitmap bitmap)

(Compatible with the earlier aar package, not recommended) Sets the result Bitmap.

Parameters

Name

Description

bitmap

Android Bitmap type, which is used to set the result image.

setResultCode

Method

public void setResultCode(int resultCode)

(Compatible with the earlier aar package, not recommended) Sets the result code.

Parameters

Name

Description

bitmap

Android Bitmap type, which is used to set the result image.

getScale

Method

public float getScale()

(Compatible with the earlier aar package, not recommended) Obtains the scale of super resolution.

Return

Type

Description

float

The super resolution scale.

getQuality

Method

public int getQuality()

(Compatible with the earlier aar package, not recommended) Obtains the quality of super resolution.

Return

Type

Description

int

Super resolution quality.

getBitmap

Method

public Bitmap getBitmap()

(Compatible with the earlier aar package, not recommended) Obtains the result Bitmap of super resolution.

Return

Type

Description

Bitmap

Bitmap of the ImageResult class object in the super-resolution result.

getResultCode

Method

public int getResultCode()

(Compatible with the earlier aar package, not recommended) Obtains the result code.

Return

Type

Description

int

Result code of the ImageResult class object in the super-resolution result. The value 0 indicates that no error occurs. For details, see com.huawei.hiai.common.HwHiAIResultCode.

setScale

Method

public void setScale(float scale)

(EMUI 10.0 or later) Sets the scale of super resolution.

Parameters

Name

Description

scale

The super resolution scale. Currently, SuperResolutionConfiguration.SISR_SCALE_1X and SuperResolutionConfiguration.SISR_SCALE_3X are supported.

setQuality

Method

public void setQuality(int quality)

(EMUI 10.0 or later) Sets the quality of super resolution.

Parameters

Name

Description

quality

Super resolution quality. Currently, SISRConfiguration.SISR_QUALITY_LOW, SISRConfiguration.SISR_QUALITY_MEDIUM, and SISRConfiguration.SISR_QUALITY_HIGH are supported. This parameter is reserved. The highest quality is always used for now.

setSuperResolutionConfiguration

Method

public void setSuperResolutionConfiguration(SISRConfiguration config)

(EMUI 10.0 or later) Sets super resolution parameters. If this function is not called, or the input is null, 1x super resolution with the highest quality is used by default.

Parameters

Name

Description

config

Type from com.huawei.hiai.vision.visionkit.image.sr, which describes the super resolution configurations. If the input is null, the default value 1x is used.

doSuperResolution

Method

public int doSuperResolution(VisionImage image, ImageResult result, VisionCallback<ImageResult> sisrCallback)

(EMUI 10.0 or later) Performs super resolution processing on an image and returns the result code. image indicates the input image. If sisrCallback is null, doSuperResolution is called synchronously, and the super-resolution image is output from the second parameter. If sisrCallback is not null, doSuperResolution is asynchronously called (HwHiAIResultCode.AIRESULT_ASYNC_MODE is returned upon success), and sisrCallback specifies the callback function object in asynchronous mode. The super-resolution image is returned through callback.

Parameters

Name

Description

image

Input image description, which is from the com.huawei.hiai.vision.common type. The Bitmap can be specified. Currently, grayscale images and RGB images are supported. In Java, the Bitmap is in ALPHA_8 or ARGB_8888 format. For details about the supported maximum image size, see the Development Guide.

result

If doSuperResolution is called synchronously (see the sisrCallback parameter), the processed super-resolution image is output from this parameter. If doSuperResolution is called asynchronously, this parameter is invalid.

sisrCallback

If sisrCallback is null, doSuperResolution is called synchronously, and the super-resolution image is output from result. If sisrCallback is not null, doSuperResolution is asynchronously called (HwHiAIResultCode.AIRESULT_ASYNC_MODE is returned upon success), and sisrCallback specifies the callback function object in asynchronous mode. The super-resolution image is returned through callback.

Return

Type

Description

int

Super-resolution result code. For synchronous calling, the specific result code is returned. In asynchronous mode, HwHiAIResultCode.AIRESULT_ASYNC_MODE is returned after the API is called successfully. For details about the meanings of other return values, see com.huawei.hiai.common.HwHiAIResultCode.

setBitmap

Method

public void setBitmap(Bitmap bitmap)

(EMUI 10.0 or later) Sets the result Bitmap.

Parameters

Name

Description

bitmap

Android Bitmap type, which is used to set the result image.

getScale

Method

public float getScale()

(EMUI 10.0 or later) Obtains the scale of super resolution.

Return

Type

Description

float

The super resolution scale.

getQuality

Method

public int getQuality()

(EMUI 10.0 or later) Obtains the quality of super resolution.

Return

Type

Description

int

Super resolution quality.

getBitmap

Method

public Bitmap getBitmap()

(EMUI 10.0 or later) Obtains the result Bitmap.

Return

Type

Description

Bitmap

Bitmap of the ImageResult class object in the super-resolution result.

Search
Enter a keyword.