mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Bazaar:Leptonica - Wrapped a page layout analysis function, with demo
git-svn-id: svn://ultimatepp.org/upp/trunk@1557 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
a5ad08c0e1
commit
e117b8a3ba
21 changed files with 653 additions and 121 deletions
32
bazaar/PixRaster/Lept-PageSeg.cpp
Normal file
32
bazaar/PixRaster/Lept-PageSeg.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "PixRaster.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
// top level page segmenting
|
||||
bool PixRaster::GetRegionsBinary(int page)
|
||||
{
|
||||
if(IsEmpty())
|
||||
return false;
|
||||
page = getTruePage(page);
|
||||
|
||||
PIX *ht, *tl, *tb;
|
||||
PIX *pix = pixaGetPix(pixa, page, L_CLONE);
|
||||
int res = pixGetRegionsBinary(pix, &ht, &tl, &tb, 0);
|
||||
pixDestroy(&pix);
|
||||
if(res)
|
||||
return false;
|
||||
AddPIX(ht);
|
||||
AddPIX(tl);
|
||||
AddPIX(tb);
|
||||
pixDestroy(&ht);
|
||||
pixDestroy(&tl);
|
||||
pixDestroy(&tb);
|
||||
|
||||
// seeks the ht page
|
||||
SeekPage(-2);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
183
bazaar/PixRaster/Leptonica.upp~
Normal file
183
bazaar/PixRaster/Leptonica.upp~
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
description "Leptonica image library\377";
|
||||
|
||||
noblitz;
|
||||
|
||||
uses
|
||||
plugin\tif,
|
||||
plugin\png;
|
||||
|
||||
include
|
||||
lib;
|
||||
|
||||
file
|
||||
source readonly separator,
|
||||
lib/adaptmap.c,
|
||||
lib/affine.c,
|
||||
lib/affinecompose.c,
|
||||
lib/arithlow.c,
|
||||
lib/arrayaccess.c,
|
||||
lib/bardecode.c,
|
||||
lib/baseline.c,
|
||||
lib/bbuffer.c,
|
||||
lib/bilinear.c,
|
||||
lib/binarize.c,
|
||||
lib/binexpand.c,
|
||||
lib/binexpandlow.c,
|
||||
lib/binreduce.c,
|
||||
lib/binreducelow.c,
|
||||
lib/blend.c,
|
||||
lib/bmf.c,
|
||||
lib/bmpio.c,
|
||||
lib/bmpiostub.c,
|
||||
lib/boxbasic.c,
|
||||
lib/boxfunc1.c,
|
||||
lib/boxfunc2.c,
|
||||
lib/boxfunc3.c,
|
||||
lib/ccbord.c,
|
||||
lib/ccthin.c,
|
||||
lib/classapp.c,
|
||||
lib/colorcontent.c,
|
||||
lib/colormap.c,
|
||||
lib/colormorph.c,
|
||||
lib/colorquant1.c,
|
||||
lib/colorquant2.c,
|
||||
lib/colorseg.c,
|
||||
lib/compare.c,
|
||||
lib/conncomp.c,
|
||||
lib/convolve.c,
|
||||
lib/convolvelow.c,
|
||||
lib/correlscore.c,
|
||||
lib/dwacomb.2.c,
|
||||
lib/dwacomblow.2.c,
|
||||
lib/edge.c,
|
||||
lib/endiantest.c,
|
||||
lib/enhance.c,
|
||||
lib/fhmtauto.c,
|
||||
lib/fhmtgen.1.c,
|
||||
lib/fhmtgenlow.1.c,
|
||||
lib/flipdetect.c,
|
||||
lib/fliphmtgen.c,
|
||||
lib/fmorphauto.c,
|
||||
lib/fmorphgen.1.c,
|
||||
lib/fmorphgenlow.1.c,
|
||||
lib/fpix1.c,
|
||||
lib/fpix2.c,
|
||||
lib/gifio.c,
|
||||
lib/gifiostub.c,
|
||||
lib/gplot.c,
|
||||
lib/graphics.c,
|
||||
lib/graymorph.c,
|
||||
lib/graymorphlow.c,
|
||||
lib/grayquant.c,
|
||||
lib/grayquantlow.c,
|
||||
lib/heap.c,
|
||||
lib/jbclass.c,
|
||||
lib/jpegio.c,
|
||||
lib/jpegiostub.c,
|
||||
lib/kernel.c,
|
||||
lib/list.c,
|
||||
lib/maze.c,
|
||||
lib/morphapp.c,
|
||||
lib/morph.c,
|
||||
lib/morphdwa.c,
|
||||
lib/morphseq.c,
|
||||
lib/numabasic.c,
|
||||
lib/numafunc1.c,
|
||||
lib/numafunc2.c,
|
||||
lib/pageseg.c,
|
||||
lib/paintcmap.c,
|
||||
lib/parseprotos.c,
|
||||
lib/partition.c,
|
||||
lib/pix1.c,
|
||||
lib/pix2.c,
|
||||
lib/pix3.c,
|
||||
lib/pix4.c,
|
||||
lib/pixabasic.c,
|
||||
lib/pixacc.c,
|
||||
lib/pixafunc1.c,
|
||||
lib/pixafunc2.c,
|
||||
lib/pixalloc.c,
|
||||
lib/pixarith.c,
|
||||
lib/pixconv.c,
|
||||
lib/pixtiling.c,
|
||||
lib/pngio.c,
|
||||
lib/pngiostub.c,
|
||||
lib/pnmio.c,
|
||||
lib/pnmiostub.c,
|
||||
lib/projective.c,
|
||||
lib/psio.c,
|
||||
lib/psiostub.c,
|
||||
lib/ptra.c,
|
||||
lib/pts.c,
|
||||
lib/queue.c,
|
||||
lib/rank.c,
|
||||
lib/readbarcode.c,
|
||||
lib/readfile.c,
|
||||
lib/rop.c,
|
||||
lib/ropiplow.c,
|
||||
lib/roplow.c,
|
||||
lib/rotateam.c,
|
||||
lib/rotateamlow.c,
|
||||
lib/rotate.c,
|
||||
lib/rotateorth.c,
|
||||
lib/rotateorthlow.c,
|
||||
lib/rotateshear.c,
|
||||
lib/runlength.c,
|
||||
lib/sarray.c,
|
||||
lib/scale.c,
|
||||
lib/scalelow.c,
|
||||
lib/seedfill.c,
|
||||
lib/seedfilllow.c,
|
||||
lib/sel1.c,
|
||||
lib/sel2.c,
|
||||
lib/selgen.c,
|
||||
lib/shear.c,
|
||||
lib/skew.c,
|
||||
lib/stack.c,
|
||||
lib/textops.c,
|
||||
lib/tiffio.c,
|
||||
lib/tiffiostub.c,
|
||||
lib/utils.c,
|
||||
lib/viewfiles.c,
|
||||
lib/warper.c,
|
||||
lib/watershed.c,
|
||||
lib/writefile.c,
|
||||
lib/zlibmem.c,
|
||||
lib/zlibmemstub.c,
|
||||
header readonly separator,
|
||||
lib/allheaders.h,
|
||||
lib/alltypes.h,
|
||||
lib/arrayaccess.h,
|
||||
lib/array.h,
|
||||
lib/bbuffer.h,
|
||||
lib/bmf.h,
|
||||
lib/bmp.h,
|
||||
lib/ccbord.h,
|
||||
lib/environ.h,
|
||||
lib/gplot.h,
|
||||
lib/heap.h,
|
||||
lib/imageio.h,
|
||||
lib/jbclass.h,
|
||||
lib/jmorecfg.h,
|
||||
lib/jpeglib.h,
|
||||
lib/leptprotos.h,
|
||||
lib/list.h,
|
||||
lib/morph.h,
|
||||
lib/pix.h,
|
||||
lib/ptra.h,
|
||||
lib/queue.h,
|
||||
lib/readbarcode.h,
|
||||
lib/stack.h,
|
||||
lib/watershed.h,
|
||||
main readonly separator,
|
||||
PixRaster.h,
|
||||
Leptonica.h,
|
||||
PixRasterLoad.cpp,
|
||||
PixRasterLept.cpp,
|
||||
PixRaster.cpp,
|
||||
TiffIo.cpp,
|
||||
UppLept.cpp,
|
||||
Lept-Skew.cpp,
|
||||
Lept-Threshold.cpp,
|
||||
src.tpp;
|
||||
|
||||
|
|
@ -270,6 +270,11 @@ class PixRaster : public Raster
|
|||
|
||||
bool CombineMasked(int destPage, int sourcePage, int maskPage);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DOCUMENT PAGE SEGMENTING FUNCTIONS
|
||||
|
||||
// top level page segmenting
|
||||
bool GetRegionsBinary(int page = PIXRASTER_CURPAGE) ;
|
||||
|
||||
|
||||
}; // END class PixRaster
|
||||
|
|
|
|||
|
|
@ -181,5 +181,6 @@ file
|
|||
Lept-Morph.cpp,
|
||||
Lept-Arith.cpp,
|
||||
Lept-Blend.cpp,
|
||||
Lept-PageSeg.cpp,
|
||||
src.tpp;
|
||||
|
||||
|
|
|
|||
186
bazaar/PixRaster/PixRaster.upp~
Normal file
186
bazaar/PixRaster/PixRaster.upp~
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
description "Leptonica image library\377";
|
||||
|
||||
noblitz;
|
||||
|
||||
uses
|
||||
plugin\tif,
|
||||
plugin\png;
|
||||
|
||||
include
|
||||
lib;
|
||||
|
||||
file
|
||||
source readonly separator,
|
||||
lib/adaptmap.c,
|
||||
lib/affine.c,
|
||||
lib/affinecompose.c,
|
||||
lib/arithlow.c,
|
||||
lib/arrayaccess.c,
|
||||
lib/bardecode.c,
|
||||
lib/baseline.c,
|
||||
lib/bbuffer.c,
|
||||
lib/bilinear.c,
|
||||
lib/binarize.c,
|
||||
lib/binexpand.c,
|
||||
lib/binexpandlow.c,
|
||||
lib/binreduce.c,
|
||||
lib/binreducelow.c,
|
||||
lib/blend.c,
|
||||
lib/bmf.c,
|
||||
lib/bmpio.c,
|
||||
lib/bmpiostub.c,
|
||||
lib/boxbasic.c,
|
||||
lib/boxfunc1.c,
|
||||
lib/boxfunc2.c,
|
||||
lib/boxfunc3.c,
|
||||
lib/ccbord.c,
|
||||
lib/ccthin.c,
|
||||
lib/classapp.c,
|
||||
lib/colorcontent.c,
|
||||
lib/colormap.c,
|
||||
lib/colormorph.c,
|
||||
lib/colorquant1.c,
|
||||
lib/colorquant2.c,
|
||||
lib/colorseg.c,
|
||||
lib/compare.c,
|
||||
lib/conncomp.c,
|
||||
lib/convolve.c,
|
||||
lib/convolvelow.c,
|
||||
lib/correlscore.c,
|
||||
lib/dwacomb.2.c,
|
||||
lib/dwacomblow.2.c,
|
||||
lib/edge.c,
|
||||
lib/endiantest.c,
|
||||
lib/enhance.c,
|
||||
lib/fhmtauto.c,
|
||||
lib/fhmtgen.1.c,
|
||||
lib/fhmtgenlow.1.c,
|
||||
lib/flipdetect.c,
|
||||
lib/fliphmtgen.c,
|
||||
lib/fmorphauto.c,
|
||||
lib/fmorphgen.1.c,
|
||||
lib/fmorphgenlow.1.c,
|
||||
lib/fpix1.c,
|
||||
lib/fpix2.c,
|
||||
lib/gifio.c,
|
||||
lib/gifiostub.c,
|
||||
lib/gplot.c,
|
||||
lib/graphics.c,
|
||||
lib/graymorph.c,
|
||||
lib/graymorphlow.c,
|
||||
lib/grayquant.c,
|
||||
lib/grayquantlow.c,
|
||||
lib/heap.c,
|
||||
lib/jbclass.c,
|
||||
lib/jpegio.c,
|
||||
lib/jpegiostub.c,
|
||||
lib/kernel.c,
|
||||
lib/list.c,
|
||||
lib/maze.c,
|
||||
lib/morphapp.c,
|
||||
lib/morph.c,
|
||||
lib/morphdwa.c,
|
||||
lib/morphseq.c,
|
||||
lib/numabasic.c,
|
||||
lib/numafunc1.c,
|
||||
lib/numafunc2.c,
|
||||
lib/pageseg.c,
|
||||
lib/paintcmap.c,
|
||||
lib/parseprotos.c,
|
||||
lib/partition.c,
|
||||
lib/pix1.c,
|
||||
lib/pix2.c,
|
||||
lib/pix3.c,
|
||||
lib/pix4.c,
|
||||
lib/pixabasic.c,
|
||||
lib/pixacc.c,
|
||||
lib/pixafunc1.c,
|
||||
lib/pixafunc2.c,
|
||||
lib/pixalloc.c,
|
||||
lib/pixarith.c,
|
||||
lib/pixconv.c,
|
||||
lib/pixtiling.c,
|
||||
lib/pngio.c,
|
||||
lib/pngiostub.c,
|
||||
lib/pnmio.c,
|
||||
lib/pnmiostub.c,
|
||||
lib/projective.c,
|
||||
lib/psio.c,
|
||||
lib/psiostub.c,
|
||||
lib/ptra.c,
|
||||
lib/pts.c,
|
||||
lib/queue.c,
|
||||
lib/rank.c,
|
||||
lib/readbarcode.c,
|
||||
lib/readfile.c,
|
||||
lib/rop.c,
|
||||
lib/ropiplow.c,
|
||||
lib/roplow.c,
|
||||
lib/rotateam.c,
|
||||
lib/rotateamlow.c,
|
||||
lib/rotate.c,
|
||||
lib/rotateorth.c,
|
||||
lib/rotateorthlow.c,
|
||||
lib/rotateshear.c,
|
||||
lib/runlength.c,
|
||||
lib/sarray.c,
|
||||
lib/scale.c,
|
||||
lib/scalelow.c,
|
||||
lib/seedfill.c,
|
||||
lib/seedfilllow.c,
|
||||
lib/sel1.c,
|
||||
lib/sel2.c,
|
||||
lib/selgen.c,
|
||||
lib/shear.c,
|
||||
lib/skew.c,
|
||||
lib/stack.c,
|
||||
lib/textops.c,
|
||||
lib/tiffio.c,
|
||||
lib/tiffiostub.c,
|
||||
lib/utils.c,
|
||||
lib/viewfiles.c,
|
||||
lib/warper.c,
|
||||
lib/watershed.c,
|
||||
lib/writefile.c,
|
||||
lib/zlibmem.c,
|
||||
lib/zlibmemstub.c,
|
||||
header readonly separator,
|
||||
lib/allheaders.h,
|
||||
lib/alltypes.h,
|
||||
lib/arrayaccess.h,
|
||||
lib/array.h,
|
||||
lib/bbuffer.h,
|
||||
lib/bmf.h,
|
||||
lib/bmp.h,
|
||||
lib/ccbord.h,
|
||||
lib/environ.h,
|
||||
lib/gplot.h,
|
||||
lib/heap.h,
|
||||
lib/imageio.h,
|
||||
lib/jbclass.h,
|
||||
lib/jmorecfg.h,
|
||||
lib/jpeglib.h,
|
||||
lib/leptprotos.h,
|
||||
lib/list.h,
|
||||
lib/morph.h,
|
||||
lib/pix.h,
|
||||
lib/ptra.h,
|
||||
lib/queue.h,
|
||||
lib/readbarcode.h,
|
||||
lib/stack.h,
|
||||
lib/watershed.h,
|
||||
main readonly separator,
|
||||
PixRaster.h,
|
||||
Leptonica.h,
|
||||
PixRasterLoad.cpp,
|
||||
PixRaster.cpp,
|
||||
TiffIo.cpp,
|
||||
UppLept.cpp,
|
||||
Lept-Skew.cpp,
|
||||
Lept-Threshold.cpp,
|
||||
Lept-Rotate.cpp,
|
||||
Lept-Morph.cpp,
|
||||
Lept-Arith.cpp,
|
||||
Lept-Blend.cpp,
|
||||
src.tpp;
|
||||
|
||||
20
bazaar/PixRaster/src.tpp/Blend$en-us.tpp
Normal file
20
bazaar/PixRaster/src.tpp/Blend$en-us.tpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
topic "Combining/blending functions";
|
||||
[ $$0,0#00000000000000000000000000000000:Default]
|
||||
[H6;0 $$1,0#05600065144404261032431302351956:begin]
|
||||
[i448;a25;kKO9;2 $$2,0#37138531426314131252341829483370:codeitem]
|
||||
[l288;2 $$3,0#27521748481378242620020725143825:desc]
|
||||
[0 $$4,0#96390100711032703541132217272105:end]
|
||||
[{_}%EN-US
|
||||
[s0;%- &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Combining/blending functions]]}}&]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:CombineMasked`(int`,int`,int`):%- [@(0.0.255) bool]_[* CombineMasked]([@(0.0.255) i
|
||||
nt]_[*@3 destPage], [@(0.0.255) int]_[*@3 sourcePage], [@(0.0.255) int]_[*@3 maskPage])&]
|
||||
[s3; Creates an image from [%-*@3 destPage] with pixels replaced by
|
||||
[%-*@3 sourcePage]`'s ones if corresponding bits of [%-*@3 maskPage
|
||||
]are set.&]
|
||||
[s3; The combined image is appended at the end of PixRaster.&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s0; ]
|
||||
|
|
@ -19,6 +19,9 @@ odd number if not) If both [%-*@3 hsize] and [%-*@3 vsize] are equal
|
|||
to 1, [* ErodeGray] just returns a cloned image.&]
|
||||
[s3; Erosion remove pixels on objects boundaries; the amount of eroded
|
||||
pixels depends on size of [* Sel]s&]
|
||||
[s3; Eroded image is appended at the end of PixRaster&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -33,6 +36,9 @@ odd number if not) If both [%-*@3 hsize] and [%-*@3 vsize] are equal
|
|||
to 1, [* DilateGray] just returns a cloned image.&]
|
||||
[s3; Dilation adds pixels on objects boundaries; the amount of added
|
||||
pixels depends on size of [* Sel]s&]
|
||||
[s3; Dilated image is appended at the end of PixRaster&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -47,6 +53,9 @@ odd number if not) If both [%-*@3 hsize] and [%-*@3 vsize] are equal
|
|||
to 1, [* OpenGray] just returns a cloned image.&]
|
||||
[s3; Opening combines an [* erosion] operation followed by a [* dilation]
|
||||
one; the amount of added/eroded pixels depends on size of [* Sel]s&]
|
||||
[s3; Opened image is appended at the end of PixRaster&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -61,6 +70,9 @@ odd number if not) If both [%-*@3 hsize] and [%-*@3 vsize] are equal
|
|||
to 1, [* CloseGray] just returns a cloned image.&]
|
||||
[s3; Closing combines a [* dilation] operation followed by an [* erosion
|
||||
]one; the amount of added/eroded pixels depends on size of [* Sel]s&]
|
||||
[s3; Closed image is appended at the end of PixRaster&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s0; ]
|
||||
24
bazaar/PixRaster/src.tpp/PageSeg$en-us.tpp
Normal file
24
bazaar/PixRaster/src.tpp/PageSeg$en-us.tpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
topic "";
|
||||
[ $$0,0#00000000000000000000000000000000:Default]
|
||||
[H6;0 $$1,0#05600065144404261032431302351956:begin]
|
||||
[i448;a25;kKO9;2 $$2,0#37138531426314131252341829483370:codeitem]
|
||||
[l288;2 $$3,0#27521748481378242620020725143825:desc]
|
||||
[0 $$4,0#96390100711032703541132217272105:end]
|
||||
[{_}%EN-US
|
||||
[s0;%- &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Page segmentation/layout analysis functions]]}}&]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:GetRegionsBinary`(int`):%- [@(0.0.255) bool]_[* GetRegionsBinary]([@(0.0.255) i
|
||||
nt]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; Gets layout masks for image at [%-*@3 page]. Masks are appended
|
||||
at the end of PixRaster in this sequence :&]
|
||||
[s3;i150;O0; Halftone mask-|-|1 bpp mask for halftone page parts&]
|
||||
[s3;i150;O0; Textline mask-|-|1 bpp mask for text lines inside page&]
|
||||
[s3;i150;O0; Textblock mask-|-|1 bpp mask for text blocks inside page&]
|
||||
[s3; Active PixRaster page is set to first (Halftone) of the three
|
||||
resulting masks.&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s0; ]
|
||||
|
|
@ -237,6 +237,24 @@ nt]_[@3 page])&]
|
|||
[s2;%% Returns the size of Raster in pixels for [%-*@3 page].&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:PixRaster`:`:GetWidth`(`): [@(0.0.255) virtual] [@(0.0.255) int]_GetWidth()&]
|
||||
[s2;%% Returns the width of Raster in pixels for active page.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:PixRaster`:`:GetWidth`(int`): [@(0.0.255) virtual] [@(0.0.255) int]_GetWidth([@(0.0.255) i
|
||||
nt]_[@3 page])&]
|
||||
[s2;%% Returns the width of Raster in pixels for [%-*@3 page].&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:PixRaster`:`:GetHeight`(`): [@(0.0.255) virtual] [@(0.0.255) int]_GetHeight()&]
|
||||
[s2;%% Returns the height of Raster in pixels for active page.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:PixRaster`:`:GetHeight`(int`): [@(0.0.255) virtual] [@(0.0.255) int]_GetHeight([@(0.0.255) i
|
||||
nt]_[@3 page])&]
|
||||
[s2;%% Returns the height of Raster in pixels for [%-*@3 page].&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:PixRaster`:`:GetInfo`(void`): [@(0.0.255) virtual] [_^Raster`:`:Info^ Info]_GetInfo(
|
||||
[@(0.0.255) void])&]
|
||||
[s2;%% Returns the information about Raster`'s active page.&]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ in black or white depending on [%-*@3 incolor] parameter.&]
|
|||
[s3; Image must be in 2, 4, 8 or 32 bpp format, either paletted or
|
||||
grayscale. The rotated image is appended to PixRaster and active
|
||||
page is set to it.&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -30,7 +30,7 @@ filled with [%-*@3 colorval].&]
|
|||
[s3; Image must be in 2, 4, 8 or 32 bpp format, either paletted or
|
||||
grayscale. The rotated image is appended to PixRaster and active
|
||||
page is set to it.&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -43,5 +43,7 @@ filled with [%-*@3 grayval].&]
|
|||
[s3; Image must be in 2, 4, 8 or 32 bpp format, either paletted or
|
||||
grayscale. The rotated image is appended to PixRaster and active
|
||||
page is set to it.&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s0; ]
|
||||
|
|
@ -17,7 +17,8 @@ the skew factor.&]
|
|||
[s3; [* WARNINGS ]: it operates [* ONLY ]on [* 1bpp monochromatic] images;
|
||||
if the skew factor is too low or not found, it just returns a
|
||||
clone of source image.&]
|
||||
[s4; &]
|
||||
[s3; Deskewed image is appended at the end of PixRaster&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -31,15 +32,17 @@ It uses [%-*@3 ReductionFactor] value while binary`-searching for
|
|||
the skew factor. If [%-*@3 skewAngle] and [%-*@3 confidenceFactor]
|
||||
pointers are non`-NULL, it sets them to the skew angle and the
|
||||
confidence value found when de`-skewing&]
|
||||
[s4; &]
|
||||
[s3; Deskewed image is appended at the end of PixRaster&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:FindSkew`(double`*`,double`*`,int`):%- [@(0.0.255) bool]_[* FindSkew]([@(0.0.255) d
|
||||
ouble]_`*[*@3 pangle], [@(0.0.255) double]_`*[*@3 pconf]_`=_NULL, [@(0.0.255) int]_[*@3 pag
|
||||
e]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; Try to find skew of [%-*@3 page] and returns it`'s value in [%-*@3 pangle]
|
||||
; confidence factor is returned in [%-*@3 pconf].&]
|
||||
[s4; &]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -51,7 +54,7 @@ ol]_[* FindSkewSweep]([@(0.0.255) double]_`*[*@3 pangle], [@(0.0.255) int]_[*@3
|
|||
of [%-*@3 page] and returns it`'s value in [%-*@3 pangle] ; Uses
|
||||
[%-*@3 reduction] factor in binary searching, a semi`-range of
|
||||
[%-*@3 sweeprange] skew angle and steps by [%-*@3 sweepdelta] value.&]
|
||||
[s4; &]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
|
|
@ -68,16 +71,16 @@ in [%-*@3 pconf].[%-*@3 redsweep] is the sweep reduction factor (1,
|
|||
is the half the full range, assumed about 0; in degrees , [%-*@3 sweepdelta]
|
||||
the angle increment of sweep; in degrees and [%-*@3 minbsdelta]
|
||||
the min binary search increment angle; in degrees.&]
|
||||
[s4; &]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[s3; [* Notes ]:&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[s3;i150;O1; This finds the skew angle, doing first a sweep through
|
||||
a set of equal angles, and then doing a binary search until convergence.&]
|
||||
[s3;i150;O1; Caller must check the return value for validity of the
|
||||
result.&]
|
||||
[s0; &]
|
||||
[s3; &]
|
||||
[s3;i150;O1; In computing the differential line sum variance score,
|
||||
we sum the result over scanlines, but we always skip:&]
|
||||
[s3;l448;i150;O0; at least one scanline&]
|
||||
|
|
|
|||
|
|
@ -4,126 +4,128 @@ topic "Image thresholding functions";
|
|||
[i448;a25;kKO9;2 $$2,0#37138531426314131252341829483370:codeitem]
|
||||
[l288;2 $$3,0#27521748481378242620020725143825:desc]
|
||||
[0 $$4,0#96390100711032703541132217272105:end]
|
||||
[{_}
|
||||
[s0; &]
|
||||
[ {{10000F(128)G(128)@1 [s0;%% [* Image thresholding functions]]}}&]
|
||||
[s1; &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:DitherToBinary`(int`): [@(0.0.255) bool]_[* DitherToBinary]([@(0.0.255) i
|
||||
[{_}%EN-US
|
||||
[s0;%- &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Image thresholding functions]]}}&]
|
||||
[s1;%- &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:DitherToBinary`(int`):%- [@(0.0.255) bool]_[* DitherToBinary]([@(0.0.255) i
|
||||
nt]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:DitherToBinarySpec`(int`,int`,int`): [@(0.0.255) bool]_[* DitherToBinar
|
||||
ySpec]([@(0.0.255) int]_[*@3 lowerclip], [@(0.0.255) int]_[*@3 upperclip],
|
||||
[s3; [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:DitherToBinarySpec`(int`,int`,int`):%- [@(0.0.255) bool]_[* DitherToBin
|
||||
arySpec]([@(0.0.255) int]_[*@3 lowerclip], [@(0.0.255) int]_[*@3 upperclip],
|
||||
[@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 lowerclip] [%-*@3 upperclip] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:ThresholdToBinary`(int`,int`): [@(0.0.255) bool]_[* ThresholdToBinary](
|
||||
[@(0.0.255) int]_[*@3 threshold], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% Creates a new 1bpp black/white image from source`'s grayscale
|
||||
[s3; [%-*@3 lowerclip] [%-*@3 upperclip] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:ThresholdToBinary`(int`,int`):%- [@(0.0.255) bool]_[* ThresholdToBinary
|
||||
]([@(0.0.255) int]_[*@3 threshold], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; Creates a new 1bpp black/white image from source`'s grayscale
|
||||
[%-*@3 page] using [%-*@3 threshold] as limiting value. Newly created
|
||||
image is appended at the end of PixRaster, and currently active
|
||||
page is set to it.&]
|
||||
[s3;%% [* WARNING], it operates [* ONLY ]on grayscale source images.&]
|
||||
[s4;%% &]
|
||||
[s3;%% Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:VarThresholdToBinary`(int`,int`): [@(0.0.255) bool]_[* VarThresholdToBi
|
||||
nary]([@(0.0.255) int]_[*@3 thresholdPage], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CUR
|
||||
PAGE)&]
|
||||
[s3;%% [%-*@3 thresholdPage] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:DitherToBinaryLUT`(int`,int`,int`): [@(0.0.255) bool]_[* DitherToBinary
|
||||
LUT]([@(0.0.255) int]_[*@3 lowerclip], [@(0.0.255) int]_[*@3 upperclip],
|
||||
[s3; [* WARNING], it operates [* ONLY ]on grayscale source images.&]
|
||||
[s3; Thresholded image is appended at the end of PixRaster&]
|
||||
[s3; &]
|
||||
[s3; Returns [%-@(0.0.255) true] on success, [%-@(0.0.255) false] otherwise.&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:VarThresholdToBinary`(int`,int`):%- [@(0.0.255) bool]_[* VarThresholdTo
|
||||
Binary]([@(0.0.255) int]_[*@3 thresholdPage], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_C
|
||||
URPAGE)&]
|
||||
[s3; [%-*@3 thresholdPage] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:DitherToBinaryLUT`(int`,int`,int`):%- [@(0.0.255) bool]_[* DitherToBina
|
||||
ryLUT]([@(0.0.255) int]_[*@3 lowerclip], [@(0.0.255) int]_[*@3 upperclip],
|
||||
[@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 lowerclip] [%-*@3 upperclip] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByValue`(int`,int`): [@(0.0.255) bool]_[* GenerateMaskByVal
|
||||
ue]([@(0.0.255) int]_[*@3 val], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 val] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByBand`(int`,int`,int`,int`): [@(0.0.255) bool]_[* Generate
|
||||
MaskByBand]([@(0.0.255) int]_[*@3 lower], [@(0.0.255) int]_[*@3 upper],
|
||||
[s3; [%-*@3 lowerclip] [%-*@3 upperclip] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByValue`(int`,int`):%- [@(0.0.255) bool]_[* GenerateMaskByV
|
||||
alue]([@(0.0.255) int]_[*@3 val], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; [%-*@3 val] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByBand`(int`,int`,int`,int`):%- [@(0.0.255) bool]_[* Genera
|
||||
teMaskByBand]([@(0.0.255) int]_[*@3 lower], [@(0.0.255) int]_[*@3 upper],
|
||||
[@(0.0.255) int]_[*@3 inband], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 lower] [%-*@3 upper] [%-*@3 inband] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:DitherTo2bpp`(int`,int`): [@(0.0.255) bool]_[* DitherTo2bpp]([@(0.0.255) i
|
||||
[s3; [%-*@3 lower] [%-*@3 upper] [%-*@3 inband] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:DitherTo2bpp`(int`,int`):%- [@(0.0.255) bool]_[* DitherTo2bpp]([@(0.0.255) i
|
||||
nt]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:DitherTo2bppSpec`(int`,int`,int`,int`): [@(0.0.255) bool]_[* DitherTo2b
|
||||
ppSpec]([@(0.0.255) int]_[*@3 lowerclip], [@(0.0.255) int]_[*@3 upperclip],
|
||||
[s3; [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:DitherTo2bppSpec`(int`,int`,int`,int`):%- [@(0.0.255) bool]_[* DitherTo
|
||||
2bppSpec]([@(0.0.255) int]_[*@3 lowerclip], [@(0.0.255) int]_[*@3 upperclip],
|
||||
[@(0.0.255) int]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 lowerclip] [%-*@3 upperclip] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:ThresholdTo2bpp`(int`,int`,int`): [@(0.0.255) bool]_[* ThresholdTo2bpp](
|
||||
[@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 page]_
|
||||
`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 nlevels] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:ThresholdTo4bpp`(int`,int`,int`): [@(0.0.255) bool]_[* ThresholdTo4bpp](
|
||||
[@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 page]_
|
||||
`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 nlevels] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:ThresholdOn8bpp`(int`,int`,int`): [@(0.0.255) bool]_[* ThresholdOn8bpp](
|
||||
[@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 page]_
|
||||
`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 nlevels] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:ThresholdGrayArb`(const char`*`,int`,int`,int`,int`,int`): [@(0.0.255) b
|
||||
[s3; [%-*@3 lowerclip] [%-*@3 upperclip] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:ThresholdTo2bpp`(int`,int`,int`):%- [@(0.0.255) bool]_[* ThresholdTo2bp
|
||||
p]([@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 pag
|
||||
e]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; [%-*@3 nlevels] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:ThresholdTo4bpp`(int`,int`,int`):%- [@(0.0.255) bool]_[* ThresholdTo4bp
|
||||
p]([@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 pag
|
||||
e]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; [%-*@3 nlevels] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:ThresholdOn8bpp`(int`,int`,int`):%- [@(0.0.255) bool]_[* ThresholdOn8bp
|
||||
p]([@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 cmapflag], [@(0.0.255) int]_[*@3 pag
|
||||
e]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; [%-*@3 nlevels] [%-*@3 cmapflag] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:ThresholdGrayArb`(const char`*`,int`,int`,int`,int`,int`):%- [@(0.0.255) b
|
||||
ool]_[* ThresholdGrayArb]([@(0.0.255) const]_[@(0.0.255) char]_`*[*@3 edgevals],
|
||||
[@(0.0.255) int]_[*@3 outdepth], [@(0.0.255) int]_[*@3 use`_average],
|
||||
[@(0.0.255) int]_[*@3 setblack], [@(0.0.255) int]_[*@3 setwhite], [@(0.0.255) int]_[*@3 page]_
|
||||
`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 edgevals] [%-*@3 outdepth] [%-*@3 use`_average] [%-*@3 setblack]
|
||||
[s3; [%-*@3 edgevals] [%-*@3 outdepth] [%-*@3 use`_average] [%-*@3 setblack]
|
||||
[%-*@3 setwhite] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:MakeGrayQuantIndexTable`(int`): [_^Buffer^ Buffer]<[@(0.0.255) int]>_[* M
|
||||
akeGrayQuantIndexTable]([@(0.0.255) int]_[*@3 nlevels])&]
|
||||
[s3;%% [%-*@3 nlevels].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:MakeGrayQuantTargetTable`(int`,int`): [_^Buffer^ Buffer]<[@(0.0.255) in
|
||||
t]>_[* MakeGrayQuantTargetTable]([@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 dept
|
||||
h])&]
|
||||
[s3;%% [%-*@3 nlevels] [%-*@3 depth].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByBand32`(unsigned`,int`,int`,int`): [@(0.0.255) bool]_[* G
|
||||
enerateMaskByBand32]([@(0.0.255) unsigned]_[*@3 refval], [@(0.0.255) int]_[*@3 delm],
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:MakeGrayQuantIndexTable`(int`):%- [_^Buffer^ Buffer]<[@(0.0.255) int]>_
|
||||
[* MakeGrayQuantIndexTable]([@(0.0.255) int]_[*@3 nlevels])&]
|
||||
[s3; [%-*@3 nlevels].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:MakeGrayQuantTargetTable`(int`,int`):%- [_^Buffer^ Buffer]<[@(0.0.255) i
|
||||
nt]>_[* MakeGrayQuantTargetTable]([@(0.0.255) int]_[*@3 nlevels], [@(0.0.255) int]_[*@3 dep
|
||||
th])&]
|
||||
[s3; [%-*@3 nlevels] [%-*@3 depth].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByBand32`(unsigned`,int`,int`,int`):%- [@(0.0.255) bool]_
|
||||
[* GenerateMaskByBand32]([@(0.0.255) unsigned]_[*@3 refval], [@(0.0.255) int]_[*@3 delm],
|
||||
[@(0.0.255) int]_[*@3 delp], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 refval] [%-*@3 delm] [%-*@3 delp] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByDiscr32`(unsigned`,unsigned`,int`,int`): [@(0.0.255) bo
|
||||
ol]_[* GenerateMaskByDiscr32]([@(0.0.255) unsigned]_[*@3 refval1],
|
||||
[s3; [%-*@3 refval] [%-*@3 delm] [%-*@3 delp] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:GenerateMaskByDiscr32`(unsigned`,unsigned`,int`,int`):%- [@(0.0.255) b
|
||||
ool]_[* GenerateMaskByDiscr32]([@(0.0.255) unsigned]_[*@3 refval1],
|
||||
[@(0.0.255) unsigned]_[*@3 refval2], [@(0.0.255) int]_[*@3 distflag],
|
||||
[@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 refval1] [%-*@3 refval2] [%-*@3 distflag] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:GrayQuantFromHisto`(int`,double`,int`,int`): [@(0.0.255) bool]_[* GrayQ
|
||||
uantFromHisto]([@(0.0.255) int]_[*@3 mPage], [@(0.0.255) double]_[*@3 minfract],
|
||||
[s3; [%-*@3 refval1] [%-*@3 refval2] [%-*@3 distflag] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:GrayQuantFromHisto`(int`,double`,int`,int`):%- [@(0.0.255) bool]_[* Gra
|
||||
yQuantFromHisto]([@(0.0.255) int]_[*@3 mPage], [@(0.0.255) double]_[*@3 minfract],
|
||||
[@(0.0.255) int]_[*@3 maxsize], [@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 mPage] [%-*@3 minfract] [%-*@3 maxsize] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s1; &]
|
||||
[s2;:PixRaster`:`:ThresholdToValue`(int`,int`,int`): [@(0.0.255) bool]_[* ThresholdToValu
|
||||
e]([@(0.0.255) int]_[*@3 threshval], [@(0.0.255) int]_[*@3 setval], [@(0.0.255) int]_[*@3 pag
|
||||
e]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3;%% [%-*@3 threshval] [%-*@3 setval] [%-*@3 page].&]
|
||||
[s4;%% &]
|
||||
[s0; ]
|
||||
[s3; [%-*@3 mPage] [%-*@3 minfract] [%-*@3 maxsize] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s1;%- &]
|
||||
[s2;:PixRaster`:`:ThresholdToValue`(int`,int`,int`):%- [@(0.0.255) bool]_[* ThresholdToVa
|
||||
lue]([@(0.0.255) int]_[*@3 threshval], [@(0.0.255) int]_[*@3 setval],
|
||||
[@(0.0.255) int]_[*@3 page]_`=_PIXRASTER`_CURPAGE)&]
|
||||
[s3; [%-*@3 threshval] [%-*@3 setval] [%-*@3 page].&]
|
||||
[s4; &]
|
||||
[s0;%- ]
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
#include "TestLeptonica.h"
|
||||
|
||||
#include <plugin/tif/tif.h>
|
||||
|
||||
static void RemoveLines(PixRaster &pixRaster)
|
||||
{
|
||||
// gets source image page
|
||||
|
|
@ -88,14 +86,11 @@ void TestLeptonica::onLineRemoval()
|
|||
s.Close();
|
||||
return;
|
||||
}
|
||||
// One<StreamRaster>streamRaster = StreamRaster::OpenAny(s);
|
||||
|
||||
// Loads pixraster from source raster
|
||||
CHECKR(pixRaster.Load(s), "Error loading image");
|
||||
s.Close();
|
||||
|
||||
int ctc = pixRaster.GetPaletteCount();
|
||||
|
||||
// apply line removal algothithm
|
||||
RemoveLines(pixRaster);
|
||||
|
||||
|
|
|
|||
45
bazaar/TestLeptonica/PageLayout.cpp
Normal file
45
bazaar/TestLeptonica/PageLayout.cpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#include "TestLeptonica.h"
|
||||
|
||||
static void PageLayout(PixRaster &pixRaster)
|
||||
{
|
||||
CHECKR(pixRaster.GetRegionsBinary(), "Error getting page layout");
|
||||
}
|
||||
|
||||
void TestLeptonica::onPageLayout()
|
||||
{
|
||||
String fileName;
|
||||
FileSelector fs;
|
||||
PIX *pix;
|
||||
|
||||
if(!PromptYesNo(
|
||||
"[= [* Page layout analysis demo]&&"
|
||||
"Please select a scanned image with mixed text and graphics&"
|
||||
"you can take one from TestLeptonica folder if you like&&"
|
||||
"[* CONTINUE ??]]"
|
||||
))
|
||||
return;
|
||||
|
||||
fs.ReadOnlyOption();
|
||||
if(fs.ExecuteOpen("Please select image for page layout analysis:"))
|
||||
{
|
||||
FileIn s;
|
||||
if(!s.Open(~fs))
|
||||
{
|
||||
PromptOK("Error opening image");
|
||||
s.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
// Loads pixraster from source raster
|
||||
CHECKR(pixRaster.Load(s), "Error loading image");
|
||||
s.Close();
|
||||
|
||||
// apply line removal algothithm
|
||||
PageLayout(pixRaster);
|
||||
|
||||
// refresh the PixRasterCtrl control with the new image contents
|
||||
pixRasterCtrl.Reload();
|
||||
pixRasterCtrl.SetPage(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ class TestLeptonica : public WithTestLeptonicaLayout<TopWindow>
|
|||
|
||||
// button handlers
|
||||
void onLineRemoval(void);
|
||||
void onPageLayout(void);
|
||||
void onQuit(void);
|
||||
|
||||
// PIX raster
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
LAYOUT(TestLeptonicaLayout, 640, 400)
|
||||
ITEM(Button, LineRemovalButton, SetLabel(t_("Line removal test")).LeftPosZ(8, 92).TopPosZ(8, 15))
|
||||
ITEM(Button, PageLayoutButton, SetLabel(t_("Page layout test")).LeftPosZ(8, 92).TopPosZ(32, 15))
|
||||
ITEM(Button, QuitButton, SetLabel(t_("\aQuit")).LeftPosZ(8, 92).BottomPosZ(9, 15))
|
||||
ITEM(PixRasterCtrl, pixRasterCtrl, SetFrame(InsetFrame()).HSizePosZ(108, 8).VSizePosZ(8, 8))
|
||||
ITEM(Button, LineRemovalButton, SetLabel(t_("Line removal test")).LeftPosZ(8, 92).TopPosZ(8, 15))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ file
|
|||
TestLeptonica.lay,
|
||||
TestLeptonica.h,
|
||||
LineRemoval.cpp,
|
||||
PageLayout.cpp,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ TestLeptonica::TestLeptonica()
|
|||
|
||||
// connects button handlers
|
||||
LineRemovalButton <<= THISBACK(onLineRemoval);
|
||||
PageLayoutButton <<= THISBACK(onPageLayout);
|
||||
QuitButton <<= THISBACK(onQuit);
|
||||
}
|
||||
|
||||
|
|
|
|||
BIN
bazaar/TestLeptonica/pageseg1.tif
Normal file
BIN
bazaar/TestLeptonica/pageseg1.tif
Normal file
Binary file not shown.
BIN
bazaar/TestLeptonica/pageseg2.png
Normal file
BIN
bazaar/TestLeptonica/pageseg2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 250 KiB |
BIN
bazaar/TestLeptonica/pageseg3.tif
Normal file
BIN
bazaar/TestLeptonica/pageseg3.tif
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue