Search Results for

    Show / Hide Table of Contents

    Class OcrImageInput

    OCR input based on image data

    Inheritance
    System.Object
    OcrInputBase
    OcrImageInput
    Implements
    System.IDisposable
    Inherited Members
    OcrInputBase.Finalize()
    OcrInputBase.Dispose()
    OcrInputBase.SaveAsImages(String, AnyBitmap.ImageFormat)
    OcrInputBase.HighlightTextAndSaveAsImages(IronTesseract, String, ResultHighlightType)
    OcrInputBase.FindTextRegion()
    OcrInputBase.FindMultipleTextRegions()
    OcrInputBase.StampCropRectanglesAndSaveAs(Rectangle[], Color, String, AnyBitmap.ImageFormat)
    OcrInputBase.StampCropRectangleAndSaveAs(Rectangle, Color, String, AnyBitmap.ImageFormat)
    OcrInputBase.StampCropRectangle(OcrInput, Rectangle, Color)
    OcrInputBase.StampCropRectangles(OcrInput, Rectangle[], Color)
    OcrInputBase.ApplyMultipleFilters(OcrFilters, Double, Int32, Int32, Int32, Boolean, Nullable<Int32>)
    OcrInputBase.WithTitle(String)
    OcrInputBase.Scale(Int32, Boolean)
    OcrInputBase.EnhanceResolution(Int32)
    OcrInputBase.AdaptiveThreshold(Nullable<Single>)
    OcrInputBase.Rotate(Double)
    OcrInputBase.Binarize()
    OcrInputBase.ToGrayScale()
    OcrInputBase.Sharpen()
    OcrInputBase.ReplaceColor(Color, Color, Int32)
    OcrInputBase.SelectTextColor(Color, Int32)
    OcrInputBase.SelectTextColors(IEnumerable<Color>, Int32)
    OcrInputBase.Contrast(Single)
    OcrInputBase.DeNoise(Boolean)
    OcrInputBase.DeNoise(Boolean, Boolean)
    OcrInputBase.Despeckle(Boolean)
    OcrInputBase.Despeckle(Boolean, Boolean)
    OcrInputBase.Invert(Boolean)
    OcrInputBase.Erode(Boolean)
    OcrInputBase.Open(Boolean)
    OcrInputBase.Close(Boolean)
    OcrInputBase.HoughTransformStraighten(Int32)
    OcrInputBase.Deskew(Int32)
    OcrInputBase.DetectPageOrientation(OrientationDetectionMode)
    OcrInputBase.DetectPageOrientation(OrientationDetectionMode, Int32)
    OcrInputBase.Scale(Int32, Int32, Boolean)
    OcrInputBase.Dilate(Boolean)
    OcrInputBase.GetPages()
    OcrInputBase.RemovePages(IEnumerable<Int32>)
    OcrInputBase.RemovePage(Int32)
    OcrInputBase.PageCount()
    OcrInputBase.TargetDPI
    OcrInputBase.Title
    Namespace: IronOcr
    Assembly: IronOcr.dll
    Syntax
    public class OcrImageInput : OcrInputBase

    Feeding a single image to a read starts by wrapping it in an OcrImageInput. It is the image-backed input you build from a file, a Stream, a byte[], or an AnyBitmap, then pass to IronTesseract.Read. Use it for one picture, screenshot, or photo, where OcrInput is the choice when a job spans many images or PDF pages.

    Each constructor takes the image source plus three optional arguments: a Dpi to declare the source resolution, a ContentArea rectangle to read only part of the image, and a Title to label the input. Because OcrImageInput derives from OcrInputBase, the inherited filter methods, Deskew, Binarize, DeNoise, and Contrast among them, are available on the instance to clean the image before the read, and Dispose releases it afterward. Build the input, apply any filters the source needs, then hand it to Read and read the words off the returned OcrResult.

    The input images how-to covers the image sources, and the OCR input example builds one for a read.

    using var input = new OcrImageInput("scan.png");
    OcrResult result = ironTesseract.Read(input);

    Constructors

    OcrImageInput(AnyBitmap, Nullable<Int32>, Rectangle, String)

    Create a new OCR image input from the specified AnyBitmap

    Declaration
    public OcrImageInput(AnyBitmap Bitmap, Nullable<int> Dpi = null, Rectangle ContentArea = null, string Title = null)
    Parameters
    Type Name Description
    IronSoftware.Drawing.AnyBitmap Bitmap

    Image

    System.Nullable<System.Int32> Dpi

    Desired DPI

    IronSoftware.Drawing.Rectangle ContentArea

    Desired crop area

    System.String Title

    Title

    OcrImageInput(Byte[], Nullable<Int32>, Rectangle, String)

    Create a new OCR image input from the specified byte array

    Declaration
    public OcrImageInput(byte[] Bytes, Nullable<int> Dpi = null, Rectangle ContentArea = null, string Title = null)
    Parameters
    Type Name Description
    System.Byte[] Bytes

    Image data

    System.Nullable<System.Int32> Dpi

    Desired DPI

    IronSoftware.Drawing.Rectangle ContentArea

    Desired crop area

    System.String Title

    Title

    OcrImageInput(Stream, Nullable<Int32>, Rectangle, String)

    Create a new OCR image input from the specified stream

    Declaration
    public OcrImageInput(Stream Stream, Nullable<int> Dpi = null, Rectangle ContentArea = null, string Title = null)
    Parameters
    Type Name Description
    System.IO.Stream Stream

    Image data stream

    System.Nullable<System.Int32> Dpi

    Desired DPI

    IronSoftware.Drawing.Rectangle ContentArea

    Desired crop area

    System.String Title

    Title

    OcrImageInput(String, Nullable<Int32>, Rectangle, String)

    Create a new OCR image input from the specified path

    Declaration
    public OcrImageInput(string Path, Nullable<int> Dpi = null, Rectangle ContentArea = null, string Title = null)
    Parameters
    Type Name Description
    System.String Path

    Image file path

    System.Nullable<System.Int32> Dpi

    Desired DPI

    IronSoftware.Drawing.Rectangle ContentArea

    Desired crop area

    System.String Title

    Title

    Implements

    System.IDisposable

    Inherited members

    Finalize()
    Dispose()
    SaveAsImages(String, AnyBitmap.ImageFormat)
    HighlightTextAndSaveAsImages(IronTesseract, String, ResultHighlightType)
    FindTextRegion()
    FindMultipleTextRegions()
    StampCropRectanglesAndSaveAs(Rectangle[], Color, String, AnyBitmap.ImageFormat)
    StampCropRectangleAndSaveAs(Rectangle, Color, String, AnyBitmap.ImageFormat)
    StampCropRectangle(OcrInput, Rectangle, Color)
    StampCropRectangles(OcrInput, Rectangle[], Color)
    ApplyMultipleFilters(OcrFilters, Double, Int32, Int32, Int32, Boolean, Nullable<Int32>)
    WithTitle(String)
    Scale(Int32, Boolean)
    EnhanceResolution(Int32)
    AdaptiveThreshold(Nullable<Single>)
    Rotate(Double)
    Binarize()
    ToGrayScale()
    Sharpen()
    ReplaceColor(Color, Color, Int32)
    SelectTextColor(Color, Int32)
    SelectTextColors(IEnumerable<Color>, Int32)
    Contrast(Single)
    DeNoise(Boolean)
    DeNoise(Boolean, Boolean)
    Despeckle(Boolean)
    Despeckle(Boolean, Boolean)
    Invert(Boolean)
    Erode(Boolean)
    Open(Boolean)
    Close(Boolean)
    HoughTransformStraighten(Int32)
    Deskew(Int32)
    DetectPageOrientation(OrientationDetectionMode)
    DetectPageOrientation(OrientationDetectionMode, Int32)
    Scale(Int32, Int32, Boolean)
    Dilate(Boolean)
    GetPages()
    RemovePages(IEnumerable<Int32>)
    RemovePage(Int32)
    PageCount()
    TargetDPI
    Title
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget