How to Find Text with Computer Vision in C#
IronOCR uses OpenCV computer vision to automatically detect text regions in images before OCR processing. This improves accuracy for noisy, multi-region, or warped text by focusing Tesseract recognition only on identified text areas, significantly enhancing extraction results compared to processing entire images.
Quickstart: Detect and OCR the Primary Text RegionThis example demonstrates immediate text extraction: load an image, use IronOCR's Computer Vision to auto-detect the main text region with FindTextRegion(), then run .Read(...) to extract text in one line.
-
1Install IronOCR with NuGet Package Manager
-
2Copy and run this code snippet.
using var result = new IronTesseract().Read(new OcrInput().LoadImage("image.png").FindTextRegion());C# -
3Deploy to test on your live environment
Start using IronOCR in your project today with a free trial
- How to OCR License Plate in C# (Tutorial)
- How to Get Text From Invoice in C# Tutorial
- How to OCR Get Text From Screenshot in C#
- How to OCR Subtitles in C# (Tutorial)
Minimal Workflow (5 steps)
- Download C# library to use OCR with Computer Vision
- Utilize
FindTextRegionmethod to auto-detect text regions - Check which text region got detected with
StampCropRectangleAndSaveAsmethod - Use computer vision to separate the original image into images based on text regions with
FindMultipleTextRegionsmethod - Use
GetTextRegionsmethod to get crop areas list where text was detected
How Do I Install IronOCR.ComputerVision via NuGet Package?
OpenCV methods that perform Computer Vision in IronOCR are visible in the regular IronOCR NuGet package. For detailed installation guidance, see our NuGet installation guide.
Why Does IronOCR Require a Separate Computer Vision Package?
Using these methods requires NuGet installation of IronOcr.ComputerVision to the solution. You are prompted to download it if you do not have it installed. The computer vision functionality leverages OpenCV algorithms that significantly enhance text detection accuracy, similar to techniques used in our license plate recognition and passport scanning features.
Which Platform-Specific Package Should I Install?
- Windows:
IronOcr.ComputerVision.Windows- See our Windows setup guide - Linux:
IronOcr.ComputerVision.Linux- Check our Linux installation tutorial - macOS:
IronOcr.ComputerVision.MacOS- Review our macOS setup instructions - macOS ARM:
IronOcr.ComputerVision.MacOS.ARM
How Do I Install Using Package Manager Console?
Install using the NuGet Package Manager or paste the following in the Package Manager Console:
This provides the necessary assemblies to use IronOCR Computer Vision with our model file.
What Computer Vision Methods Are Available in IronOCR?
Code examples are included further down this tutorial. Here is a general overview of the methods currently available:
| Method | Explanation |
|---|---|
FindTextRegion | Detect regions which contain text elements and instruct Tesseract to only search for text within the area in which text was detected. |
FindMultipleTextRegions | Detect areas which contain text elements and divide the page into separate images based on text regions. |
GetTextRegions | Scans the image and returns a list of text regions as List<Rectangle>. |
How Do I Use FindTextRegion to Detect Text Areas?
FindTextRegion uses computer vision to detect regions containing text elements on every page of an OcrInput object. This method is particularly useful when processing images with scattered text or when you need to improve performance by focusing only on text-containing areas.
What Is the Basic FindTextRegion Usage?
using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadImage("/path/file.png");
input.FindTextRegion();
OcrResult result = ocr.Read(input);
string resultText = result.Text;Imports IronOcr
Private ocr = New IronTesseract()
Private input = New OcrInput()
input.LoadImage("/path/file.png")
input.FindTextRegion()
Dim result As OcrResult = ocr.Read(input)
Dim resultText As String = result.TextIronOcr 2025.6.x and doesn't take custom parameters.What Does FindTextRegion Look Like in Practice?
In this example, I use the following image for a method that needs to crop to areas containing text, but input images may vary in text location. I use FindTextRegion to narrow down the scan to an area that Computer Vision has detected text. This approach is similar to techniques used in our content areas and crop regions tutorial. This is an example image:

