DCT image compression

28
DSP project - idea presentation 22.10.2015

Transcript of DCT image compression

PowerPoint Presentation

DSP project - idea presentation 22.10.2015

Intro

With the advance of technology in recent years, it has been noticed that more than 50% of the network traffic is consumed with videos and images. This percentage is estimated to increase further to around 90% in the coming few years. Besides the required quality of these videos and images is increasing as the popularity for high definition (HD) grows. Thus technology demands a better coding standard with higher compression efficiency.

Ever-increasing download speeds, file sharing and the growing adoption of high quality online video are expected to lead to a surge of global IP traffic in the next few years.Cisco expects global traffic to almost quadruple between 2011 and 2016.

After file sharing had been the main contributor to global traffic for many years, online video is now the biggest data hog. In 2012, video (excluding video communication) is expected to account for 54 percent of global IP traffic. Web browsing and email only make up 13 percent of traffic, while voice over IP services and online gaming add less than one percent to the total.

1

JPEG Image Coding DSP project - 24.12.2015

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

2

DSP project - 24.12.2015Team members1.Ibrahim Mahmoud Shoeer[14]2.Ahmed Mohamed Nageeb[34]3.Hossam Hassan Ramadan[88]4.Sally Tarek Behairy[125]5.Nada Moh. El-Attar[243]6.Nashwa Ahmed ElKarargy[247]

7.Noha Magdy Nasr[252]8.Youssef Mohamed Ramzy[281]

Team members

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

3

DSP project - 24.12.2015Why the selected project idea is important?digital images require much storage space

compressed data takes up less storage space

[Why the selected project idea is important]

Data compression .. Why?

The rise in digital technology has also rose the use of digital images. The digital images require much storage space. The compression techniques are used to compress the data so that it takes up less storage space.

Data compressionis a process by which the file size is reduced by re-encodingthe file data to use fewer bits of storage than the original file. The original file can then be recreated from the compressed representation using a reverse process called decompression.

Image compression has become very important with the increasing use of images. These images need to be compressed according to the purpose of application. The aim here is to store the image in less space, minimizing the file size.

There are several different algorithms and implementations that allow you to compress your files, some of which perform better than others for certain kinds of file types. Image compression can be either lossy or lossless.

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

4

DSP project - 24.12.2015Data compressionis a process by which the file size is reduced by re-encodingthe file data to use fewer bits of storage than the original file.

The original file can then be recreated from the compressed representation using a reverse process called decompression.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

5

DSP project - 24.12.2015Lossy vs. lossless compressionLOSSLESS COMPRESSIONLOSSY COMPRESSIONEnables recreation of the original file bit for bit

no data loss

keeps all information, discarding no information.

Ex. Representing recurring patterns with shorter abbreviations discards some information accepts some degradation in the image, as lower resolution

This decreasing resolution is not detected by the eye.

a certain amount of loss in quality

Difference between lossy and lossless compression:

Lossless compressionLossless compressions ensure that you can recreate the original file bit for bit in its entirety, which means there is no data loss during the compression and decompression. It keeps all information driven from the original image, discarding no information. Instead it finds algorithms to represent the same information and accuracy in less space. Lossless algorithms could, for example, represent recurring patterns with shorter abbreviations. This type of compression is usually a must if you are compressing text files, data files or certain proprietaryformats.

Lossy compressionOn the other hand lossy algorithms discard some information accepting some degradation in the image, as lower resolution of the image, so it can store it in a compact format. This decreasing resolution is not detected by the eye. This type of compression is done mainly on media files such as image, audio and video files. Depending on the usageof the files, a certain amount of loss in quality might be acceptable to save space and resources. More often than not the loss in quality is usually not detectable for all practical purposes.

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

6

DSP project - 24.12.2015The Discrete Cosine Transform (DCT)the human eye is most sensitive to low frequencies. the image is divided into parts (according to frequencies) important lower frequencies are kept higher ones are discardedIt is a lossy algorithm

The Discrete Cosine Transform (DCT) makes use of the information that the human eye is most sensitive to low frequencies. This means that parts with high frequencies can be discarded in representation. The DCT divides the image into parts separating them according to frequencies. It keeps the parts with the important lower frequencies and discards the higher ones. Thats why DCT image compression is considered a lossy algorithm, because it loses some of the original information.

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

7

The Discrete Cosine Transform (DCT)DSP project - idea presentation 22.10.2015

These cosines represent an image which varies from high intensity to low to high again 8

The Discrete Cosine Transform (DCT)

DSP project - idea presentation 22.10.2015

If we combine these two images with each other . As a result we get another get another one. We represent images by a combination of cosine transforms. As we increase the number of inputs we can increase the number of possible shapes for output. 9

The Discrete Cosine Transform (DCT)

DSP project - idea presentation 22.10.2015

If we combine more than one we get a lot of images. 8 by 8 basic images. Ex. The first one is flat, then the frequency increases, both horizontally and vertically. At the bottom-right side, we have the highest frequencies. Weighted by the coefficient to indicate how much it contributes to the image. The lower frequencies have a bigger contribution than the higher frequencies. 10

