BTW, I just have one more question regarding the pixCreate. Is it default set the bitmap resolution to 300 DPI even though I create the pix* from the bmp with 96 DPI? I saved the tiff file to disk and see it has 300 DPI. But if I manually set the xRes & yRes to 96, then it has 96 DPI of resolution. I don't if it is expectation for DPI.
Sometime, I would like to resample the bitmap which has low resolution and set to 300 DPI for input bitmap of Tesseract OCR. Could you advise me? Thanks. On Wednesday, January 9, 2013 12:34:09 AM UTC+7, TP wrote: > > On Mon, Jan 7, 2013 at 8:47 PM, newbie <duon...@gmail.com <javascript:>> > 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