hs2361 / k-means-compressor

k means clustering based image compression algorithm project for OOPL
6 stars 8 forks source link

Added python implementation #15

Closed SamarthGarg09 closed 3 years ago

SamarthGarg09 commented 3 years ago

This is the python implementation of the project. Implementation of various image processing functionalities like Image compression, seam carving, conversion of image from RGB to grayscale and horizontal and vertical flipping of images are provided. Most of these functionalities are coded from scratch. It also consist of K-means compressor algorithm from scratch as well as using scikit-learn library. All the libraries required for the projects are mentioned in the req_lib.txt file.

Original Image

The Persistence of Memory By Salvador Dali

salvador_dali

Compressed Image

compressed_image

Horizontal as well as vertically seamed image

with horizontal and vertical scale ratio of 0.5 each

Horizontal_and_vertiaclly_seamed

vertical seamed image

with vertical scale ratio of 0.5

vertical_seam_carving

Horizontally seamed image

with horizontal scale ratio of 0.5

horizontal_seam_carving

Horizontally flipped image

horizontally_flipped

Vertically flipped Image

vertically_flipped

Grayscale Image

RGB_to_grayscale

DebadityaPal commented 3 years ago

Hi @SamarthGarg09 , I went through the changes, unfortunately a lot needs to be changed more. I have enumerated the points as follows. Alternatively @hs2361 suggests, you create issues for individual python ports of the functions, that way the task becomes easier and you get more PRs.

  1. Add the image files to gitignore, we don't usually push images into the GitHub repo since they are bulky.
  2. Add a CLI for Python so that users can run the code.
  3. Rename the parent folders to cpp and python from cpp_implementation and python_implementation
  4. Rename the files. Remove _impl from python files, make the names standard, Look at the C++ file names for reference.
  5. Rename req_lib.txt to requirements.txt
  6. Use a Linter like black to format your code.
  7. Follow Naming conventions and keep your function names standardized.
  8. Do not use single-character variable names, the variable names should be expressive.
SamarthGarg09 commented 3 years ago

Hi @DebadityaPal sir, I have made all the changes which you have pointed out except for adding a python based CLI. Please review it and let me know if it requires any further changes and improvements.

DebadityaPal commented 3 years ago

LGTM, thanks for the PR!