Capability Introduction

9x magnification, greater clarity

This API is used to zoom in 9x (3x the height, and 3x the width) on images that contain text for greater clarity of characters in the image. In scenarios such as text file photocopying, the clarity of text content in images is significantly enhanced, providing for more legible texts. This deep-neural-network-based algorithm fully utilizes the NPU chip embeded in Huawei smartphones to accelerate neural network by more than 10 times.
Scenarios

Document photo-copying, intelligent optimization

This API intelligently zooms in on images that contain text content, and improves character legibility, for improved photo-copying.

Image enhancements

Character definition in photos is enhanced with the use of this API.

Text file photo-copying

A text file with fuzzy characters can be photo-copied using this API, for enhanced character legibility within the image.

Description

Request
Copy

Bitmap bitmap = BitmapFactory.decodeFile(filePath); // Get Bitmap (Note that bitmap type here must be ARGB8888, conversion is needed if necessary)
Frame frame = new Frame();// Construct FrameObject
frame.setBitmap(bitmap);
TxtImageSuperResolution tsr = new TxtImageSuperResolution (context);
//Text super-resolution in process
ImageSRResult srresult = tsr.doSuperResolution(frame, null);
Bitmap bmp = srresult.getBitmap();
Get the processed bitmap from the result

Response
Copy

The image after super-resolution

Start development here with Huawei

Service introduction

Service overview, application scenarios, and functions

Learn more

Access preparation

Preparation for access, such as registration, authentication, and agreement signing

Learn more

Sample code

Demonstration of sample code

Learn more

API description

Interface parameter definition, description, restrictions, and constraints

Learn more
FAQ
1Can prepare() method directly use detect() method without calling the API?

Yes. In detect() method engine startup is in default. The engine will not start up again if started, please use with confidence.

2When should I call the release() method?

The release() method will uninstall a model that has been loaded to the NPU chip. If the app is no longer using face detection, uninstall the model in a timely manner to free up resources.

3Does HiAI support multi-thread calls?

The HiAi Engine does not allow an app to call multiple threads for a single API. This is because if one thread finishes first, it will call the release() method and uninstall the model, resulting in errors in all of the other threads. In the NPU, the back end service also executes tasks in order, so it is unable to run multiple threads through one function at the same time. However, multiple threads can be enabled at the same time if they are calling different APIs. For example, it is possible to enable one thread for Aesthetic Scoring, and another one for Scene Detection.