0

How can i upload a simple image to www.newocr.com, select a language from the combobox below , click the 'Upload' button and after the 'OCR' button and finnaly getting the string from the source code which stores the string into a id

All programatically. Any help?

1 Answers1

0

follow this link :

This Can Help You::

OCR reading using C#

http://www.codeproject.com/Questions/157546/C-OCR-How-to-Read-a-single-character-from-image Try This:

Bitmap BWImage = new Bitmap(fileName);
// Lock destination bitmap in memory
System.Drawing.Imaging.BitmapData BWLockImage = BWImage.LockBits(new Rectangle(0, 0, BWImage.Width, BWImage.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed);

// Copy image data to binary array
int imageSize = BWLockImage.Stride * BWLockImage.Height;
byte[] BWImageBuffer = new byte[imageSize];
Marshal.Copy(BWLockImage.Scan0, BWImageBuffer, 0, imageSize);
DoOCR(BWLockImage, BWImageBuffer, tmpPosRect, false);



// Do the OCR with this function
public string DoOCR(System.Drawing.Imaging.BitmapData BWLockImage, byte[] BWImageBuffer, Rectangle iAusschnitt, bool isNumber)
{
    Bitmap tmpImage = Bildausschnitt1bpp(BWLockImage, BWImageBuffer, iAusschnitt);
    string file = Path.GetTempFileName();
    string tmpResult = "";
    try
    {
        tmpImage.Save(file, ImageFormat.Tiff);
        _MODIDocument.Create(file);
        // Modi parameter erstellen
        _MODIDocument.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, false, false);

        MODI.IImage myImage = (MODI.IImage)_MODIDocument.Images[0]; //first page in file
        MODI.ILayout myLayout = (MODI.ILayout)myImage.Layout;
        tmpResult = myLayout.Text;
    }
    catch
    {
        if (_MODIDocument != null)
        {
            _MODIDocument.Close(false); //Closes the document and deallocates the memory.
            _MODIDocument = null;
        }
        // Bild freigeben
        tmpImage.Dispose();
        tmpImage = null;
        // Garbage Collector ausführen
        GC.Collect();
        // Bilddatei löschen
        File.Delete(file);
    }
    return tmpResult;
}
Community
  • 1
  • 1
pankeel
  • 1,138
  • 1
  • 10
  • 22
  • Actually i want to web request that website. If some one knows, just write it here the code, i'm making a project and this is the finnally thing i still need to do. So let me know. – user3257979 Feb 01 '14 at 09:02
  • I saw the website: www.newocr.com has a specific language character recognition which allows me to get the string from the image more easier, but i'm stuck web request it. Please some one need to help me doing the web request for this. – user3257979 Feb 01 '14 at 09:09
  • first upload your ocr image in this site second select your language third click on upload image button thant check your result – pankeel Feb 01 '14 at 09:18
  • i did through firefox with tamper data, but how should i implement this in c#? – user3257979 Feb 01 '14 at 09:20
  • Any help guys? I'm very stucked in this and i really need to web request this website, is very important for me... – user3257979 Feb 01 '14 at 09:28
  • So i tried implementing this: http://cristiroma.wordpress.com/2010/06/08/how-to-programatically-upload-a-file-in-c-using-httpwebrequest/ and calling it like this: ImportUtilities.HttpUploadFile("http://www.newocr.com", "image.png", "paramName", "image/png", valueCollection); but i don't know what should i put in paramName and valueCollection – user3257979 Feb 01 '14 at 09:34
  • http://www.ocrwebservice.com/services/OCRWebService.asmx?op=OCRWebServiceRecognize – pankeel Feb 01 '14 at 09:34
  • download project in this site ocrwebservice.com/support/DeveloperInformation.aspx – pankeel Feb 01 '14 at 09:39
  • sign in this website that can be send all the details – pankeel Feb 01 '14 at 09:45
  • oh it's just a 30 days trial and i need full, guys this webrequest for www.newocr.com is easier, so please help me doing this. – user3257979 Feb 01 '14 at 09:46
  • pankeel thanks for this new service but it's a trial, however can you help me trying to get the correct data from www.newocr.com ? right now im trying as i said before, but what are those 2 things? paramName and valueCollection. what are the values from the website? – user3257979 Feb 01 '14 at 09:49
  • sir, http://stackoverflow.com/questions/10067002/tesseract-3-ocr-net-wrapper follow this post newocr based on tesseract-3 so you check this – pankeel Feb 01 '14 at 09:56
  • http://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data for httpupload file – pankeel Feb 01 '14 at 09:57
  • not quiet, not really understand what i need to put and how many in: nvc.Add("", ""); – user3257979 Feb 01 '14 at 10:24
  • to you too ^_^ my friend – user3257979 Feb 01 '14 at 10:39