Git Product home page Git Product logo

image-compression-via-dct's Introduction

Image-compression-via-DCT

The purpose of this project is to use the DCT2 (Discrete Cosine Transform) implementation in an environment open source and to study the effects of jpeg-like compression (without using a quantization matrix) on grayscale images.

First part

Implement DCT2 as explained in class in an open source environment of your choice and compare the execution times with the DCT2 obtained using the environment library used, which is assumed to be in the fast version (FFT).

In particular, obtain square arrays N N with increasing N and represent on a graph on a semilogarithmic scale (only the ordinates) as N varies the time taken ad run DCT2 with your homemade algorithm and library algorithm.

The times should have been proportional to N3 for the homemade DCT2 and to N2 for the version fast (more precisely to N2 log (N)). The times obtained with the fast version could have an irregular trend due to the type of algorithm used.

Second part

Write software that performs the following tasks:

  • Create a simple interface so that the user can choose from the lesystem a .bmp image in shades of gray;
  • Allow the user to choose:
    • an integer F which will be the width of the window in which DCT2 is executed;
    • an integer d between 0 and (2F-2) which will be the cutoff threshold of the frequencies.
  • divide the image into square blocks f of pixels of size FxF starting top left, discarding leftovers;
  • for each block f carry out the following operations:
    • apply DCT2 (from the library): c = DCT2 (f);
    • delete frequencies c_kl with k + l >= d (I am assuming that frequencies start from 0: if d = 0 I delete them all, if d = (2F-2) I delete only the most high, i.e. the one with k = F-1, l = F-1).
    • apply the inverse DCT2 to array c as modified: ff = IDCT2 (c);
    • round ff to the nearest integer, set negative values to zero and 255 those greater than 255 in order to have admissible values (1 byte);
  • recompose the image by putting the ff blocks together in the right order.
  • display on the screen side by side: the original image and the image obtained after modifying the frequencies in the blocks.

image-compression-via-dct's People

Contributors

davidepietrasanta avatar davidemammarella avatar andreapremate avatar

Stargazers

gavin-Huang avatar  avatar

Watchers

 avatar  avatar

image-compression-via-dct's Issues

Time Analysis

Obtain square arrays NxN with increasing N and represent on a
graph on a semilogarithmic scale (only the ordinates) as N varies the time taken ad
run DCT2 with your homemade algorithm and library algorithm.

The times should have been proportional to N^3 for the homemade DCT2 and to N^2 for the version
fast (more precisely to N^2 * log (N)). The times obtained with the fast version could have
an irregular trend due to the type of algorithm used.

Second part

Second part

Write software that performs the following tasks:

  • Create a simple interface so that the user can choose from the lesystem
    a .bmp image in shades of gray;

Allow the user to choose:

  • an integer F which will be the width of the window in which DCT2 is executed;
  • an integer d between 0 and (2F-2) which will be the cutoff threshold of the frequencies.
  • divide the image into square blocks f of pixels of size FxF starting
    top left, discarding leftovers;

For each block f carry out the following operations:

  • apply DCT2 (from the library): c = DCT2 (f);
  • delete frequencies c_kl with k + l >= d (I am assuming that frequencies start from 0: if d = 0 I delete them all, if d = (2F-2) I delete only the most high, i.e. the one with k = F-1, l = F-1).
  • apply the inverse DCT2 to array c as modified: ff = IDCT2 (c);
  • round ff to the nearest integer, set negative values to zero and 255 those greater than 255 in order to have admissible values (1 byte);
  • recompose the image by putting the ff blocks together in the right order.
  • display on the screen side by side: the original image and the image obtained
    after modifying the frequencies in the blocks.

Reappeared Block into matrix

Missing to recompose the matrices.
For practical and delivery reasons I divided the MxN matrix into many blocks of FxF size, now the problem is to create a function that recomposes the matrix to be MxN (starting from the list of blocks).
The list of blocks is just a list of matrix. The block were created from left high.

User Interface

Create a simple interface so that the user can choose from the file system a .bmp image in shades of gray.

Allow the user to choose:

  • an integer F which will be the width of the window in which DCT2 is executed;
  • an integer d between 0 and (2F - 2) which will be the cutoff threshold of the frequencies.

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.