Git Product home page Git Product logo

stb-image-djvul's Introduction

stb-image-djvul

DjVu Layered - image bundle on the mask + foreground + background using "Multi-scale binarization".

Degradation of images on layers mask, foreground and background by cluster analysis with a gradual decrease in block size.

In addition to DjVuL, several more threshold methods are supported: BiMod, Sauvola, Blur threshold.

build

load submodules

submodules:

$ git submodule init
$ git submodule update

install dependencies

build dependencies:

  • build-essential
  • cmake
$ sudo apt-get install build-essential cmake

compilation

$ mkdir build
$ cd build
$ cmake ..
$ make

use

The first parameter specifies the path to the image. The second parameter is the resulting BW mask. [optional: The third parameter is the background. The fourth parameter is foreground.]

./stbdjvul [options] image_in bw_mask_out.png [bg_out.png] [fg_out.png] [bgmask_out.png] [fgmask_out.png]

structure

  • dependencies.c - API stb
  • djvul.h - DjVuL algoritm
  • stb/ - stb
  • stbdjvul.c - CLI program.

DjVu Layered

lena

./stbdjvul lena.png lena.mask.png lena.bg.png lena.fg.png
Load: lena.png
image: 256x256:3
BG: 86x86:3
FG: 43x43:3
DjVuL... 7 level
Save png: lena.mask.png, lena.bg.png, lena.fg.png.

Mask Bg Fg

./stbdjvul -c 1 lena.png lena.mask.c1.png lena.bg.c1.png lena.fg.c1.png 
Load: lena.png
image: 256x256:3
BG: 86x86:3
FG: 43x43:3
DjVuL... 7 level
Save png: lena.mask.c1.png, lena.bg.c1.png, lena.fg.c1.png.

Mask Bg Fg

DjVu Layered ground

This utility includes a mode for splitting an image into a BG and a FG based on an existing mask (ground). The mask can be corrected.

./stbdjvul -m 1 -r lena.png lena.mask.png lena.bg.g.png lena.fg.g.png 
Load: lena.png
image: 256x256:3
Load: lena.mask.png
mask: 256x256:3
BG: 86x86:3
FG: 43x43:3
DjVuL ground... 7 level
Save png: lena.mask.png, lena.bg.g.png, lena.fg.g.png.

Mask -rewrite-> Mask Bg Fg

DjVu Layered reconstruct

This utility includes a mode for reconstruct an image on an existing mask, BG and FG (reconstruct).

./stbdjvul -m 2 lena.r.png lena.mask.png lena.bg.png lena.fg.png 
Load: lena.mask.png
mask: 256x256:3
Load: lena.bg.png
BG: 86x86:3
Load: lena.fg.png
FG: 43x43:3
DjVuL reconstruct... 2 level
Save png: lena.r.png.

Rec


See demo of stbDjVuL.


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

stb-image-djvul's People

Contributors

plzombie avatar zvezdochiot avatar

Watchers

 avatar  avatar

stb-image-djvul's Issues

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.