You can find all the details at: Convert Image to Text using C++ OCR Library
Last active
March 19, 2022 23:47
-
-
Save aspose-com-gists/41945dce2c829c0c2a99ccee0f7969c4 to your computer and use it in GitHub Desktop.
Convert Image to Text using C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string image_path = "sample_line.jpg"; | |
// Prepare buffer for result (in symbols, len_byte = len * sizeof(wchar_t)) | |
const size_t len = 4096; | |
wchar_t buffer[len] = { 0 }; | |
int x = 138, y = 352, w = 2033, h = 537; | |
// Perform OCR or selected area | |
size_t size = aspose::ocr::page_rect(image_path.c_str(), buffer, len, x, y, w, h); | |
//Print result | |
std::wcout << buffer << L"\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string image_path = "sample_line.jpg"; | |
// Prepare buffer for result (in symbols, len_byte = len * sizeof(wchar_t)) | |
const size_t len = 4096; | |
wchar_t buffer[len] = { 0 }; | |
// Perform OCR | |
size_t size = aspose::ocr::line(image_path.c_str(), buffer, len); | |
//Print result | |
std::wcout << buffer << L"\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string image_path = "sample.png"; | |
// Prepare buffer for result (in symbols, len_byte = len * sizeof(wchar_t)) | |
const size_t len = 4096; | |
wchar_t buffer[len] = { 0 }; | |
// Perform OCR | |
size_t size = aspose::ocr::page(image_path.c_str(), buffer, len); | |
//Print result | |
std::wcout << buffer << L"\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Octet3290,
We suggest reading all the details at Convert Image to Text using C++ OCR Library.
In case you face any issues, please feel free to reach out to us at the forum.