Skip to content

Compression of an image by using variable block-size for vector quantization.

Notifications You must be signed in to change notification settings

droidadroit/variable-block-size-image-compression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Variable block-size image compression based on edge detection

I exploited the redundancy or uniformity present in an image to compress it. This novel method estimates the detail present in a block using Canny's edge detector. Each block is classified into edge and nonedge using a criterion. By merging consecutive nonedge blocks, the block size is varied.

Getting Started

Prerequisites

  1. Anaconda for Python 2.7
  2. OpenCV for Python 2.7

Installing

  1. Anaconda for Python 2.7
    Go to the downloads page of Anaconda and select the installer for Python 2.7. Once downloaded, installing it should be a straightforward process. Anaconda has along with it most of the packages we need.

  2. OpenCV for Python 2.7
    This page explains it quite well.

Running

Before running vbs.py, there are a few parameters to be set.

image_location
bits_per_codevector
block_width
block_height
mu
threshold_1
threshold_2

image_location is set to the relative location of the image from the current directory.
bits_per_codevector is set based on the size of the codebook you desire. For e.g., for a 256-vector codebook, this value should be 8 as 2^8 = 256.
block_width and block_height are set to the size of the blocks the image is divided into. Make sure the blocks cover the the entire image.
mu is the coefficient used in the block-classifying criteria.
threshold_1 and threshold_2 are the parameters used by Canny edge detector.
perturbation_vector can be changed manually.

Once the parameters are set, enter the following command to run the script.
python [name of the script] [image_location] [bits_per_codevector] [block_width] [block_height] [mu] [threshold_1] [threshold_2]

Please go through the research paper for an understanding of the above terms.

About

Compression of an image by using variable block-size for vector quantization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages