Starting from:

$30

NCTU-IP - Image Processing  - Programming Assignment #3 -Solved

The objective of this assignment is for you to experiment with the various components of a JPEG codec. These components include:

        Block based DCT

        Quantization of DCT coefficients (with adjustable quality)

        Predictive coding (between the DC coefficients of adjacent blocks)

        Run-length coding of the AC coefficients

         Chromatic subsampling

        Huffman coding

 

There are many available examples on the Internet, even code samples. You are allowed to use or modify existing codes (give reference) for parts of your system, but you need to be able to modify them and do experiments with them.

 

Your implementation should include both an encoder and a decoder. Do NOT try to make them work with standard JPEG files. It is only required that your decoder can reconstruct an image compressed by your encoder.

 

You need to do experiments with the various components. Examples:

        Block based DCT: different transforms; different block sizes

        Quantization: simpler quantization, such as zonal coding; scaling factor to adjust quality

        Predictive coding: methods of doing prediction

         Chromatic subsampling: different levels of subsampling

        Huffman coding: standard codes or optimized (for the given image)

 

Try to evaluate your results both objectively (using SNR or RMSE) and subjectively (using examples, preferred with zoomed-in details).

 

 

 

The standard document is attached. Don't worry about the details. However, you can look for the quantization tables in Tables K.1 and K.2, and suggested Huffman codes in Tables. K.3 to K.6.

 

A little explanation of the Huffman code table (for AC components):

Each entry of the code table is specified by two values (Run/Size).

        Run: The number of consecutive zeros before the current coefficient.

        Size: The number of bits needed to code the current coefficient.

                (Size=1: can code coefficients being -1 or 1)

                (Size=2: can code coefficients being -3, -2, 2, or 3)

                (Size=3: can code coefficients being -7, -6, -5, -4, 4, 5, 6, 7)

                (…)

An example of how you can use the supplied tables to code one entry of RLC:              To be coded: A sequence of coefficients that are: 0 0 0 0 0 0 5         We need this entry from the code table (from Table K.5):

                (Run/Size)=6/3       code=1111111110100110

                The coefficient "5" is coded in 3 bits as 001

                                    (101 è remove the most significant bit (it's always 1) è add the sign bit 0 in front)    è overall code: 1111111110100110 001

                For negative coefficients: Just code the magnitude, and then set the sign bit to one.

Special cases:

            End-of-block: listed in the table as the entry (0/0)   Runs of zeros longer than 15:

                The entry (F/0) is used to code a run of 16 consecutive zeros (no extra bits needed).

For DC differences:

            The meaning of "Category" in Tables K.3 and K.4 are similar to the meaning of "Size" above.   Category 0 indicates that the difference is zero (no extra bits needed).

 

 

For block sizes other than 8, since there are no common quantization tables, you can choose to just experiment with zonal coding, or try to interpolate the 8x8 quantization tables to different sizes.


More products