Teoría de la Información Y
Métodos de Codificación
Image Compressor
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.
Code Used
Código
Make Test
We have the image:
Size 308 x 328
Aplied the Code
Image to gray scale:
Compress the image with threshold of 230.
Threshold 10
Threshold 159
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:
References
http://www.pybytes.com/pywavelets/ref/2d-dwt-and-idwt.html
Mala ortografía. Hubiera sido bueno medir los tiempos de ejecución. El reporte es además algo breve. 4 pts por el reporte.
ResponderEliminarEl método no es muy original; el simplemente llamadas a librerías y código ejemplo. Por mínimo tiene algo de comentarios... 6 pts por ello. Te veo en segundas.