Giter VIP home page Giter VIP logo

open-ocr-dotnet's Introduction

open-ocr-dotnet

Build status

A small lightweight C# client library for the amazing open-ocr project.

Prerequisites

All you need is a running instance of open-ocr.

Install in your project

Install the nugetpackage:

Install-Package open-ocr-dotnet -Pre

Usage

Basic example

Get an Instance of the open ocr client service

In minimal config you only need to provide the host url. The default port (9292) will be used. Default language is eng.

var service = new OpenOcrService(ocrhosturl);
var service = new OpenOcrService(ocrhosturl,ocrport);
var service = new OpenOcrService(ocrhosturl,ocrport,options);

Customize settings (optional)

string imagetodetect = @"http://bit.ly/ocrimage";
string ocrhosturl = @"http://PLACE_HOST_IP_HERE";
string ocrport = "HOSTPORT";
OpenOcrOptions options = new OpenOcrOptions {
    Language = EngineLanguage.eng,
    EngineOptions = new EngineOptions {
        Engine = OcrEngine.Tesseract
}

Analyze image from Url

OpenOcrService service = new OpenOcrService(ocrhosturl, ocrport, options);
string resultFromUrl = await service.ProgressImageFromUrl(imagetodetect);

Analyze image from Filesystem

byte[] fileBytes = File.ReadAllBytes(@"PATHTOIMAGE\ocr_test.png");
string resultlocalFile = await service.ProgressImage(fileBytes);

Advanced stuff

Use a preprocessor

It is important that you first enable the preprocessor in your open-ocr instance https://github.com/tleyden/open-ocr/wiki/Stroke-Width-Transform#start-an-additional-worker

OpenOcrOptions optionsSample = new OpenOcrOptions {
    Language = EngineLanguage.eng,
    EngineOptions = new EngineOptions {
        Engine = OcrEngine.Tesseract
    },
    Preprocessors = new[] {
        Preprocessor.StrokeWidthTransform,
        "super-fancy-new-preprocessor"
    }
};

Todo's

  • provide sample console app
  • samples in README
  • add credits
  • json.net optional integration
  • impove ci build
  • implement todo's in code

open-ocr-dotnet's People

Contributors

alex-doe avatar

Watchers

Osvaldo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.