{"id":13409833,"url":"https://github.com/tleyden/open-ocr","last_synced_at":"2025-04-08T08:16:51.940Z","repository":{"id":16888887,"uuid":"19649539","full_name":"tleyden/open-ocr","owner":"tleyden","description":"Run your own OCR-as-a-Service using Tesseract and Docker","archived":false,"fork":false,"pushed_at":"2023-09-15T05:11:05.000Z","size":1025,"stargazers_count":1360,"open_issues_count":37,"forks_count":224,"subscribers_count":68,"default_branch":"master","last_synced_at":"2025-04-01T05:37:42.912Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tleyden.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-05-10T19:07:04.000Z","updated_at":"2025-03-30T15:28:12.000Z","dependencies_parsed_at":"2024-01-07T21:14:05.187Z","dependency_job_id":"3764f5b0-05e7-41c1-98d9-806b3d4d5ab7","html_url":"https://github.com/tleyden/open-ocr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tleyden%2Fopen-ocr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tleyden%2Fopen-ocr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tleyden%2Fopen-ocr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tleyden%2Fopen-ocr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tleyden","download_url":"https://codeload.github.com/tleyden/open-ocr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801175,"owners_count":20998339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:03.626Z","updated_at":"2025-04-08T08:16:51.919Z","avatar_url":"https://github.com/tleyden.png","language":"Go","funding_links":[],"categories":["Go","Software","others"],"sub_categories":["OCR as a Service"],"readme":"[![GoDoc](http://godoc.org/github.com/tleyden/open-ocr?status.png)](http://godoc.org/github.com/tleyden/open-ocr) \n[![Join the chat at https://gitter.im/tleyden/open-ocr](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tleyden/open-ocr?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n\nOpenOCR makes it simple to host your own OCR REST API.\n\nThe heavy lifting OCR work is handled by [Tesseract OCR](https://code.google.com/p/tesseract-ocr/).\n\n[Docker](http://www.docker.io) is used to containerize the various components of the service.\n\n![screenshot](http://tleyden-misc.s3.amazonaws.com/blog_images/openocr-architecture.png)\n\n# Features\n\n* Scalable message passing architecture via RabbitMQ.\n* Platform independence via Docker containers.\n* [Kubernetes support](https://github.com/tleyden/open-ocr/tree/master/kubernetes): workers can run in a Kubernetes Replication Controller\n* Supports 31 languages in addition to English \n* Ability to use an image pre-processing chain.  An example using [Stroke Width Transform](https://github.com/tleyden/open-ocr/wiki/Stroke-Width-Transform) is provided.\n* PDF support via a [PDF preprocessor](https://github.com/tleyden/open-ocr/pull/108) \n* Pass arguments to Tesseract such as character whitelist and page segment mode.\n* [REST API docs](http://docs.openocr.apiary.io/)\n* A [Go REST client](http://github.com/tleyden/open-ocr-client) is available.\n\n\n# Launching OpenOCR on a Docker PAAS\n\nOpenOCR can easily run on any PAAS that supports Docker containers.  Here are the instructions for a few that have already been tested:\n\n* [Launch on Google Container Engine GKE - Kubernetes](https://github.com/tleyden/open-ocr/wiki/Installation-on-Google-Container-Engine)\n* [Launch on AWS with CoreOS](https://github.com/tleyden/open-ocr/wiki/Installation-on-CoreOS-Fleet)\n* [Launch on Google Compute Engine](https://github.com/tleyden/open-ocr/wiki/Installation-on-Google-Compute-Engine)\n* [Launch on Azure Kubernetes Service](https://github.com/tleyden/open-ocr/wiki/Installation-on-Azure-Kubernetes-Service)\n\nIf your preferred PAAS isn't listed, please open a [Github issue](https://github.com/tleyden/open-ocr/issues) to request instructions.\n\n# Launching OpenOCR on Ubuntu 14.04\n\nOpenOCR can be launched on anything that supports Docker, such as Ubuntu 14.04.  \n\nHere's how to install it from scratch and verify that it's working correctly.\n\n## Install Docker\n\nSee [Installing Docker on Ubuntu](https://docs.docker.com/installation/ubuntulinux/) instructions.\n\n## Find out your host address\n\n```\n$ ifconfig\neth0      Link encap:Ethernet  HWaddr 08:00:27:43:40:c7\n          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0\n          ...\n```\n\nThe ip address `10.0.2.15` will be used as the `RABBITMQ_HOST` env variable below.\n\n\n# Launching OpenOCR command run.sh\n\n * [Install docker](https://docs.docker.com/installation/)\n * [Install docker-compose](https://docs.docker.com/compose/)\n * `git clone https://github.com/tleyden/open-ocr.git`\n * `cd open-ocr/docker-compose`\n * Type ```./run.sh ``` (in case you don't have execute right type ```sudo chmod +x run.sh```\n * The runner will ask you if you want to delete the images (choose y or n for each)\n * The runner will ask you to choose between version 1 and 2\n   * Version 1 is using the ocr Tesseract 3.04. The memory usage is light. It is pretty fast and not costly in term of size (a simple aws instance with 1GB of ram and 8GB of storage is sufficiant). Result are acceptable\n   * Version 2 is using the ocr Tesseract 4.00. The memory usage is light. It is less fast than tesseract 3 and more costly in term of size (an simple aws instance with 1GB of ram is sufficient but with an EBS of 16GB of storage). Result are really better compared to version 3.04.\n   * To see a comparative you can have a look to the [official page of tesseract](https://github.com/tesseract-ocr/tesseract/wiki/4.0-Accuracy-and-Performance)\n\n\n**You can use the docker-compose without the run.sh. For this just do:**\n\n```\n# for v1\nexport OPEN_OCR_INSTANCE=open-ocr\n\n# for v2\nexport OPEN_OCR_INSTANCE=open-ocr-2\n\n# then up (with -d to start it as deamon)\ndocker-compose up\n\n```\n\nDocker Compose will start four docker instances\n\n* [RabbitMQ](https://index.docker.io/u/tutum/rabbitmq/)\n* [OpenOCR Worker](https://index.docker.io/u/tleyden5iwx/open-ocr/)\n* [OpenOCR HTTP API Server](https://index.docker.io/u/tleyden5iwx/open-ocr/)\n* [OpenOCR Transform Worker](https://registry.hub.docker.com/u/tleyden5iwx/open-ocr-preprocessor/)\n\nYou are now ready to decode images → text via your REST API.\n\n# Launching OpenOCR with Docker Compose on OSX\n\n * [Install docker](https://docs.docker.com/installation/)\n * [Install docker toolbox](https://www.docker.com/products/docker-toolbox)\n * Checkout OpenOCR repository \n * `cd docker-compose directory`\n * `docker-machine start default`\n * `docker-machine env` \n * Look at the Docker host IP address\n * Run  `docker-compose up -d` to run containers as daemons or `docker-compose up` to see the log in console\n \n\n## How to test the REST API after turning on the docker-compose up\n\nWhere `IP_ADDRESS_OF_DOCKER_HOST` is what you saw when you run `docker-machine env` (e.g. 192.168.99.100)\nand where `HTTP_POST` is the port number inside the `.yml` file inside the docker-compose directory presuming it should be the same 9292.\n\n**Request**\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"img_url\":\"http://bit.ly/ocrimage\",\"engine\":\"tesseract\"}' http://IP_ADDRESS_OF_DOCKER_HOST:HTTP_PORT/ocr\n```\n\nAssuming the values are (192.168.99.100 and 9292 respectively)\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"img_url\":\"http://bit.ly/ocrimage\",\"engine\":\"tesseract\"}' http://192.168.99.100:9292/ocr\n```\n\n**Response**\n\nIt will return the decoded text for the [test image](http://bit.ly/ocrimage):\n\n```\n\u003c HTTP/1.1 200 OK\n\u003c Date: Tue, 13 May 2014 16:18:50 GMT\n\u003c Content-Length: 283\n\u003c Content-Type: text/plain; charset=utf-8\n\u003c\nYou can create local variables for the pipelines within the template by\npreﬁxing the variable name with a “$\" sign. Variable names have to be\ncomposed of alphanumeric characters and the underscore. In the example\nbelow I have used a few variations that work for variable names.\n\n```\n \n# Test the REST API \n\n## With image url\n\n**Request**\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"img_url\":\"http://bit.ly/ocrimage\",\"engine\":\"tesseract\"}' http://10.0.2.15:$HTTP_PORT/ocr\n```\n\n**Response**\n\nIt will return the decoded text for the [test image](http://bit.ly/ocrimage):\n\n```\n\u003c HTTP/1.1 200 OK\n\u003c Date: Tue, 13 May 2014 16:18:50 GMT\n\u003c Content-Length: 283\n\u003c Content-Type: text/plain; charset=utf-8\n\u003c\nYou can create local variables for the pipelines within the template by\npreﬁxing the variable name with a “$\" sign. Variable names have to be\ncomposed of alphanumeric characters and the underscore. In the example\nbelow I have used a few variations that work for variable names.\n\n```\n\n## With image base64\n\n\n**Request**\n\n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"img_base64\":\"\u003cYOUR BASE 64 HERE\u003e\",\"engine\":\"tesseract\"}' http://10.0.2.15:$HTTP_PORT/ocr\n```\n\n\n## The REST API also supports:\n\n* Uploading the image content via `multipart/related`, rather than passing an image URL.  (example client code provided in the [Go REST client](http://github.com/tleyden/open-ocr-client))\n* Tesseract config vars (eg, equivalent of -c arguments when using Tesseract via the command line) and Page Seg Mode \n* Ability to use an image pre-processing chain, eg [Stroke Width Transform](https://github.com/tleyden/open-ocr/wiki/Stroke-Width-Transform).\n* Non-English languages\n\nSee the [REST API docs](http://docs.openocr.apiary.io/) and the [Go REST client](http://github.com/tleyden/open-ocr-client) for details.\n\n# Client Libraries\n\nThese client libraries make it easier to invoke the REST API:\n\n* **Go** [open-ocr-client](https://github.com/tleyden/open-ocr-client)\n* **C#** [open-ocr-dotnet](https://github.com/alex-doe/open-ocr-dotnet)\n* **Java** [open-ocr-java](https://github.com/faLekGG/JavaOpenOCR)\n\n# Uploading local files using curl\n\nThe supplied `docs/upload-local-file.sh` provides an example of how to upload a local file using curl with `multipart/related` encoding of the json and image data:\n* usage: `docs/upload-local-file.sh \u003curlendpoint\u003e \u003cfile\u003e [mimetype]`\n* download the example ocr image `wget http://bit.ly/ocrimage`\n* example: `docs/upload-local-file.sh http://10.0.2.15:$HTTP_PORT/ocr-file-upload ocrimage` \n\n\n# Community\n\n* Follow [@OpenOCR](https://twitter.com/openocr) on Twitter\n* Checkout the [Github issue tracker](https://github.com/tleyden/open-ocr/issues)\n\n\n# License\n\nOpenOCR is Open Source and available under the Apache 2 License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftleyden%2Fopen-ocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftleyden%2Fopen-ocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftleyden%2Fopen-ocr/lists"}