# 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.
*as-heading:2(Quickstart: Detect and OCR the Primary Text Region)*
This 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.
```cs
:title=Start OCR with Computer Vision in One Line
using var result = new IronTesseract().Read(new OcrInput().LoadImage("image.png").FindTextRegion());
```
- [How to OCR License Plate in C# (Tutorial)](/csharp/ocr/blog/using-ironocr/license-plate-ocr-csharp-tutorial/)
- [How to Get Text From Invoice in C# Tutorial](/csharp/ocr/blog/using-ironocr/invoice-ocr-csharp-tutorial/)
- [How to OCR Get Text From Screenshot in C#](/csharp/ocr/blog/using-ironocr/get-text-ocr-screenshot-csharp-tutorial/)
- [How to OCR Subtitles in C# (Tutorial)](/csharp/ocr/blog/using-ironocr/subtitle-ocr-csharp-tutorial/)
<div class="hsg-featured-snippet">
<h3>Minimal Workflow (5 steps)</h3>
<ol>
<li><a class="js-modal-open" data-modal-id="trial-license-after-download" href="https://nuget.org/packages/IronOcr/">Download C# library to use OCR with Computer Vision</a></li>
<li>Utilize <code>FindTextRegion</code> method to auto-detect text regions</li>
<li>Check which text region got detected with <code>StampCropRectangleAndSaveAs</code> method</li>
<li>Use computer vision to separate the original image into images based on text regions with <code>FindMultipleTextRegions</code> method</li>
<li>Use <code>GetTextRegions</code> method to get crop areas list where text was detected</li>
</ol>
</div>
## 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](https://ironsoftware.com/csharp/ocr/get-started/advanced-installation-nuget/).
### 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](https://ironsoftware.com/csharp/ocr/how-to/read-license-plate/) and [passport scanning](https://ironsoftware.com/csharp/ocr/how-to/read-passport/) features.
### Which Platform-Specific Package Should I Install?
- Windows: `IronOcr.ComputerVision.Windows` - See our [Windows setup guide](https://ironsoftware.com/csharp/ocr/get-started/windows/)
- Linux: `IronOcr.ComputerVision.Linux` - Check our [Linux installation tutorial](https://ironsoftware.com/csharp/ocr/get-started/linux/)
- macOS: `IronOcr.ComputerVision.MacOS` - Review our [macOS setup instructions](https://ironsoftware.com/csharp/ocr/get-started/mac/)
- 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:
```shell
:InstallCmd Install-Package IronOcr.ComputerVision.Windows
```
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:
<table class="table table__configuration-variables">
<tr>
<th scope="col">Method</th>
<th scope="col">Explanation</th>
</tr>
<tr>
<td><a href="#anchor-findtextregion"><code>FindTextRegion</code></a></td>
<td class="word-break--break-word">Detect regions which contain text elements and instruct Tesseract to only search for text within the area in which text was detected.</td>
</tr>
<tr>
<td><a href="#anchor-findmultipletextregions"><code>FindMultipleTextRegions</code></a></td>
<td class="word-break--break-word">Detect areas which contain text elements and divide the page into separate images based on text regions.</td>
</tr>
<tr>
<td><a href="#anchor-gettextregions"><code>GetTextRegions</code></a></td>
<td class="word-break--break-word">Scans the image and returns a list of text regions as <code>List<Rectangle></code>.</td>
</tr>
</table>
## 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?
```csharp
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;
```
[[e:( This method overload is currently deprecated in `IronOcr 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](https://ironsoftware.com/csharp/ocr/troubleshooting/crop-regions-rectangles/). This is an example image:
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/computer-vision/iron-2022.webp" alt="Iron Software 2022 company statistics showing developer metrics and business performance data" class="img-responsive add-shadow" />
</div>
</div>
```csharp
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);
```
### 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](https://ironsoftware.com/csharp/ocr/examples/highlight-texts-for-debugging/). We can see where IronCV (Computer Vision) detected the text:
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/ocr/how-to/computer-vision/text_area_0.PNG" alt="Iron Software 2022 statistics with red boundary box showing FindTextRegion text detection functionality" class="img-responsive add-shadow" />
</div>
</div>
The detection accurately identifies the text area. The second output is the text itself:
```text
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](https://ironsoftware.com/csharp/ocr/examples/read-table-in-document/):
### What Is the Basic FindMultipleTextRegions Usage?
```csharp
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;
```
[[e:( Starting from IronOCR v2025.6.x, the `FindMultipleTextRegions` 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](https://ironsoftware.com/csharp/ocr/examples/csharp-tesseract-multipage-tiff/):
```csharp
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();
```
## 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](https://ironsoftware.com/csharp/ocr/examples/results-objects/):
### When Should I Use GetTextRegions Instead of FindTextRegion?
```csharp
/* :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}");
}
```
### What Are Common Use Cases for Computer Vision in OCR?
Computer vision significantly enhances OCR accuracy in challenging scenarios. Here are practical applications:
1. **Document Layout Analysis:** Identify and process different sections of complex documents automatically. Especially useful with [scanned documents](https://ironsoftware.com/csharp/ocr/examples/read-scanned-document/).
2. **Multi-Column Text:** Separate and read columns independently for newspapers or magazines. Use [multithreaded processing](https://ironsoftware.com/csharp/ocr/examples/csharp-tesseract-multithreading-for-speed/) for faster results.
3. **Mixed Content:** Distinguish between text regions and graphics in documents. Helpful when processing [photos with embedded text](https://ironsoftware.com/csharp/ocr/examples/read-photo/).
4. **Performance Optimization:** Focus OCR processing only on text-containing areas. See our [fast OCR configuration guide](https://ironsoftware.com/csharp/ocr/examples/tune-tesseract-for-speed-in-dotnet/).
5. **Quality Control:** Verify text detection before full OCR processing. Our [progress tracking feature](https://ironsoftware.com/csharp/ocr/examples/progress-tracking/) 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](https://ironsoftware.com/csharp/ocr/examples/ocr-image-filters-for-net-tesseract/) to achieve the best possible OCR accuracy. When working with low-quality images, our guide on [fixing low quality scans](https://ironsoftware.com/csharp/ocr/examples/ocr-low-quality-scans-tesseract/) 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](https://ironsoftware.com/csharp/ocr/examples/ocr-tesseract-custom-languages/)
- **Multi-Language Support:** Process multi-language documents with our [multiple languages feature](https://ironsoftware.com/csharp/ocr/examples/ocr-tesseract-multiple-languages/)
- **Barcode Integration:** Combine text recognition with barcode reading using our [OCR with barcode reading capabilities](https://ironsoftware.com/csharp/ocr/examples/csharp-ocr-barcodes/)
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 Region
This 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
PM > Install-Package IronOcr
Install-Package IronOcr
2Copy and run this code snippet.
using var result = new IronTesseract().Read(new OcrInput().LoadImage("image.png").FindTextRegion());
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
Utilize FindTextRegion method to auto-detect text regions
Check which text region got detected with StampCropRectangleAndSaveAs method
Use computer vision to separate the original image into images based on text regions with FindMultipleTextRegions method
Use GetTextRegions method 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.
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;
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;
ImportsIronOcrPrivate ocr = New IronTesseract()Private input = New OcrInput()input.LoadImage("/path/file.png")input.FindTextRegion()Dim result AsOcrResult = ocr.Read(input)Dim resultText AsString = 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.Text
Caution: This method overload is currently deprecated in IronOcr 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 VisionRectangle 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);
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);
ImportsIronOcrImportsIronSoftware.DrawingImportsSystemImportsSystem.LinqPrivate ocr = New IronTesseract()Private input = New OcrInput()input.LoadImage("wh-words-sign.jpg")' Find the text region using Computer VisionDim textCropArea AsRectangle = 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)
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:
IRONSOFTWARE50,000+Developers in our active community10,777,061 19,313NuGet downloads Support tickets resolved50%+ 80%+Engineering Team growth Support Team growth$25,000+Raised with #TEAMSEAS to clean our beaches & waterways
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
Text
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;
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;
ImportsIronOcrPrivate ocr = New IronTesseract()Private input = New OcrInput()input.LoadImage("/path/file.png")input.FindMultipleTextRegions()Dim result AsOcrResult = ocr.Read(input)Dim resultText AsString = 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.Text
Caution: Starting from IronOCR v2025.6.x, the FindMultipleTextRegions 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();
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 OCRvar ocr = new IronTesseract();// Load an image into OcrInputusing var input = new OcrInput();input.LoadImage("/path/file.png");// Get the first page from the inputvar firstPage = input.GetPages().First();// Get all text regions detected on this pageList<Rectangle> textRegions = firstPage.GetTextRegions();// Display information about each detected regionConsole.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 individuallyforeach (var region in textRegions){ var regionResult = ocr.Read(input, region);Console.WriteLine($"Text in region: {regionResult.Text}");}
/* :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}");
}
ImportsIronOcrImportsIronSoftware.DrawingImportsSystemImportsSystem.Collections.GenericImportsSystem.Linq' Create a new IronTesseract object for OCRDim ocr As New IronTesseract()' Load an image into OcrInputUsing 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 AsList(OfRectangle) = firstPage.GetTextRegions() ' Display information about each detected regionConsole.WriteLine($"Found {textRegions.Count} text regions:") For Each region In textRegionsConsole.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}") NextEndUsing
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 Using
What 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:
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.