GithubHelp home page GithubHelp logo

shaynali / voronoi-compression Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 54 KB

A lossy compression algorithm using Voronoi cells to encode information.

License: Other

Python 100.00%
compression compression-algorithm compression-implementations compression-schemes compression-library python python3 python-3

voronoi-compression's Introduction

Voronoi Compression

Uses Voronoi cells to compress and decompress an image.

Usage

compression.py [-h] -i IN_IMAGE -o OUT_IMAGE

arguments:
  -h, --help            show this help message and exit
  -i IN_IMAGE, --in-image IN_IMAGE
                        the filepath to read an image from, this image will be
                        compressed
  -o OUT_IMAGE, --out-image OUT_IMAGE
                        the filepath to write the compressed image to

voronoi-compression's People

Contributors

shaynali avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

voronoi-compression's Issues

Profile and optimize

This should be done before #7.

Profile the code and identify area of slowdown.

Speed up the slow areas and/or create follow up issues as needed.

Add graph serialization

Should maximize compression: store nodes once, make edges as compact as possible, etc.

Keep in mind that edges will be augmented with additional info in the future.

Compare to pickle and other serialization libraries and approaches.

Expose an API as needed and harden the existing API.

Rasterize based on intermediate colour values

Determine if each edge is a hard edge (drastic colour difference), or a soft edge (subtle colour difference). Then while rasterizing, for each pixel determine the closest set of softly-connected cells and colour the pixel based on a weighted average of the colours of these cells. The weight average should consider the weights of the cells and their proximity to the pixel.

For now, we can implement an n colour system in which we use the closest cell (already implemented) and search through it's soft edges for the next n-1 closest cells to the pixel, then colour the pixel based on a weight average.

Improve compression quality

Investigate ways to improve the compression quality.
Take a look at algorithms like H264, H265, and more.

Parallelize

Many components can be parallelized.

First, profile and inspect the code to find out which code would benefit the most from parallelization, then implement parallelism.

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.