Hi everybody,
I am writing a C# Web Application that must perform OCR over various
TIFF files. I am using the latest tessnet2 release (april 21, 2009).
Here is the codebehind of my page:

        tessnet2.Tesseract ocr = null;
        string tessImgPath = "";
        string tessDataPath = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            InitialiseData();

            tessImgPath = Server.MapPath("../Images/P0028594.tif");
            Bitmap image = new Bitmap(tessImgPath);

            List<tessnet2.Word> m_words;
            m_words = ocr.DoOCR(image, Rectangle.Empty);

            if (m_words != null)
            {
                int lc = tessnet2.Tesseract.LineCount(m_words);
                for (int i = 0; i < lc; i++)
                {
                    Response.Write(tessnet2.Tesseract.GetLineText
(m_words, i) + "<br>");
                }
            }
        }

        void InitialiseData()
        {
            ocr = new tessnet2.Tesseract();
            tessDataPath = Server.MapPath("../tessdata");
            ocr.SetRootPath(tessDataPath, "ita");
            ocr.Init("ita", false);
        }

I have the following problem: if the application is running in Debug
mode, it works correctly, while running in Release mode (or also Start
Without Debugging), the row

ocr.Init("ita", false);

causes following error:

Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.

Here is the Stack Trace:

[AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt.]
   fgets(SByte* , Int32 , _iobuf* ) +0
   read_word_list(SByte* filename, UInt64* dawg, Int32 max_num_edges,
Int32 reserved_edges) +562
   init_permute() +543
   program_editup(SByte* configfile) +335
   tessnet2.Tesseract.Init(String lang, Boolean numericMode) +66
   SDG_MODI.Web.Home2.Home.InitialiseData() in C:\Produzione
\PROGETTI_NET\SDG_MODI\SDG_MODI\Web\Home2\frm_HOM2.aspx.cs:110
   SDG_MODI.Web.Home2.Home.Page_Load(Object sender, EventArgs e) in C:
\Produzione\PROGETTI_NET\SDG_MODI\SDG_MODI\Web\Home2\frm_HOM2.aspx.cs:
28
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp,
Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1436

What I have to do for avoid this error?
Another question: I need also to show the TIFF image into the Web
page. Actually it seems not possible, so I think I need some code to
perform a conversion between TIFF and, i.e., JPG. Can someone point me
out to some useful code? Thank you!
Best Regards
ZioZione
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tesseract-ocr?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to