|
| 1 | +# MFBdjvu |
| 2 | + |
| 3 | +MFBdjvu is a simple project for easy converting pgm and ppm to (MASK+FG+BG)-djvu. |
| 4 | +It uses [djvulibre](http://djvu.sourceforge.net/) for all technichal work and compression. |
| 5 | +The breakdown of the image into components is done using [DjVuL](https://github.com/plzombie/depress/issues/2) and [DjVuL wiki](https://sourceforge.net/p/imthreshold/wiki/DjVuL/?version=3). |
| 6 | + |
| 7 | +MFBdjvu based of [simpledjvu](https://github.com/mihaild/simpledjvu). |
| 8 | + |
| 9 | +## Install |
| 10 | + |
| 11 | +### load submodules |
| 12 | + |
| 13 | +submodules: |
| 14 | + |
| 15 | +- [djvulibre](https://github.com/barak/djvulibre) -> [src](src) |
| 16 | + |
| 17 | +```shell |
| 18 | +$ git submodule init |
| 19 | +$ git submodule update |
| 20 | +``` |
| 21 | + |
| 22 | +### build |
| 23 | + |
| 24 | +Typo: |
| 25 | +```shell |
| 26 | +$ make |
| 27 | +``` |
| 28 | + |
| 29 | +If you want, you can change your PATH variable or copy **mfbdjvu** binary to any directory already included in your PATH. |
| 30 | + |
| 31 | +You need `g++` version supports `c++0x` standard flag. |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +```shell |
| 36 | +simpledjvu [options] input.pnm output.djvu |
| 37 | +``` |
| 38 | + |
| 39 | +where options = |
| 40 | + |
| 41 | +**-dpi n** {300} DPI output djvu. |
| 42 | + |
| 43 | +**-loss n** {1} Use *n* as cjb2 loss level (see djvulibre cjb2 tool description). |
| 44 | + |
| 45 | +**-slices_bg n1,n2,...** {74,89,89}. Use *n1,n2,...* as number of slices for c44 for background (see djvulibre c44 tool description). |
| 46 | + |
| 47 | +**-slices_fg n1,n2,...** {89} Use *n1,n2,...* as number of slices for c44 for foreground. |
| 48 | + |
| 49 | +**-levels n** {0} Level DjVuL block, 0 - auto. |
| 50 | + |
| 51 | +**-bgs n** {3} Background and Foreground downsample. |
| 52 | + |
| 53 | +**-fgs n** {2} Foreground more downsample. |
| 54 | + |
| 55 | +**-overlay n** {50} Block overlay DjVuL in percent. |
| 56 | + |
| 57 | +**-anisotropic n** {0} The main regulator DjVuL in percent. More than zero - more details, less than zero - less details. |
| 58 | + |
| 59 | +**-contrast n** {0} Auxiliary regulator DjVuL in percent (sharpen). |
| 60 | + |
| 61 | +**-fbs n** {100} and **-delta n** {0} Additional regulation DjVuL of BG/FG according to the linear law: FG * fgs + delta != BG |
| 62 | + |
| 63 | +**-black** Using black BG as the base, not white. |
| 64 | + |
| 65 | +You can use [Netpbm](https://sourceforge.net/projects/netpbm/) or any other similar tool to obtain `pgm` or `ppm` from other format. |
| 66 | + |
| 67 | +## DjVuL description. |
| 68 | + |
| 69 | +The [base of the algorithm](https://sourceforge.net/p/imthreshold/wiki/DjVuL/?version=3) was obtained in 2016 by studying the works [monday2000](http://djvu-soft.narod.ru/) and adapting them to Linux. |
| 70 | +The prerequisite was the [BookScanLib](http://djvu-soft.narod.ru/bookscanlib/) project and the algorithm [DjVu Thresholding Binarization](http://djvu-soft.narod.ru/bookscanlib/034.htm). |
| 71 | +This algorithm embodied good ideas, but had a recursive structure, was a "function with discontinuities" and had a hard color limit. |
| 72 | +The result of this algorithm, due to the indicated shortcomings and the absence of regulators, was doubtful. |
| 73 | +After careful study, all the foundations of the specified algorithm were rejected. |
| 74 | +The new algorithm is based on levels instead of recursion, a smooth weight function is used instead of a "discontinuous" one, no color restriction, BG/FG selection controls are enabled. |
| 75 | +The new algorithm allowed not only to obtain a much more adequate result, but also gave derivative functions: image division into BG/FG according to the existing mask. |
0 commit comments