Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
When people typically think of OCR (Optical Character Recognition), the first association is often with a scanner as the primary capture device. This association has historical reasons and is still prevalent in many contexts, providing consistent and controlled environment for capturing printed text from physical documents with unmatched quality. However, a scanner is specialized equipment that is not always at hand and requires a stationary workstation to operate.
Fortunately, the modern world provides a convenient alternative to traditional scanners - a smartphone camera. The advancements in smartphone camera technology ensure that even an entry-level smartphone provides sufficient quality to capture OCR-ready documents. And built-in memory makes it easier than ever to digitize large quantities of documents, newspapers, books, street signs and other text on the go. All you need is the right technology to convert those photos into machine-readable text.
When recognizing photographed texts, we inevitably encounter the following challenges:
Aspose.OCR for .NET is specifically designed to recognize all types of images out-of-the-box and can be further fine-tuned to handle even the low-quality photos. Combined with a modern smartphone, it allows you to create powerful OCR applications for most everyday scanning and text recognition tasks. The most advanced image processing and document structure analysis are performed in a few lines of code, allowing you to focus on business rather than complex mathematical algorithms, neural networks and other technical intricacies.
In the example below, we will demonstrate how to convert a photographed book page into a text. You will only need 34 lines of code (including comments) - see for yourself.
Quality of the photo is the cornerstone of accurate recognition. Just follow a few simple guidelines to get a good image from any smartphone or camera:
Simply take a photo of any text with your smartphone or download the image below:
photo.png
.Aspose.OCR
namespaces to improve the code readability:
using Aspose.OCR;
using Aspose.OCR.Models.PreprocessingFilters;
using Aspose.OCR.SpellChecker;
License license = new License();
license.SetLicense("Aspose.OCR.lic");
PreprocessingFilter filter = new PreprocessingFilter {
PreprocessingFilter.ContrastCorrectionFilter(),
PreprocessingFilter.AutoDewarping()
};
OcrInput photos = new OcrInput(InputType.SingleImage, filters);
photos.Add("photo.png");
RecognitionSettings settings = new RecognitionSettings();
settings.Language = Language.Eng;
settings.DetectAreasMode = DetectAreasMode.CURVED_TEXT;
AsposeOcr api = new AsposeOcr();
List<RecognitionResult> results = api.Recognize(photos, settings);
string text = results[0].GetSpellCheckCorrectedText(SpellCheckLanguage.Eng);
Console.WriteLine(text);
using Aspose.OCR;
using Aspose.OCR.Models.PreprocessingFilters;
using Aspose.OCR.SpellChecker;
namespace PhotoOCR
{
internal class Program
{
static void Main(string[] args)
{
License license = new License();
license.SetLicense("Aspose.Total.Product.Family.lic");
// Configure preprocessing filters
PreprocessingFilter filters = new PreprocessingFilter {
PreprocessingFilter.ContrastCorrectionFilter(),
PreprocessingFilter.AutoDewarping()
};
// Add a photo for recognition
OcrInput photos = new OcrInput(InputType.SingleImage, filters);
photos.Add("photo.png");
// Fine-tune recognition setings
RecognitionSettings settings = new RecognitionSettings();
settings.Language = Language.Eng;
settings.DetectAreasMode = DetectAreasMode.CURVED_TEXT;
// Extract text from a page
AsposeOcr api = new AsposeOcr();
List<RecognitionResult> results = api.Recognize(photos, settings);
// Automatically correct spelling (English)
string text = results[0].GetSpellCheckCorrectedText(SpellCheckLanguage.Eng);
// Display recognized text
Console.WriteLine(text);
}
}
}
Run the program directly from the Visual Studio or build it and execute the file from the command line. Wait for some time, depending on your system performance.
The following text will be shown on the command line:
Epilogue
Six months later
Becoming a parent does something to you. It shifts to
:de?,perrin is eye. . .s
the lead character in your own life. You become a side char
after, a throwaway. The person who takes the bullet, jumps
in front of the train, drowns while rescuing the lead.
Nova is three months old now. We chose the name for
obvious reasons. We needed a new start, and she gave that
to us.
From the moment they laid hes on my chest, she became
the most important thing to ever come into my lite. More
important than my career, more important than Jeremy,
more important than my guilt.
Until! Nova, I had convinced myself that Verity many
script must be the truth. But now that l have Nova, 1 cannot
fathom how a mother could write such awful things about
her own children if they were untrue. There isn't enough
desperation in this career for me to think writing anything
ne;active about my daughter would in any way be helpful
305
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.