项目作者: magicsih

项目描述 :
Simple Template Matching and OCR Server based on GRPC
高级语言: C++
项目地址: git://github.com/magicsih/grpc-opencv-recognizer.git
创建时间: 2018-12-17T03:02:40Z
项目社区:https://github.com/magicsih/grpc-opencv-recognizer

开源协议:

下载


gRPC-based Template Matching and OCR Server with OpenCV

This repository contains a gRPC-based server and client for template matching and Optical Character Recognition (OCR) using OpenCV and Tesseract OCR.

Features

  • gRPC server and client for efficient and scalable communication.
  • Template matching functionality using OpenCV.
  • OCR functionality using Tesseract OCR.
  • Cross-platform compatibility.

Dependencies

Demo

grpcserver

Run the server:

  1. ./recognizer_async_server
  2. Tesseract Base API Load Successfully
  3. Server listening on 0.0.0.0:50051

Run the client with an image file as an argument:

  1. ./recognizer_client img/hey1219.png
  2. OCR RESULT:HEY
  3. 1219

Target Image

target

Server Implementation (recognizer_async_server.cc)

The server is implemented in C++ and exposes two gRPC services: MatchTemplate for template matching and RecognizeOpticalCharacters for OCR. The server initializes Tesseract OCR with the given language data and processes incoming requests.

Client Implementation (recognizer_client.cc)

The client is also implemented in C++ and communicates with the server using gRPC. The client reads the image file, sends it to the server, and receives the OCR result.

Build

1. Install gRPC

2. Install Tesseract

2-1. Tesseract needs below

  • Leptonica
  • libjpeg
  • libtiff
  • libpng
  • libssl-dev

3. Protoc : generate source files

  1. protoc --proto_path=./protos recognizer.proto --cpp_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=/usr/local/bin/grpc_cpp_plugin

4. Download Tesseract TrainedData

  1. wget https://github.com/tesseract-ocr/tessdata/blob/main/eng.traineddata?raw=true

Put the file tessdata/ or set TESSDATA_PREFIX environment variable.

License

This project is licensed under the terms of the MIT license.