1 / 24

JPEG

JPEG. Compresses real images Standard set by the Joint Photographic Experts Group in 1991. Stages of JPEG. We will consider (monochrome) black and white. Images. Colour images are treated similarly, but the colour information is extracted and processed separately using a reduced sample set.

dane-hodges
Download Presentation

JPEG

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JPEG • Compresses real images • Standard set by the Joint Photographic Experts Group in 1991

  2. Stages of JPEG • We will consider (monochrome) black and white. Images. • Colour images are treated similarly, but the colour information is extracted and processed separately using a reduced sample set. • The whole image is divided into 8 x 8 blocks.

  3. Stages of JPEG • Transform each 8 x 8 block into an 8 x 8 Discrete cosine transform. • Quantise DCT co-efficients (values) giving finer quantisation to certain values. • Run length code zero values. • Apply Huffman coding to the run length coded sequence.

  4. Take 8x8 blocks and produce 2 dimensional (8 x 8) DCT The image is split up into 8 x 8 pixel blocks giving 64 values. The following (scary) formula is applied. Which gives an 8 x 8 DCT block.

  5. The 2 dimensional (8 x 8) DCT • However, as before, all the equation does, is calculate what amount of certain cosine patterns make up the 8 x 8 pixel block. • This time the patterns are in two dimensions and are shown in a following slide.

  6. The 2 dimensional (8 x 8) DCT • They are called basis functions or pictures, because they form the basis (building blocks) of any image. That is any picture can be completely reconstructed from a combination of these patterns.

  7. The 2 dimensional (8 x 8) DCT • Each co-efficient (value) in the DCT represents a spatial frequency in the image. • That is how many times it goes from light to dark (or from dark to light) in the block.

  8. The 2 dimensional (8 x 8) DCT • The block can be see to be separated into horizontal and vertical spatial frequencies. • The value in the upper left corner represents zero frequency, dc or the average pixel brightness in the original 8x8 block.

  9. The 2 dimensional (8 x 8) DCT • It is processed separately to the other (called ac co-efficients) and is not subject to the lossy compression process which follows.

  10. DCT basis functions (Basis pictures).

  11. Why DCT? • We have produced this complex transformation, but it still contains 8 X 8 or 64 values.

  12. Why DCT? • However, while any the original 8 x 8 pixel values could take on any value between 0 – 255, it turns out that for most images, that the DCT values are high and significant towards the top left hand corner and low (and less significant) towards the lower right hand corner of the block. • We use this statistical information to our advantage.

  13. Typical DCT co-efficients.

  14. Re-quantisation • The eye is less sensitive to high frequency noise (error). • We can afford to code the high frequencies less accurately. • We use larger quantisation steps. • Since the high frequency values are usually small anyway, large quantisation steps reduce these values to zero. • That is they are not counted in the coded representation and we have achieved (lossy) compression.

  15. Re-quantisation • To re- quantise to larger steps we divide the actual value by a values larger than 1 and round the result. • The following table shows a typical set of 8x8 quantisation values which we divide the dct values by to achieve re-quantisation. • Note that the lower values in this case receive no re-quantisation. • Compression may be increased by increasing the re-quantisation values.

  16. Typical re-quantisation values

  17. DCT coefficients after re-quantisation

  18. The effect of loosing the high frequency co-efficients completely • Matlab program metdct1.m • Syntax • Metdct(‘image.bmp’, mask) • ‘image’ is an image to be compressed. • Mask is an 8x8 matrix 1’s and 0’s which determines which co-efficients are used and not used (unlike quantising which allows higher co-efficients to play a limited part)..

  19. The effect of loosing the high frequency co-efficients completely • Use zeros(8, 8), ones(8,8) • Ones(8, 8) gives no deterioration (and no compression) • Observe the result of using the dc component only. • Experiment by adding ones to the mask to see the minimum number of co-efficients required to give a reasonable compressed image. • Estimate the degree of compression.

  20. Zig-Zag scan • The dc component and the re-quantised coefficients are placed in a string using a zig-zag scan. • This cunning stunt leaves long runs of zeroes.

  21. Zig-zag scan

  22. Run-length encoding • The string of co-efficients has many zeroes at the end • 168, 45, 67, 12, 32, 7, 3, 3, 5, 3, 1, 1, 5, 3, 2, 0, 1, 3, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 • Long runs of zeros can be run-length coded. • However, a special (single) code is allocated to a run of 15 zeros and another end of block (EOB) code is used if there are no more non-zero values in the block..

  23. Variable length coding • As we approach the end of the the zig-zag scan, it is more likely that any non-zero value will have a run of zeros before it. Also the non-zero value is more likely to have a low value than a high one, particularly if the run of zeroes is large. • These combinations of the non-zero value and the preceding run of zeros can therefore be Huffman coded.

  24. Further reading www.snellwilcox..com/reference/pdfs/ecomp.pdf Art of Digital Video, Watkinson, Focal Press Digital image processing, Gonzalez and Woods, Prentice Hall

More Related