Optical Character Recognition karanna puluwan C# code ekak thiyana kenek denawadooo... weda karana ekak thamai ona. 





using System.Collections;
using System.IO;
using System.Drawing.Imaging;
public void CheckFileType(string directoryPath)
{
IEnumerator files = Directory.GetFiles(directoryPath).GetEnumerator();
while (files.MoveNext())
{
//get file extension
string fileExtension = Path.GetExtension(Convert.ToString(files.Current));
//get file name without extenstion
string fileName=
Convert.ToString(files.Current).Replace(fileExtension,string.Empty);
//Check for JPG File Format
if (fileExtension == ".jpg" || fileExtension == ".JPG")
// or // ImageFormat.Jpeg.ToString()
{
try
{
//OCR Operations ...
MODI.Document md = new MODI.Document();
md.Create(Convert.ToString(files.Current));
md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
MODI.Image image = (MODI.Image)md.Images[0];
//create text file with the same Image file name
FileStream createFile =
new FileStream(fileName + ".txt",FileMode.CreateNew);
//save the image text in the text file
StreamWriter writeFile = new StreamWriter(createFile);
writeFile.Write(image.Layout.Text);
writeFile.Close();
}
catch (Exception exc)
{
MessageBox.Show(exc.Message,
"OCR Exception",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
Weda karanawada nam danne naha. Net eken thamai code eka set une. Try ekak dala balanna
Code:using System.Collections; using System.IO; using System.Drawing.Imaging; public void CheckFileType(string directoryPath) { IEnumerator files = Directory.GetFiles(directoryPath).GetEnumerator(); while (files.MoveNext()) { //get file extension string fileExtension = Path.GetExtension(Convert.ToString(files.Current)); //get file name without extenstion string fileName= Convert.ToString(files.Current).Replace(fileExtension,string.Empty); //Check for JPG File Format if (fileExtension == ".jpg" || fileExtension == ".JPG") // or // ImageFormat.Jpeg.ToString() { try { //OCR Operations ... MODI.Document md = new MODI.Document(); md.Create(Convert.ToString(files.Current)); md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true); MODI.Image image = (MODI.Image)md.Images[0]; //create text file with the same Image file name FileStream createFile = new FileStream(fileName + ".txt",FileMode.CreateNew); //save the image text in the text file StreamWriter writeFile = new StreamWriter(createFile); writeFile.Write(image.Layout.Text); writeFile.Close(); } catch (Exception exc) { MessageBox.Show(exc.Message, "OCR Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }


http://www.codeproject.com/KB/recipes/OCR-Chain-Code.aspx
http://www.codeproject.com/KB/recipes/UnicodeOCR.aspx
http://www.codeproject.com/KB/office/modi.aspx
http://www.codeproject.com/KB/dotnet/simple_ocr.aspx
http://www.codeproject.com/KB/office/OCRDemo.aspx
http://www.codeproject.com/KB/office/OCRSampleApplication.aspx



bump
Menna magenuth podi help ekak. Puma.Net library eka Use karala karana puluwan. Or office extension library(MODI library) ekak use karalath puluwan karanna.
https://www.youtube.com/watch?v=fmlz9iU_ZG4
http://priyankaradissanayake.blogspot.com/search?q=ocr
♥-Aurora-♥;21437337 said:bump



