Skip to content

Vector quantization compression for images using k-means clustering algorithm.

License

Notifications You must be signed in to change notification settings

pppiyo/Vector_Quantization_Compression

Repository files navigation

Vector Quantization Image Compression

About

Java implementation of vector quantization compression method for images, using k-means clustering algorithm.

How to run

  1. Put VectorCompression.java file as well as the one-channel rgb image (e.g. "image1-onechannel.rgb") under the same folder.

  2. In terminal, run command:

javac VectorCompression.java
java VectorCompression <IMAGE> <SIZE> <NUMBER>

IMAGE : The one-channel rgb image file name.
SIZE : Any integer. Size of a vector you pick, a.k.a number of adjacent pixels side by side as a vector unit.
NUMBER : Any integer. Number of vectors of your choice. Making it a power of 2 can maximize usage of available indexes.

Expected outcomes

After running the program, original image and compressed version will be juxtaposed in a pop-up window as show below:

SIZE = 2, NUMBER = 16 image

SIZE = 3, NUMBER = 16 image

SIZE = 3, NUMBER = 30 image

SIZE = 7, NUMBER = 30 image

As an observation, compressed image will be more refined with the increase of NUMBER and the decrease of SIZE.

Idiosyncrasies

  1. This program supports one-channel rgb image file comepression only.
  2. Size of image is limited to 352 x 288.

Releases

No releases published

Packages

No packages published

Languages