ICvBasepublic interface IDocRefine extends ICvBase
Text detection detects text in a document image and returns the corner coordinates of text in the document. Document refinement adjusts the corner coordinates based on the input image and coordinates. It is recommended that images with a width ranging from 1080 pixels to 2560 pixels be used for document refinement.
This interface provides two process modes. The MODE_IN mode indicates that the SDK directly invokes
the DocRefine function in the caller process. The MODE_OUT mode indicates that the SDK functions as a client
to send a calling request to the HUAWEI HiAI Engine, which performs DocRefine and returns the result to the caller.
This interface also provides two block modes. In synchronous mode, the calling is blocked in the docDetect
or docRefine method until the cooresponding processing is complete. In asynchronous mode,
the docDetect or docRefine method is returned immediately, and the cooresponding processing result
is returned to the caller in callback mode.
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
docDetect(VisionImage image,
DocCoordinates result,
VisionCallback<DocCoordinates> visionCallBack) |
Performs text detection on a given image and returns the result code.
|
int |
docRefine(VisionImage image,
DocCoordinates coordinates,
ImageResult result,
VisionCallback<ImageResult> visionCallBack) |
Performs document refinement on a given image and returns the result code.
|
void |
setVisionConfiguration(DocRefineConfiguration docRefineConfiguration) |
Sets document refinement parameters.
|
getAvailability, loadPlugin, prepare, releaseint docDetect(VisionImage image, DocCoordinates result, VisionCallback<DocCoordinates> visionCallBack)
This method detects text in an input image, and returns the corner coordinates of the document
bounding box either by using DocCoordinates or a callback.
image - Indicates an input image.result - Indicates the data type for storing corner coordinates in synchronous mode.visionCallBack - Indicates the callback class to use.
docDetect is called synchronously, and the DocCoordinates after
detection is output from the result parameter.docDetect is called asynchronously, and the result
parameter should be null. When the asynchronous call is successful, the DocCoordinates after detection can be
obtained from onResult, or an error code is passed from onError.HwHiAIResultCode.AIRESULT_SUCCESS if the synchronous call is successful;
returns an error code otherwise.
Returns HwHiAIResultCode.AIRESULT_ASYNC_MODE if the asynchronous call is successful;
returns an error code if any input parameter is invalid.
For more information, see HwHiAIResultCode.
int docRefine(VisionImage image, DocCoordinates coordinates, ImageResult result, VisionCallback<ImageResult> visionCallBack)
This method adjusts the coordinates of the document bounding box based on the input image and coordinates
and returns the result by using ImageResult or a callback.
image - Indicates an input image.coordinates - Indicates the data type for storing corner coordinates.result - Indicates the output image after document refinement in synchronous mode.visionCallBack - Indicates the callback class to use.
docRefine is called synchronously, and the image after
DocRefine is output from the result parameter.docRefine is called asynchronously, and the result
parameter should be null. When the asynchronous call is successful, the image after DocRefine can be
obtained from onResult, or an error code is passed from onError.HwHiAIResultCode.AIRESULT_SUCCESS if the synchronous call is successful;
returns an error code otherwise.
Returns HwHiAIResultCode.AIRESULT_ASYNC_MODE if the asynchronous call is successful;
returns an error code if any input parameter is invalid.
For more information, see HwHiAIResultCode.
void setVisionConfiguration(DocRefineConfiguration docRefineConfiguration)
This method uses DocRefineConfiguration to set parameters.
docRefineConfiguration - Indicates the data type of a document refinement parameter.