Home » Developing U++ » UppHub » Leptonica library support
Leptonica library support [message #23004] |
Sun, 06 September 2009 18:12 |
mdelfede
Messages: 1308 Registered: September 2007
|
Ultimate Contributor |
|
|
Hi,
I started the porting to UPP of Leptonica image library ( http://www.leptonica.com/ ).
The library provides many high-level raster operations on almost all pixel formats, like morphing, blending, pattern finding, document layout recognition and much more.
The library in bazaar by now wraps just a small amount of Leptonica functions, as the list is really huge, and will be extended in time.
There are 2 packages plus a test application :
PixRaster package : provides PixRaster class wich encapsulates PIX and PIXA Leptonica images and array of images.
It's a multipaged raster class, similar of MemoryRaster, but with many extensions.
Documenting is in progress (almost) with the function wrapping.
PixRasterCtrl package : provides PixRasterCtrl control, which (similar to RasterCtrl for StreamRaster class) provides display and more of Pixraster objects.
The test application demonstrates the usage of both; by now it duplicates just one of the huge amount of examples of Leptonica library, but it'll be extended too.
The example demonstrates background line removal, i.e. the "cleaning" of a scanned drawing originally drawn on a paper with horizontal lines. It uses deskewing of image (elimination of page rotation during scanning process), gray morphing and mask blending, with a really nice result.
On next days I'll add an example about document layout recognition, i.e. the separation of graphic and text parts of a scanned document.
Please beware, the porting has just begun, so it's surely not bug-free nor complete.
If somebody wants to help me with extending the lib/docs is wellcome !
Ciao
Max
|
|
|
|
|
|
|
|
|
Re: Leptonica library support [message #30048 is a reply to message #28177] |
Sun, 05 December 2010 07:16 |
o_wild
Messages: 28 Registered: December 2008 Location: Urmqi
|
Promising Member |
|
|
koldo wrote on Fri, 20 August 2010 14:27 | Hello Massimo
I wanted to compile TestLeptonica package in Windows but I have had some problems. I have used MinGW as it has simpler errors.
As there was errors for not finding png.h, tif.h and zlib.h I have added these internal includes to package:
../../uppsrc/plugin/png
../../uppsrc/plugin/tif/lib
../../uppsrc/plugin/z/lib
Compiling I get this errror:
In file included from C:\upp\uppsrc/Draw/Draw.h:6:0,
from C:\upp\uppsrc\plugin\png/png.h:4,
from C:\upp\bazaar\PixRaster\lib\pngio.c:110:
C:\upp\uppsrc/Core/Core.h:39:20: fatal error: typeinfo: No such file or directory
Do you have any idea?
|
You should add 'lib' as internal includes to package plugin/jpg, plugin/tif and plugin/z using package organizer. I've solved it.
However, another error occurs. My platform is Win32, so 'fh' is defined as 'HANDLE',but my compiler(mingw) report an error about the function 'fdopen', see below.
bool Pix::Load(FileIn &fs, int page)
{
int format;
#ifdef WIN32
HANDLE fh;
#else
int fh;
#endif
Destroy();
fh = fs.GetHandle();
if (!fh)
return false;
FILE *fp = fdopen(fh, "r");
if(!fp)
return false;
...
}
error message:
G:\MyApps\PixRaster\PixRaster.cpp:792:27: error: invalid conversion from 'void*' to 'int'
G:\MyApps\PixRaster\PixRaster.cpp:792:27: error: initializing argument 1 of 'FILE* fdopen(int, const char*)'
Wild
|
|
|
Goto Forum:
Current Time: Fri Sep 20 15:50:38 CEST 2024
Total time taken to generate the page: 0.03197 seconds
|