Improvement of Binary Image after JPEG Compression

Project objective is improving binary images that were compressed by JPEG algorithm.

Abstract
Project objective is improving binary images that were compressed by JPEG algorithm.
JPEG compression is definitely efficient for natural images (in which color levels are smoothly changed).However , for images in which color levels are sharply changed (and in particular binary images) JPEG compression gives poor results.
This project attempts to find an algorithm for improving binary images which were compressed by JPEG.
This projects is divided into 2 parts .The first one involves in finding image ‘s original colors and the other involves in image improvement.
The project was implemented under Matlab environment.

Theory
JPEG algorithm main stages:
1. Dividing image into 8×8 blocks
2. Performing 2D DCT on each block
3. Block quantization
4. Enthropy encoding

Colors Detection
When binary images are compressed by JPEG algorithm they lose some information. Some of the pixels (depends on compression quality) are changed and get wrong values of gray levels.
The algorithm we wrote tries to find the accurate gray level of the 2 original colors of the binary image before compression.
The algorithm uses image historgram as seen in the following image:
1
It is obious from this histogram that pixels values around the original values were changed, but image’s original grey leves are still the most common.

Image Improvement
After getting the 2 original grey levels of the binary image, each pixels’s value shouled be decided to be color X or color Y. JPEG image compression causes pixel values to move over the grey level histogram from the main bar (X or Y) to both sides.

Image Improvement algorithm main purpose is to decide for each pixel its original value.

The algorithm goes over all image blocks (each one 8X8 pixels) and finds the suspected pixels which are announced as unknown pixels. The number of suspected pixels is depend on JPEG compression quality. The improvement algorithm find all the possible options for the unknown pixels and decide their values by taking the minimum error block.

Here are some images improvement results:
2

3

Conclusions
1. It is possible to restore a binary image that was compressed by JPEG algorithm, with quality high enough, if we know the two original grey levels of the image.

2.Algorithm run time depends on the quality of the JPEG compression, and on the distance between two original grey levels.

3. The detection of the two original grey levels depends on the following: JPEG compression quality, grey levels distance and image typicals (sharpness of edges).