Coder Social home page Coder Social logo

image-vectorization's Introduction

Image Vectorization

This repository provides a program based on Python to vectorize images. Therefore, it allows to process a given image to discretize its colors, use them to segment the image, generate vector shape layers and render them together to obtained an stylized copy of higher resolution.

Dependecies

Usage

main.py [-h] [--input INPUT] [--output OUTPUT] [--dpi DPI] [--palette-size PALETTE_SIZE] [--cell-size CELL_SIZE]
        [--grid-size GRID_SIZE] [--palette-warmup-steps PALETTE_WARMUP_STEPS]
        [--palette-refinement-steps PALETTE_REFINEMENT_STEPS] [--flattening-steps FLATTENING_STEPS]
        [--mask-denoising-steps MASK_DENOISING_STEPS] [--render-denoising-steps RENDER_DENOISING_STEPS]
        [--use-antialiasing] [--verbose VERBOSE] [--save-grid SAVE_GRID] [--save-palette SAVE_PALETTE]
        [--save-palette-weights SAVE_PALETTE_WEIGHTS] [--save-flat-image SAVE_FLAT_IMAGE] [--save-mask SAVE_MASK]
        [--save-layers SAVE_LAYERS] [--flat-image FLAT_IMAGE] [--palette PALETTE]
        [--palette-variety-weight PALETTE_VARIETY_WEIGHT] [--palette-coherence-weight PALETTE_COHERENCE_WEIGHT]
        [--potrace-path POTRACE_PATH] [--config CONFIG]

arguments:
  -h, --help                        Show this help message.
  --input INPUT                     Input image file (default: None).
  --output OUTPUT                   Filename for the the resulting image (default: None).
  --dpi DPI                         Level of detail used for rendering (default: 150).
  --palette-size PS                 Maximum number of colors used for the resulting image (default: 16).
  --cell-size CS                    Cell resolution used in the warm-up (default: 32x32).
  --grid-size GS                    Grid used in the warm-up (default: None).
  --palette-warmup-steps PWS        Number of steps used in the warm-up of the palette estimation (default: 501).
  --palette-refinement-steps PRS    Number of steps used in the palette estimation (default: 1001).
  --flattening-steps FS             Number of steps used in the estimation of an intermidiate flat image closer 
                                    to the palette (default: 0).
  --mask-denoising-steps MDS        Number of steps used for denoising the mask (default: 5).
  --render-denoising-steps RDS      Number of steps used for denoising the final image (default: 3).
  --use-antialiasing                Use antialiasing for the final image (default: False).
  --verbose VERBOSE                 Frequency of information updates given by the tool provided as
                                    "general_messages:palette_iterations:flattening_iterations" (default: 1:0:0).
  --save-grid SAVE_GRID             Saves the computed grid in the specified filename (default: None).
  --save-palette SAVE_PALETTE       Saves the computed palette in the specified filename (default: None). If a png,
                                    jpg or bmp filename is provided, the palette is stored as an image. Otherwise, 
                                    the palette is stored as a text file with UInt8-based color values by default.
                                    Values can be stored as floats by providing the filename followed by ":f".
  --save-palette-weights SPW        Saves the computed weights in the specified filename (default: None).
  --save-flat-image SFI             Saves the computed intermediate image in the specified filename (default: None).
  --save-mask SAVE_MASK             Saves the computed segmentation mask in the specified filename (default: None).
  --save-layers SAVE_LAYERS         Saves the computed vector layers in the specified folder (default: None).
  --flat-image FLAT_IMAGE           Load the flat image from a file (default: None).
  --palette PALETTE                 Load the palette from a file (default: None).
  --palette-variety-weight PVW      Use a custom weight for the palette variety loss (default: 1.0).
  --palette-coherence-weight PCW    Use a custom weight for the palette coherence loss (default: 1.0).
  --potrace-path POTRACE_PATH       Path to the local potrace installation (default: potrace).
  --config CONFIG                   Configuration file defining the arguments for the system (default: None).

Usage example: python main.py --input=data/zelda.jpg --output=zelda_hd/result.png --dpi=320 --palette-size=32 --cell-size=96x96 --save-palette=out/zelda_palette.txt:f

image-vectorization's People

Contributors

joancoco avatar

Stargazers

Oleksandr Kurylo avatar Võ Thành Hoàng Sơn avatar

Watchers

 avatar

Forkers

sowwnn

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.