Convert an Image to text in C#
If you want to extract text from an image, then you can use a process called OCR. If you create a new project in Visual Studio, then make a web service reference to http://free-ocr.co.uk/ocr.asmx called “ocr”
A limitation of this free service, is that the image must be at most 100 x 100 pixels
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using simpleOCR.ocr;namespace simpleOCR
{
class Program
{
static void Main(string[] args)
{var sFile = new FileStream(@”C:\hello.jpg”,FileMode.Open);
byte[] PhotoBytes = new byte[sFile.Length];
sFile.Read(PhotoBytes, 0, PhotoBytes.Length);
simpleOCR.ocr.ocr webservice = new simpleOCR.ocr.ocr();
Console.Out.Write(webservice.Analyze(“your email”, PhotoBytes));
Console.ReadLine();
}
}
}
I recommend xsocr tool http://www.xspdf.com/guide-ocr/text-recognition-from-image/, it can recognize text from image with higher accuracy
LikeLike