Teoría de la Información Y
Métodos de Codificación
The process effected was as follows:
- Get an image .jpg what is asked the user.
- Convert this image a gray scale.
- It loads in an array one of variables rgb (As in each rgb the elements are equal, you take only one).
- Decomposes the array using the library wavedec2 of pywt, the result gives us three variables, the first 2 are used only to rebuild the array. The last is applied one process (this is the coefficient variable).
- Make new array of coefficient using the variable coefficient, sweep every element of the array and compares with the threshol, if data success the condition the value of the array is 0. All data (success the condition or not) save in the array.
- Add in the new list the 2 variable and the array and aplied the method waverec2 and get one array, this array can change to integer for continue. This array is used to create the new image.
- Sweep the array get every pixel of the image with your rgb (every element x 3) and create the new image.
- Compare the weight of the image in gray scale with the compress for obtain the compress percentage.
We have the image:
Size 308 x 328
Aplied the Code
Image to gray scale:
Compress the image with threshold of 230.
As see in the images, while the threshold is high the quality of the image decreases so the compression become greater.
This can be rectify in the picture of below, which shows the result of the execution: