Homework Assignment #1

  1. [30 pts] Generate an image format converter which reads raw images (e.g., PPM format) and writes them as BMP format. The generated BMP file has to be readable by general image viewer.

    Image Files:
    Foremat
    RGB24
    Grayscale
    Black & White
    Graphics (RGB)
    Preview
    Download
      *: Be careful to have 4-byte alignment for each pixel row. Otherwise it will not be correctly displayed.
       
    Notes: [1] The students are required to finish this problem using your own code. If you are using Matlab, make sure that you can't use the existed Matlab functions (such as imread, imwrite) to simplify your task.
    [2]
    Being able to read "Black & White" and "Graphics" by the converter is optional. Full points will be given to the solutions that can handle RGB24 and Grayscale images. Bonus points will be added to the solutions that can handle "Black & White" and "Graphics" images.
       
    References: [1] PPM/PGM/PBM files format specification
    [2] Bitmap file format specification
       
    Bitmap file format tips: Bitmap files share the following structure:

    Content
    Header Information
    Format Information
    Color Table (Optional)
    Pixel Values
    Structure
    Data
    Length
    14 bytes
    40 bytes
    Variable
    Variable

    Several .bmp file samples (4x4 pixels) to help you understand the format:

    Foremat
    RGB24
    GrayScale
    Monochrome
    Preview
    Download
       

  2. [40 pts] Perform 8x8 DCT transform on the images. Try the following operations.And then perform inverse DCT transform. Compare the differences (e.g., show PSNR values).

    1) Leave only the DC values. Delete all AC values.
    2) Leave the DC value and 5 AC values (in the zig-zag order) in each block.

    3) Quantize the DCT coefficients using the standard JPEG quantization table.

    Notes: [1] Implementation of fast DCT is not required for this problem. You can directly use the DCT and IDCT equations (in the course #2 slides) to implement these functions or use existing FFT and inverse FFT algorithms to perform this task.
    [2] Refer to course #2 slides for the JPEG quantization table at quality factor of 50.
    [3] Please use the lena_rgb image from problem 1.
       
    Matlab references: imread, imwrite, blkproc
       
    Reference link: PSNR/SNR tutorial

  3. [30 pts] Perform encryption on the DCT coefficients of images by the following shuffling methods and then perform inverse DCT on them. Observe the results. You can use any encryption method (e.g., randomly enerate a look-up table for shuffling).

    1) Encryptin the DC coefficients of blocks. Don't change the AC coefficients.
    2) Encryptin the AC coefficients within each block. Any shuffling method can be used.
    3) Encryptin the AC coefficients based on the format compliant encryption as described in the slides (Wen et. al. 2002).

    Shuffling table:
    One reference shuffling table: the IP table defined in DES:


    58 50 42 34 26 18 10 2
    60 52 44 36 28 20 12 4
    62 54 46 38 30 22 14 6
    64 56 48 40 32 24 16 8
    57 49 41 33 25 17 9 1
    59 51 43 35 27 19 11 3
    61 53 45 37 29 21 13 5
    63 55 47 39 31 23 15 7


  4. [Extra 20 pts] Implement the DES encryption method and perform ECB and CBC encryption.

    Help can be provided upon request.