Recognize single line
Contents
[
Hide
]
If an image contains a single line of text, it can be recognized in the fastest possible mode, without automated corrections, areas detection, and other resource-consuming steps.
To extract text from such images, use the following functions:
Function | Description |
---|---|
line() |
Read a single-line image. |
line_from_raw_bytes() |
Read a single-line image provided as an array of pixels. |
line_abc() |
Read only the predefined list of characters from the single-line image. |
line_abc_from_raw_bytes() |
Read only the predefined list of characters from the single-line image provided as an array of pixels. |
std::string image_path = "../Data/Source/Source.img";
const size_t len = 4096;
wchar_t buffer[len] = { 0 };
aspose::ocr::line(image_path.c_str(), buffer, len);
std::wcout << buffer;
Please note that this function only works for images containing a single line of text! Using it on multi-line images will lead to incorrect recognition results.
Performance impact
This function is about 7 times faster than normal OCR and is highly recommended for batch processing large numbers of very simple images.
Drawbacks
This recognition function only supports images in the following formats:
- 24-bit PNG,
- JPEG,
- BMP.
It also does not work with skewed images and does not support recognition settings. However, you can preprocess an image before sending it to the OCR engine.