Skip to content

Getting Started

SDK iconOCR SDK

OCR SDK

OCR SDK provides OCR technology as an SDK that recognizes and detects text contained in image files and extracts it as data. Powered by proprietary deep learning technology, it accurately recognizes printed text, handwriting, and text within background images.

πŸ” Precise recognition

🧠 Deep learning-based

Quick start guide​

1. Check system requirements​

Windows system requirements

  • Operating system: Windows 10 or later, 64-bit required
  • Compiler: A compiler that supports C++17 or later
  • Processor: i7-8700K or higher recommended
  • Memory: 8 GB RAM or more (16 GB recommended)
  • Storage: 4 GB or more (SSD recommended)
  • Other: Microsoft Visual C++ 2015–2022 Redistributable required
Detailed system requirements

2. License activation​

License activation proceeds as follows.


Detailed license guide

See the License guide for license types and management.

3. Install prerequisites​

Common prerequisites

  • Libtorch library: Required to use the OCR SDK
  • Encoding settings: Use an appropriate encoding such as UTF-8
Detailed installation guide

See Common prerequisites for installation instructions.

4. SDK initialization methods​

Initialize with an integrated resource file

// Initialize with an IMR file
void *obj = nullptr;
std::string runtimeLicensePath = "../bin64/Hancom.trial.license";
std::string engineLibPath = "../bin64/libs/CPU/modulelibs";
std::string imrResourcePath = "../assets/Hancom.25.12.01.cpu.imr";
std::string objName = "Sample";
bool isRecovery = true;
bool isSelfCheck = false;
int enginesCount = 1;

bool isSuccess = HOCR_SDK_CPU_CreateFromImrModelFile(
&obj,
runtimeLicensePath.data(),
engineLibPath.data(),
imrResourcePath.data(),
objName.data(),
isRecovery,
isSelfCheck,
enginesCount
);

5. Basic OCR processing example​

For image processing, OpenCV is used as an external library example.

/* ... */
#include "HOCR_SDK_COMMON.h"
#include "HOCR_SDK_CPU.h"

int main() {
// Variables required for initialization
void* obj = nullptr;
std::string licensePath = ".\\Hancom.trial.license";
std::string engineLibPath = ".\\libs\\CPU\\modulelibs";
std::string imrModelDataPath = "..\\assets\\Hancom.25.11.18.cpu.imr";
std::string objName = "Sample";
bool isRecovery = true;
bool isSelfCheck = false;
int engineCount = 1;

// Initialize SDK
bool isSuccess = HOCR_SDK_CPU_CreateFromImrModelFile(
&obj,
licensePath.data(),
engineLibPath.data(),
imrModelDataPath.data(),
objName.data(),
isRecovery,
isSelfCheck,
engineCount
);
if (!isSuccess) return 1;

// OCR test
cv::Mat mat = cv::imread("ocr1.png", cv::IMREAD_COLOR);
char *resultJsonStr = nullptr;
std::string openApiName = "TEXT_RECOGNITION";
std::string requestId = "request-id";
char *dataMat = reinterpret_cast<char*>(temp.data);
std::string requestOptionJsonStr = "{}";
int resultSize = HOCR_SDK_run(
obj,
&resultJsonStr,
openApiName.data(),
requestId.data(),
mat.cols,
mat.rows,
2, /* RGB 0, RGBA 1, BGR 2, BGRA 3, YUV 4, GRAY 5 */
dataMat,
requestOptionJsonStr.data()
);
std::string resultJson(resultJsonStr, resultSize);
std::cout << resultJson << std::endl;

// Release SDK
HOCR_SDK_freePointer(&resultJsonStr);
isSuccess = HOCR_SDK_releaseArgoSDK(obj);
if (!isSuccess) return 1;

return 0;
}
Sample program

You can test the SampleWindowsMain.exe sample program that uses the example above. See OCR SDK details.


SDK components​

Distribution components​

HANCOM OCRSDK
β”œβ”€assets (OCRSDK resource directory)
β”‚
β”œβ”€bin64 (OCRSDK binary directory)
β”‚ β”‚
β”‚ └─libs
β”‚ └─CPU
β”‚ └─modulelibs (OCRSDK module binary directory)
β”‚
β”œβ”€include (OCRSDK header file directory)
β”‚
└─notice (OCRSDK open-source license notice directory)
Detailed components

See all components in OCR SDK details.