Git Product home page Git Product logo

mfbdjvu's Introduction

MFBdjvu

MFBdjvu is a simple project for easy converting pgm and ppm to (MASK+FG+BG)-djvu. It uses djvulibre for all technichal work and compression. The breakdown of the image into components is done using DjVuL and DjVuL wiki.

MFBdjvu based of simpledjvu.

See MFBdjvu demo

Install

load submodules

submodules:

$ git submodule init
$ git submodule update

build

Type:

$ make

If you want, you can change your PATH variable or copy mfbdjvu binary to any directory already included in your PATH.

You need g++ version supports c++0x standard flag.

Usage

mfbdjvu [options] input.pnm output.djvu

where options =

-mask mask.pbm {NULL} exist mask file.

-dpi n {300} DPI output djvu.

-loss n {1} Use n as cjb2 loss level (see djvulibre cjb2 tool description).

-quality n {75} Use n as parameter {0 - Inf} for generate slices, see down.

-slices_bg n1,n2,... {74,84,88,97}. Use n1,n2,... as number of slices for c44 for background (see djvulibre c44 tool description) {== -quality 75}.

-slices_fg n1,n2,... {100} Use n1,n2,... as number of slices for c44 for foreground {== -quality 75}.

-threshold str {djvul} threshold: djvul, bimod, sauvola, blur, edgeplus

-levels n {0} Level DjVuL block, 0 - auto.

-bgs n {3} Background and Foreground downsample.

-fgs n {2} Foreground more downsample.

-overlay n {50} Block overlay DjVuL in percent.

-anisotropic n {0} The main regulator DjVuL in percent. More than zero - more details, less than zero - less details.

-contrast n {0} Auxiliary regulator DjVuL in percent (sharpen).

-fbs n {100} and -delta n {0} Additional regulation DjVuL of BG/FG according to the linear law: FG * fbs + delta != BG

-sensitivity n {20} Sensitivity regulation for Sauvola and Blur threshold

-black Using black BG as the base, not white.

You can use Netpbm or any other similar tool to obtain pgm or ppm from other format.

DjVuL description.

The base of the algorithm was obtained in 2016 by studying the works monday2000 and adapting them to Linux. The prerequisite was the BookScanLib project and the algorithm DjVu Thresholding Binarization. This algorithm embodied good ideas, but had a recursive structure, was a "function with discontinuities" and had a hard color limit. The result of this algorithm, due to the indicated shortcomings and the absence of regulators, was doubtful. After careful study, all the foundations of the specified algorithm were rejected. 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. 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.

Links

mfbdjvu's People

Contributors

plzombie avatar zvezdochiot avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

mfbdjvu's Issues

model quality?

Hi @plzombie .

New model BG/FG quality.

Old [0,100] {default = 75}:

mfbdjvu/src/mfbdjvu.cpp

Lines 155 to 163 in fb7f456

n = (n < 0) ? 0 : (n < 100) ? n : 100;
keys->quality = sqrt(n) * 0.1f;
vector<int> nf, nb;
nb.push_back((int)(keys->quality * 100.5f) + 5);
nb.push_back((int)(keys->quality * 110.5f) + 5);
nb.push_back((int)(keys->quality * 125.5f) + 5);
keys->slices_bg = nb;
nf.push_back((int)(keys->quality * 125.5f) + 5);
keys->slices_fg = nf;

New [0,Inf] {default = 100};

                n = (n < 0) ? 0 : n;
                keys->quality = sqrt(n) * 0.1f;
                vector<int> nf, nb;
                nb.push_back((int)(keys->quality * 76.0f + 0.5f) + 5);
                nb.push_back((int)(keys->quality * 84.0f + 0.5f) + 5);
                nb.push_back((int)(keys->quality * 95.0f + 0.5f) + 5);
                keys->slices_bg = nb;
                nf.push_back((int)(keys->quality * 95.0f + 0.5f) + 5);
                keys->slices_fg = nf;

โš ๏ธ Both models are non-linear (sqrt)!

PS: I don't like the upper limit of the old model.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.