Coder Social home page Coder Social logo

k-means-compressor's Introduction

Image Processing and Compression Library

Overview

This library aims to provide its users with basic image processing operations along with ways to compress the images. Currently the following operations are supported:

  1. RGB to Grayscale
  2. Horizontal and Vertical Flip

Support for more operations are welcome!

Image Compression

Image compression is done using the k-means algorithm, pixel values are grouped together to form bands of pixels, hence making it more compressable for JPEG and other methods of compression.

Results

How to set up

Note: You need to have GCC version > 10.2.0

  1. Clone the repo with git clone https://github.com/DebadityaPal/k-means-compressor
  2. Run the software with CLI commands The CLI commands are:

g++ compressor.cpp -o compressor

compressor <args>

Usage

The arguments are listed below

Usage:
Image Compression(-c):
-i: Path to the input image
-o: Path to the output image
-cl: (Optional, default: 64) Number of clusters used for compression 
-n: (Optional) Normalize the image before compression
-it: (Optional, default: 5) Number of epochs for k-means compression

Batch Compression (-b):
-i: Path to the input directory
-o: Path to the output directory
-f: Format for output images
-cl: (Optional, default: 64) Number of clusters used for compression 
-it: (Optional, default: 5) Number of epochs for k-means compression

Seam Carving (-s):
-i: Path to the input image
-o: Path to the output image
-p: (Optional, default: 1) Percentage of width to be retained    
   
Image editing (-e):
-g: Convert to grayscale
-h: Flip the image horizontally
-v: Flip the image vertically
-i: Path to the input image
-o: Path to the output image

k-means-compressor's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

k-means-compressor's Issues

[DOCUMENTATION] Improve Documentation

We would like to have a docstring for each function that explains the function in brief. Check out the various styles for C++ docstrings, contact maintainers to decide on which one to use.

[BUG] Parameter -p in seam carving works in opposite manner

Currently the Usage section of the cli states that the -p parameter in seam carving command is the percentage of width to be reatined but the program instead cuts that much percentage from the image.

Example:
./compressor -s -i input.png -o output.png -p 0.3 will cut 30% rather than retaining 30%.

[FEATURE] Add Unit Tests

We need unit tests to actively test correctness for new PRs.
A good package to write C++ unit tests is: Google Test
Feel free to take a look at the package and implement a unit test suite for the project.

[FEATURE] Extend support for C++ version < 17

Currently, we don't know the exact reason for this version dependency however, it might be related to the filesystems library in C++ being used by BatchCompressor.hpp
Please help us figure out the reason behind this and help us solve this dependency.
Backwards compatibility is a major issue.

[FEATURE] Cropping function

We need support for cropping of images, implementation should be simple enough as it would involve simply slicing the array.

[DOCUMENTATION] Fixing compilation syntax

The documentation contains -
gcc -std=C++17 compressor.cpp
for compiling the program, this however does not work due to linking issues and hence the documentation needs to be updated.

[FEATURE] Remove bits/stdc++.h

The bits/stdc++.h header file used is a nonstandard header file that might not work with non-GNU compilers like Clang. Hence, we should get rid of it.
Try to import the header dependencies individually and remove all instances of bits/stdc++.h

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.