using IronOcr;
using IronSoftware.Drawing;
using System;
using System.Linq;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadImage("wh-words-sign.jpg");
// Find the text region using Computer Vision
Rectangle textCropArea = input.GetPages().First().FindTextRegion();
// For debugging and demonstration purposes, lets see what region it found:
input.StampCropRectangleAndSaveAs(textCropArea, Color.Red, "image_text_area", AnyBitmap.ImageFormat.Png);
// Looks good, so let us apply this region to hasten the read:
var ocrResult = ocr.Read("wh-words-sign.jpg", textCropArea);
Console.WriteLine(ocrResult.Text);Imports IronOcr
Imports IronSoftware.Drawing
Imports System
Imports System.Linq
Private ocr = New IronTesseract()
Private input = New OcrInput()
input.LoadImage("wh-words-sign.jpg")
' Find the text region using Computer Vision
Dim textCropArea As Rectangle = input.GetPages().First().FindTextRegion()
' For debugging and demonstration purposes, lets see what region it found:
input.StampCropRectangleAndSaveAs(textCropArea, Color.Red, "image_text_area", AnyBitmap.ImageFormat.Png)
' Looks good, so let us apply this region to hasten the read:
Dim ocrResult = ocr.Read("wh-words-sign.jpg", textCropArea)
Console.WriteLine(ocrResult.Text)How Do I Debug and Verify Text Region Detection?
This code has two outputs. The first is a .png file saved by StampCropRectangleAndSaveAs used for debugging. This technique is also covered in our highlight texts for debugging guide. We can see where IronCV (Computer Vision) detected the text:
The detection accurately identifies the text area. The second output is the text itself:
IRONSOFTWARE
50,000+
Developers in our active community
10,777,061 19,313
NuGet downloads Support tickets resolved
50%+ 80%+
Engineering Team growth Support Team growth
$25,000+
Raised with #TEAMSEAS to clean our beaches & waterways
How Do I Use FindMultipleTextRegions for Multiple Text Areas?
FindMultipleTextRegions takes all pages of an OcrInput object and uses computer vision to detect areas containing text elements, then divides the input into separate images based on text regions. This is particularly useful for processing documents with multiple distinct text areas, similar to our read table in document functionality:
What Is the Basic FindMultipleTextRegions Usage?
using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadImage("/path/file.png");
input.FindMultipleTextRegions();
OcrResult result = ocr.Read(input);
string resultText = result.Text;Imports IronOcr
Private ocr = New IronTesseract()
Private input = New OcrInput()
input.LoadImage("/path/file.png")
input.FindMultipleTextRegions()
Dim result As OcrResult = ocr.Read(input)
Dim resultText As String = result.TextFindMultipleTextRegions method no longer supports custom parameters.How Do I Process Individual Pages with FindMultipleTextRegions?
Another overload method of FindMultipleTextRegions takes an OCR Page and returns a list of OCR Pages, one for each text region on it. This approach helps when dealing with complex layouts, similar to techniques described in our multipage TIFF processing guide:
using IronOcr;
using System.Collections.Generic;
using System.Linq;
int pageIndex = 0;
using var input = new OcrInput();
input.LoadImage("/path/file.png");
var selectedPage = input.GetPages().ElementAt(pageIndex);
List<OcrInputPage> textRegionsOnPage = selectedPage.FindMultipleTextRegions();Imports IronOcr
Imports System.Collections.Generic
Imports System.Linq
Private pageIndex As Integer = 0
Private input = New OcrInput()
input.LoadImage("/path/file.png")
Dim selectedPage = input.GetPages().ElementAt(pageIndex)
Dim textRegionsOnPage As List(Of OcrInputPage) = selectedPage.FindMultipleTextRegions()How Do I Use GetTextRegions to Get Text Region Coordinates?
GetTextRegions returns a list of crop areas where text was detected on a page. This method is particularly useful when you need the coordinates of text regions for further processing or when implementing custom OCR workflows. For more details on working with results, see our OcrResult class documentation:
When Should I Use GetTextRegions Instead of FindTextRegion?
/* :path=/static-assets/ocr/content-code-examples/how-to/computer-vision-gettextregions.cs */
using IronOcr;
using IronSoftware.Drawing;
using System;
using System.Collections.Generic;
using System.Linq;
// Create a new IronTesseract object for OCR
var ocr = new IronTesseract();
// Load an image into OcrInput
using var input = new OcrInput();
input.LoadImage("/path/file.png");
// Get the first page from the input
var firstPage = input.GetPages().First();
// Get all text regions detected on this page
List<Rectangle> textRegions = firstPage.GetTextRegions();
// Display information about each detected region
Console.WriteLine($"Found {textRegions.Count} text regions:");
foreach (var region in textRegions)
{
Console.WriteLine($"Region at X:{region.X}, Y:{region.Y}, Width:{region.Width}, Height:{region.Height}");
}
// You can also process each region individually
foreach (var region in textRegions)
{
var regionResult = ocr.Read(input, region);
Console.WriteLine($"Text in region: {regionResult.Text}");
}Imports IronOcr
Imports IronSoftware.Drawing
Imports System
Imports System.Collections.Generic
Imports System.Linq
' Create a new IronTesseract object for OCR
Dim ocr As New IronTesseract()
' Load an image into OcrInput
Using input As New OcrInput()
input.LoadImage("/path/file.png")
' Get the first page from the input
Dim firstPage = input.GetPages().First()
' Get all text regions detected on this page
Dim textRegions As List(Of Rectangle) = firstPage.GetTextRegions()
' Display information about each detected region
Console.WriteLine($"Found {textRegions.Count} text regions:")
For Each region In textRegions
Console.WriteLine($"Region at X:{region.X}, Y:{region.Y}, Width:{region.Width}, Height:{region.Height}")
Next
' You can also process each region individually
For Each region In textRegions
Dim regionResult = ocr.Read(input, region)
Console.WriteLine($"Text in region: {regionResult.Text}")
Next
End UsingWhat Are Common Use Cases for Computer Vision in OCR?
Computer vision significantly enhances OCR accuracy in challenging scenarios. Here are practical applications:
- Document Layout Analysis: Identify and process different sections of complex documents automatically. Especially useful with scanned documents.
- Multi-Column Text: Separate and read columns independently for newspapers or magazines. Use multithreaded processing for faster results.
- Mixed Content: Distinguish between text regions and graphics in documents. Helpful when processing photos with embedded text.
- Performance Optimization: Focus OCR processing only on text-containing areas. See our fast OCR configuration guide.
- Quality Control: Verify text detection before full OCR processing. Our progress tracking feature monitors each stage.
With the right settings and input files, OCR can achieve near-human reading capability. For optimal results, combine computer vision with our image optimization filters to achieve the best possible OCR accuracy. When working with low-quality images, our guide on fixing low quality scans provides valuable preprocessing techniques.
Advanced Computer Vision Techniques
For developers looking to push OCR accuracy boundaries, consider these advanced approaches:
- Custom Training: Train the OCR engine for specialized fonts using our custom language files guide
- Multi-Language Support: Process multi-language documents with our multiple languages feature
- Barcode Integration: Combine text recognition with barcode reading using our OCR with barcode reading capabilities
Frequently Asked Questions
What is the FindTextRegion method in IronOCR?
The FindTextRegion method in IronOCR uses computer vision to detect regions containing text elements in an image, allowing Tesseract OCR to focus only on those areas, which improves accuracy in reading text from noisy or multi-region images.
How can IronOCR improve text detection accuracy with computer vision?
IronOCR leverages OpenCV computer vision algorithms to automatically detect and focus on text regions within an image before OCR processing, thereby significantly improving text detection accuracy.
Can IronOCR perform multiple text region detection?
Yes, IronOCR can use the FindMultipleTextRegions method to identify and divide input images into separate regions based on text areas, enhancing processing efficiency for documents with multiple text blocks.
How does IronOCR handle noisy or distorted images during text detection?
IronOCR uses the FindTextRegion method to isolate text areas from noisy or distorted images, allowing Tesseract OCR to concentrate only on these specific regions, improving reading accuracy and performance.
What platforms are supported by IronOCR's Computer Vision package?
IronOCR's Computer Vision package supports Windows, Linux, macOS, and macOS ARM, with platform-specific installation guides available for each.
What are the benefits of using computer vision in OCR tasks with IronOCR?
Computer vision enhances OCR tasks by allowing IronOCR to auto-detect and focus on text-containing regions within images, which results in improved accuracy, especially for complex or low-quality documents.
What is the use of the GetTextRegions method in IronOCR?
The GetTextRegions method in IronOCR provides a list of detected text regions as coordinates, useful for further processing or implementing custom OCR workflows.
How can IronOCR assist in processing documents with multiple text areas?
IronOCR uses the FindMultipleTextRegions method to detect and process documents with multiple distinct text areas by automatically separating them into individual sections for better OCR performance.
Why might IronOCR require a separate Computer Vision package?
The separate Computer Vision package for IronOCR, available via NuGet, is necessary to utilize advanced text detection features powered by OpenCV algorithms, enhancing OCR accuracy beyond standard capabilities.
What common uses does computer vision in IronOCR support?
Computer vision in IronOCR can be used for document layout analysis, multi-column text recognition, distinguishing mixed content, performance optimizations, and quality control in OCR processes.

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.