Task 014: Transform compression of grayscale image

Your task is to implement lossy compression of grayscale raster image, you should be focused on natural images taken with digital camera or results of synthetic CGI rendering.

Screenshot

Entropy codec

There is a standard vocabulary-based entropy codec ready for you: DeflateStream (Zlib) or a more effective buffered version BufferedDeflateStream.

Task

You should choose suitable image transform and implement lossy compression scheme based on it. Codec efficiency will be your goal .. good compression ratio withing reasonable image quality boundaries (measured as RMSE). The whole codec will be implemented in one class TRCodec - in one source file TRCodec.cs.

Base

You will be using the 014compressiontr project from the grcis repository. The simple WinForms-based application is ready, user can load an input image and start encoding/decoding by pressing the button Recode. After a short time encoding and recoding will finish and you will be informed about results: time spent in encoding phase, size of intermediate binary file and RMSE measured on the result image.

Please ignore eventual input-image colors, read input data using Raster.Draw.RgbToGray(). Put raster image size together with a magic number MAGIC into the header of your file-format.

Metods to implement: EncodeImage() and DecodeImage().

Ideas

Use some classical image transform (DCT, Hartley, Hadamard, Haar..). Then quantize coefficients individually (like in JPEG-1), quality controlled by an user will be appreciated (see JPEG-1 again). Final coefficient pass and some proper channel coding will finish the encoding task.

Decoding should invert exactly the channel coding step and the transform step (except of possible numerical errors). So called "dequantization" will introduce all the distortion..

Comparison: the JPEG standard, but you probably won't be able to compete.

Program

Pilot implementation is ready for you (in 014compressiontr project): user can load arbitrary input image, enter required quality (between 0 and 100) and start encoding. After encoding/decoding is done, you can see time spent in encoding, size of intermediate binary file (compressed image) and RMSE of the reconstructed image.

Deadline

Due to: 18. 2. 2018

Credits

Base: 25 points (functional code with reasonable efficiency), bonus points for good efficiency, testing more than one transform or more extensive study (separate document/report handed in).

Project

Visual Studio project: 014compressiontr.

Source file

Modify and submit the file: TRCodec.cs
Return your name in the InitParams() function!
Describe yourt method at least in source-file comments.

Results / contest

Not yet.

Input data

There is one image in the repository - masa512g.png more suitable images: janssen-19111g.png (533x400), kodim07sg.png (465x375) nebo frozentree.png (1920x1200).


Copyright (C) 2010-2017 J.Pelikán, last change: 2019-05-09 17:52:59 +0200 (Thu, 09 May 2019)