0

I have been exploring stable and scalable architecture for lambda based(serverless) application in aws to develop ocr application.

I have successfully implemented and tested the python version of opencv and tesseract-ocr module in aws lambda.

I am interested in doing the same in c++ programming language in aws lambda so that I can use c++ tesseract Tess_Base_API in c++ and also this way we won’t have to convert my existing c++ based codebase into python code.

After doing some research i found that it can be achieved by two ways:

1) Building opencv, tesseract library statically(.a files) and then compiling C++ source code statically to create an executable with no dynamic libs dependency. After that this statically generated C++ executable can be executed using subprocess module in Python in aws lambda.

2) Create a package containing opencv and tesseract dynamic libraries(.so files) and running c++ executable(by pointing path these dynamic library package using 'LD_LIBRARY_PATH') again using subprocess module in Python in aws lambda.

First i tried to build opencv statically by following this link but i did not get success since it was based on alpine linux environment. I am also not able to get any such kind of usage anywhere so i am confused if this approach will even work.

I have been exploring for this feature for the past few days, is someone has done this already or have any information on how it can be done in aws lambda ?

Thanks

flamelite
  • 2,654
  • 3
  • 22
  • 42
  • Maybe this is not what you're looking for, but AWS now has an OCR service: https://aws.amazon.com/textract/ – stijndepestel Apr 03 '19 at 07:40
  • @stijndepestel i already do have opensource(opencv+tesseract) based OCR application implemented in C++, i am not looking for commercial apis like aws textract. – flamelite Apr 03 '19 at 08:01

1 Answers1

0

The AWS Lambda Runtime for C++ supports packaging your application and its dependencies. The only catch is that the dependencies must be known at link time (i.e. not using dlopen). If your code is using dlopen you must modify the zip package and add that library to it manually.

See a full example here https://github.com/awslabs/aws-lambda-cpp/tree/master/examples/s3

Marco M.
  • 2,956
  • 2
  • 29
  • 22