Open GoogleCodeExporter opened 9 years ago
Your zoomed and rotated images are corrupted. I have never seen this. The
problem is not with the leptonica library.
I ran this:
pix1 = pixRead("input.pbm");
pix2 = pixScale(pix1, 0.6, 0.6);
pix3 = pixRotate90(pix1, 1);
pixWrite("junk.scaled.pnm", pix2, IFF_PNM);
pixWrite("junk.rot.pnm", pix3, IFF_PNM);
pixDisplay(pix1, 0, 100);
pixDisplay(pix2, 500, 100);
pixDisplay(pix3, 1000, 100);
and got properly scaled and rotated images (attached).
Suggest that you display the pix to see if they were corrupted in memory before
writing them out.
Also suggest you go to leptonica.org and download 1.71.
Original comment by dan.bloo...@gmail.com
on 20 May 2014 at 4:08
Attachments:
[deleted comment]
The below flags were defined in our Makefile while compiling Leptonica,
-fPIC
-DL_BIG_ENDIAN
If the second flag is not used during compilation, the 8bpp Gray images have
their bytes swapped out. Any idea why it is so?
>>Also suggest you go to leptonica.org and download 1.71.
It is still not available at http://www.leptonica.org/download.html
Original comment by saa...@gmail.com
on 21 May 2014 at 6:54
You're right about 1.71. Still not up.
Is your hardware big-endian?
Do the zoomed/rotated images look OK with pixDisplay?
Is there byte-swapping when you output in png or bmp?
Original comment by dan.bloo...@gmail.com
on 21 May 2014 at 2:38
>>Is your hardware big-endian?
My hardware is not Big Endian. It was an old PowerPC Makefile, which was
blindly used even while compiling for Intel.
However, when the flag (-DL_BIG_ENDIAN) is removed, the PIX data was byte
swapped in case of 8bpp images. I confirmed this by creating a pgm/pbm file and
comparing the hexdump.
>>Is there byte-swapping when you output in png or bmp?
I have checked it for png and pgm but not for bmp.
>>Do the zoomed/rotated images look OK with pixDisplay?
No, when I removed the flag, the output from pixDisplay() was NG.
I have now removed the flag and added pixEndianByteSwap() every time I read an
image (pbm, png, RAW). With this change, the behaviour is OK for both 8bpp and
1bpp images.
Still not sure why byte swapping is happening. But, surprisingly it works
perefectly fine with RGB images.
I am compiling on a Ubuntu 13.04 Virtual machine. Does it make any difference?
Original comment by saa...@gmail.com
on 21 May 2014 at 5:12
Sorry you've had so much trouble with the endian settings.
Since your hardware is little-endian, try using either the automake makefile or
the static ones that I provide with 1.70.
If you want to use the static makefiles, after you download, type
make-for-local to rename, check which I/O libraries you have and get them set
properly in environ.h, and then type make in src. You can add new targets to
the prog/makefile for your specific applications. See the README.html for
details.
Original comment by dan.bloo...@gmail.com
on 21 May 2014 at 6:18
Thanks a ton for the quick response!!
I will go through README.html, make the necessary changes and share my
observations.
Original comment by saa...@gmail.com
on 21 May 2014 at 7:08
Original issue reported on code.google.com by
saa...@gmail.com
on 20 May 2014 at 9:12Attachments: