cpp

Accessing data of leptonica PIX data

Posted on

This is mainly as a reference   /** * Get Pixel value at given point */ l_uint32 pixAtGet(PIX* pix, int_t x, int_t y) { l_int32 wpl = pixGetWpl(pix); l_uint32* data = pixGetData(pix); l_uint32* line = data + y * wpl; l_uint32 value = GET_DATA_BYTE(line, x); return value; } /** * Get Pixel value at given […]

java

Convert Leptonica PIX data into Java BufferedImage

Posted on

This snippet allows us to convert Leptonica PIX data into Java BufferedImage, in my case the pix->data could be compressed using zlib so I am decompressing before recreating image. We are assuming here that this is bi-tonal image(1 bpp) File used in example : Pix data compressed used ZLib Pix data decompressed Image represented by […]

java

Convert Leptonica PIX data to Java BufferedImage

Posted on

This snippet allows us to convert Leptonica PIX data into Java BufferedImage, in my case the pix->data could be compressed using zlib so I am decompressing before recreating image. We are assuming here that this is bi-tonal image(1 bpp) Sample Usage BufferedImage image = LeptonicaUtil.convert(zlibData, width, height, 1); ImageIO.write(image, "png", new File("C:/temp/test.png")); BufferedImage image = […]

cpp

Leptonica barcode generation

Posted on

Leptonica provides us with easy way to read barcodes but it does not offer a way to create them(as far as I know). Here is a leptonica function that will allow us to generate CODABAR barcode, in the feature I am planning on adding more type and more options but for now this was all […]

development

Leptonica Tutorial – Cropping

Posted on

Common use is to crop to certain area of an image, this can be quite easily accomplished with following code. BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);

development

Leptonica Tutorial – Environment setup

Posted on

Leptonica Development with Eclipse This is the first one of few tutorials that I am writring on using Leptonica image processing library Before we start let’s give credit where the credit is due, and this is goes out to Jay W.(need link) on which this instructions are largely based on. Environment Eclipse MinGW Leptonica I […]