image compression using jpeg

  1. does doing dct followed by quantization and idct decompress the image?
  2. does run length encoding(rle) help to compress?
  3. when we save a file as jpeg and open it does it perform both dct and idct or only dct?
  4. how can i check if my image is compressed since both the original and output image are 256x256?
  5. in order to write a program to perform jpeg compression and display the compressed image do i have to use zig zag scanning and rle?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 8 de Feb. de 2014

0 votos

1. No.
2. Often enough to be useful, but not always.
3. You have not specified what "it" is.
4. In that situation there is no compression.
5. No. If you use lossless jpeg then the algorithm does not use those steps.
Compression involves processing data and creating an output that takes less storage than the original data. Decompression involves taking that lower-storage version and expanding it back to something (close to) the original data. The step you have missed in several of your questions is the "creating an output that takes less storage than the original data". Calculating dct and quantizing it probably does not take less storage -- but you can then take the quantized data and output only parts of it. The less you output the more the compression but the less accurately you can reconstruct the original data.

13 comentarios

Image Analyst
Image Analyst el 8 de Feb. de 2014
Regarding 4, you can use dir() to check the file size on disk and see if it's less than the uncompressed version. Of course when it's read back in and decompressed it will be the same size.
jithin
jithin el 9 de Feb. de 2014
@ Walter Roberson:"but you can then take the quantized data and output only parts of it". hw do i do tht? hw is tht acomplished in jpeg?
jithin
jithin el 9 de Feb. de 2014
"3.when we save a file as jpeg and open it does it perform both dct and idct or only dct?" it refers to the file saved as jpeg.
Walter Roberson
Walter Roberson el 9 de Feb. de 2014
My understanding is that in JPEG, the major DCT coefficients occur first, and that as one goes on, additional DCT components add finer and finer detail. If one only outputs a limited number of DCT coefficients rather then the whole set, then one will be unable to recreate the fine detail, but less storage will be taken. On decompression, the missing DCT coefficients are filled in with zeroes. The processing method is such that humans usually have difficulty detecting the missing detail; however, sharp vertical lines such as for text often suffers visibly before other aspects would be noticeable. Humans are good at detecting problems with sharp vertical lines.
3. Compressing an image in JPEG lossy mode and saving it (e.g. to a file) involves dct but not idct. Decompressing a JPEG image (e.g. from a file) involves idct but not dct.
jithin
jithin el 10 de Feb. de 2014
so wil an image be compressed if i take its dct quantize it, and then take its idct ?
Walter Roberson
Walter Roberson el 10 de Feb. de 2014
No. The compression would not occur unless you discarded parts of the result of the dct. And even if you did that, filling in those missing components with 0 and taking the idct would result in something that was the original size, a slightly blurred version of the original.
jithin
jithin el 13 de Feb. de 2014
how do i discard the missing components after quantization with zeroes? could u please provide me the code for the same(to remove zeroes)?
Walter Roberson
Walter Roberson el 13 de Feb. de 2014
In real JPEG files, you would write the component values that you wanted to keep, followed by an End Of Block marker. As the total number of components per block is constant, the decompression knows how many zeros need to be filled in.
My recollection is that the component values are written out in a modified Huffman encoding; in that case, the End Of Block marker would be a symbol in the table that the software knew indicated something special instead of a numeric component value.
jithin
jithin el 17 de Feb. de 2014
sorry i could |you please explain how do encode it...how to place and detect EOB using matlab.. |
Walter Roberson
Walter Roberson el 17 de Feb. de 2014
Are you familiar with huffman encoding?
jithin
jithin el 17 de Feb. de 2014
not actually..How do i encode dct transformed , quantized and zigzag scanned coefficients using matlab?
jithin
jithin el 2 de Mzo. de 2014
i have done rle and used NaN to represent EOB. how can i do arithmetic encoding on the rle encoded sequence
jithin
jithin el 2 de Mzo. de 2014
i'd prefer to use the built in function for arithmetic encoding but i cant understand what the arguments must be. my input is rle encoded sequence.also how can i show that an image which is dct transformed, quantized, rle encoded ,arithmetic encoded sequence occupies less bandwidth as compared to the original image

Iniciar sesión para comentar.

Más respuestas (1)

jithin
jithin el 17 de Feb. de 2014

0 votos

i am working on Image Compression Using Intra prediction of H.264 using matlab.. 1.Is compression using intra prediction better than that(compression) using jpeg? 2.How can we prove that compression using H.264 is better than jpeg compression? 3.Could you please provide me the code for run length encoding?

3 comentarios

Walter Roberson
Walter Roberson el 17 de Feb. de 2014
H.264 is for motion. JPEG is for static images.
jithin
jithin el 17 de Feb. de 2014
i meant comparison between intraprediction and jpeg.. How can i prove that intraprediction produces better compression?
Deepak Mishra
Deepak Mishra el 8 de Sept. de 2022
i meant comparison between intraprediction and jpeg.. How can i prove that intraprediction produces better compression? and how can analysis filter cutoff frequency

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 8 de Feb. de 2014

Comentada:

el 8 de Sept. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by