On Mon, Jan 7, 2013 at 8:47 PM, newbie <duong...@gmail.com> wrote:
> I have created the Pix using pixCreate,pixSetData, pixEndianByteSwap.
> However, when I call pixDestroy, it crashed. Do you know what I am doing
> wrong? Is there any restriction for pixCreate? Noted that Only the pix was
> created by pixCreate crashed.

Sorry, no. You should take a look at how leptonica creates pix from
tiff [1] or png [2], and do something similar.

Did you save the PIX out to disk (as tiff or png) just to make sure
you really were creating it correctly?

Also, in the past when trying to figure out such problems, it's VERY
helpful to step through the failing code with the Visual Studio
debugger. Leptonica heavily uses "reference counting" to figure out
when to free memory. If you do something wrong, you end up freeing
unallocated memory and crashing.

IIRC if you create a Windows GDI object [3] with say CreateBitmap(),
then you better destroy it via DeleteObject and NOT free() it. So...
for leptonica's purposes you might have to make a copy of the data
that leptonica can free, or somehow mess with leptonica's ref counter
so it doesn't try to free the data when the pix is destroyed.

[1] http://tpgit.github.com/Leptonica/tiffio_8c_source.html

[2] http://tpgit.github.com/Leptonica/pngio_8c_source.html

[3] http://msdn.microsoft.com/en-us/library/ms724291(v=VS.85).aspx

-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to tesseract-ocr@googlegroups.com
To unsubscribe from this group, send email to
tesseract-ocr+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

Reply via email to