Example

DSP project - idea presentation 22.10.2015

11

Example DSP project - idea presentation 22.10.2015

Example

DSP project - idea presentation 22.10.2015

Which bits of cosine do we need to make up an image like this?13

Example

DSP project - idea presentation 22.10.2015

DSP project - 24.12.2015Mechanism

Mechanism[Block diagram]

1. The image is divided into smaller 88 blocks of pixels. 2. The DCT is applied to each block working from left to right; top to bottom.3. Each block is compressed through quantization. 4. The array of compressed blocks that constitute the image is stored in drastically reduced amount of space. 5. When needed the image can be reconstructed through decompression, where we use the Inverse Discrete Cosine Transform (IDCT).

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

15

prompt = {'Enter the exact name of the image file. Example:name.jpg'};title = 'Image';answer = inputdlg (prompt, title);k = answer{1};A=imread(k); B= rgb2gray(A); DSP project - 24.12.2015The user is asked to upload the desired image that needs compression. The image should be stored in the same place as the Matlab code. This is then converted into a grayscale image i.e. black-and-white image.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

16

C=B-128; subplot(311)imshow(B)DSP project - 24.12.2015In grayscale, images range between values 0 and 255, where 0 is pure black and 255 is pure white. However DCT is designed to work on ranges between -128 and 12.Thus we subtract 128. This is when we show the original image using the command imshow.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

17

DSP project - 24.12.2015Original file size: 7 kbytes

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

18

DSP project - 24.12.2015There is a variety of levels for the image compression and image quality. As the level of compression increases, the level of quality would decrease, and vice versa. These levels span from 0 to 100.Subjective experiments yielded the following matrix Q with quality level 50 as a standard quantization matrix.

100 represents the best quality and lowest compression level and 0 would result in the highest compression level and thus the lowest quality for the image.

The quantization table represents the phase when we discard the frequencies.

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

19

DSP project - 24.12.2015The level of quality varies. The program therefore lets the user choose his preferred level of quality, a parameter to control the quality of the image and it compression, ranging from 0 to 100. The entered value of quality alters the standard matrix accordingly.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

20

DSP project - 24.12.2015The Discrete Cosine Transform (DCT), which has the following equation:

N represents the size of divided blocks x and y are the number of rows and columns. It is common to divide the image into 8 by 8 blocks. This generates the following equation with N= 8:

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

21

DSP project - 24.12.2015This results in the following matrix T:

We use the matrix T to perform the DCT on our desired image blocks. This is done through multiplication with the original block matrix M in the following manner:

The original block M is multiplied first with the DCT matrix T to transform the rows and then with the transpose of the DCT matrix to transform the columns.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

22

DSP project - 24.12.2015Quantization is then performed by dividing each element of the transformed image matrix D by its corresponding element in the quantization matrix Q that we explained previously. This is then rounded to get positive integer values.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

23

DSP project - 24.12.2015As a result we have the lower frequencies in the upper-left corner, while the higher frequencies are represented with zeros, which can be discarded.

Thats because the human eye is most sensitive to lower frequencies, and wont detect the averaging of the higher ones with more rapid variations. Remember that the goal of data compression is to represent the data in a way that reveals some redundancy.

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

24

DSP project - 24.12.2015As we discard part of the original data of the image, this type of compression is considered a lossy compression. Only the non-zero coeefficients are used to reconstruct the image.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

25

DSP project - 24.12.2015As a last step the compressed file is decompressed again to retrieve the original image. The reconstruction of the image is done by reversing all previous steps of compression: We divide the image again into 88 blocks and multiplying this time by the quantization matrix Q.IDCT is then applied to the resulting matrix to reverse the discrete cosine transform performed before and rounded again. The blocks are gathered into one matrix again and 128 are added to construct the decompressed format of the image.

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

26

DSP project - 24.12.2015By comparing the original file to the decompressed version:Original file size: 7 kbytesDecompressed file (at 70%) size: 4 kbytes

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

27

DSP project - 24.12.2015References

[1] The Statistics Portal website [online] link: http://www.statista.com/chart/624/global-ip-traffic-per-month-from-2011-to-2016/[2] Cisco website [online] link: http://www.cisco.com/c/en/us/solutions/collateral/service-provider/visual-networking-index-vni/VNI_Hyperconnectivity_WP.html[3] Lost saloon website [online] link: http://www.lostsaloon.com/technology/what-is-data-compression-and-why-use-it/[4] Prof. Dr.-Ing. Thomas Wiegand website [online] link: http://iphome.hhi.de/wiegand/assets/pdfs/DIC_JPEG_07.pdf

[Project title]

Joint Photographic Experts Group (JPEG) is one of the most well-known image compression standards. It achieves great compression rate with respect to other lossy image compression standards by making use of the human eye limitations. Lossy algorithms discard some information accepting some degradation in the image, as lower resolution. This decreasing resolution is not detected by the human eye.

28