• No results found

Compression of colour images using machine learning algorithm

N/A
N/A
Protected

Academic year: 2020

Share "Compression of colour images using machine learning algorithm"

Copied!
6
0
0

Loading.... (view fulltext now)

Full text

(1)

COMPRESSION OF COLOUR IMAGES USING MACHINE

LEARNING ALGORITHM

D. Malathi, Shashank Mishra, Ashlesha Vaidya, Apoorva Dhar and Niveditha Kumaran

Department of Computer Science and Engineering, SRM University, Chennai, India

E-Mail: [email protected]

ABSTRACT

The increase use of transfer of images from one device to another created a need to compress them without compromising their quality. Machine learning algorithm forms a potential method to compress an image by clustering thus leading to elimination of redundant colours .k-means algorithm is an unsupervised machine learning algorithm which clusters data and hence elected as best method for compression of colours .In this paper we propose compression of an image using k-means algorithm and variation of size of image for different values of k. Moreover comparison of k-means with JPEG and wavelet compression algorithms is performed deriving their advantages, disadvantages and compression ratio.

Keywords: machine learning, K-means, unsupervised learning, JPEG, wavelets transform.

1. INTRODUCTION: PRINCIPLE BEHIND COMPRESSION

A general characteristic of most images is that they contain redundant information as their neighbouring pixels are correlated. Two fundamental components of compression are redundancy reduction and irrelevancy elimination [1]. Redundancy reduction removes duplication from the signal source. Irrelevancy elimination is removing of signal which is not noticed by Human Visual System. Apart from these an interesting method introduced in this paper is reduction of colour based on neighbouring similarity to such an extent that its size is reduced uncompromising the quality. Compression techniques as stated in [6, 7] is also presented.

2. K MEANS ALGORITHM

K-Means [2] is an unsupervised learning algorithm. K means clustering algorithm gains its name from its method of operation. It deals with fixing k centres, one for each cluster. Here k is an input parameter. The best choice of defining centres is placing them as far as possible. Clusters are formed based on proximity of other cluster with defined centroids. The cluster’s mean is then computed and the process is repeated again [2, 10, 11, 12].

Figure-1. Extreme saturation after iteration 2 at k=16.

The separated cluster looks like as shown in Figure-1 is just starting phase of Clustering which is termed as 2nd iteration then progressively following it Figure-2, Figure-3, Figure-4 and then Figure-5 states that K-means has reached its extreme saturation after which there is no affect in centroids changing iterations.

Figure-2. Extreme saturation after iteration 3at k=16.

(2)

Figure-4. Extreme saturation after iteration 5k=16.

Figure-5. Extreme saturation after iteration6 at k=16.

3. ADVANTAGES OF K-MEANS FOR COLOR IMAGE COMPRESSION

K-means is least complex, fast, robust and easy to understand, relatively efficient and accurate. Result is clearer when data are separated and distinct from each other. Hence above advantages makes K-means stand out different from other algorithms.

4. ALGORITHM

Let X = {x1,x2,x3,……..,xn} data points and V =

{v1,v2,…….,vc} be centres.

Step-1: We randomly select ‘m’ cluster centres known as centroids.

Step-2: Calculate the distance between each data point and centroids.

Step-3: Assign the data point to the centroids whose distance from the centroid is minimum of all the centroids.

Step-4: Recalculate the new centroid using:

V = (1 c⁄ ) ∑ X

=1:c 1

where, ‘mi’ represents the number of data points

Step-6: If no data point was reassigned then stop, otherwise repeat from step-3.

Table-1. Size with K value.

S. No. K value Size (in kb)

1 500 31.3

2 200 29.2

3 100 25

4 50 20.4

5 18 11.7

6 1 380(bytes)

Figure-6 is pictorial representation of changing K value and its effects in image on which compression is applied.

5. LOSSLESS VS. LOSSY COMPRESSION

In lossless [8, 18] compression file size is changed but its quality remains unchanged. Also, the file can be decompressed to its original quality whereas Lossy compression is irreversible and hence it’s difficult to retrieve data. Lossy compression tends to achieve much higher compression as compared to lossless.

Image coder

An Image Coder contains (a) Source Encoder (b) Quantizer, and (c) Entropy Encode.

Source encoder (or Linear Transformer)

(3)

Quantizer

It reduces number of bits required to store transformed coefficient by reducing precision of those values. Quantization performed in each individual coefficient is termed as Scalar quantization whereas when it is performed on a group of coefficient then it is known as vector Quantization.

Entropy encoder

Entropy encoder [9] is a lossless data compression scheme. This encoder compresses the quantized values further to provide a better compression, compresses digital data by using frequently occurring patterns with less bits and rarely occurring pattern with huge amount of bits. Huffman encoder [ ] is most commonly used encoder.

6. VARIOUS COMPRESSION ALGORITHMS

A. JPEG

JPEG [14, 17] stands for joint photographic Expert group ia a lossy compression algorithm. This algorithm takes the advantage that human cannot see high frequency colours from their eyes and hence these high frequency contents are eliminated to compress the image.JPEG uses transform coding. According to observation intensity value changes in small amount in smaller area, the process starts with splitting of image into 8x8 non-overlapping pixel block and if the image cannot be divided into blocks then padding of empty pixels are done. Then colour space transformation from RGB to [Y Cb Cr] which is Brightness, colourblueness and colour redness respectively. Discrete cosine transform of image is taken. Quantize the DCT coefficient according to psycho visually tuned quantization table. Zigzag scanning is performed to arrange low frequency coefficient at top and less frequency at bottom and thus image is efficiently compressed by run length coding or Huffman coding. Information loss occurs only at time of quantization.

B. Wavelet transform

Wavelets [3, 4, 5] are mathematical function that divide or cut up data into different frequency components and then study each components with resolution matched to its scale. Wavelets transform decomposes a signal into a set of basis functions. These basis functions are termed as wavelets Figure-7 is working components of wavelet transform.

Figure-7. Wavelet transform flowchart.

Compressed image

As seen in [13, 15] the above model is prepared and implemented for comparison in table.

(4)

Figure-9. Restored image with 5 coefficient.

Figure-10. Restored image with 3 coefficient.

Figure-11. Restored image with 1 coefficient.

Figure-7 is the original image used in K-means compression and then after application of wavelet compression to this image results are noted and observed in following figures mentioned, fig 8 is with coefficient value 5 and hence least compressed as compared to other figures with less distortion whereas in fig 9 and fig 10 as we reduce coefficient value the distortion increases and hence the compression.

7. OBSERVATION

K-means is algorithm is least complex compression method and hence provide best quality image even after compression. As the K value decreases the quality also decreases and hence compression increases. Therefore optimum K value should be chosen keeping in mind such that image quality alters less in amount with respect to compression. Also the comparison of K-means with different compression algorithm like JPEG compression and wavelet compression is presented with their advantages and disadvantages. As observed JPEG is used generally when images are of continuous tone and it doesn’t work for binary images. Unlike JPEG wavelet works on whole image instead of segmenting image and hence produces no blocking artifacts in return.

(5)

Table-2. Comparison of K-means, JPEG and Wavelet for color image compression.

Algorithm Advantages Disadvantages Compression ratio

K Means

Offers best quality image with less

degradation

Difficult to find appropriate

K value 5:1-10:1 (approx.)

JPEG

Works with colour and grey scale images.

Best suited for continuous tone images.

Doesn’t work with binary

images 10:1-100:1

Wavelet

Analyse the whole image block instead of

dividing image into segment

Sometimes coefficients may not represent the signal with sufficient accuracy in the

time domain and in the frequency domain.

30-300% greater than JPEG 600:1 in general

8. CONCLUSIONS

In conclusion, we have reviewed and summarised three algorithms named K-means, JPEG and wavelet transform. K-means provides efficient output when we transfer in bulk but are reluctant to compromise in quality. However wavelet transform provides with best compression ratio as compared to other algorithm. Compression facilitates with easy transfer of bulky images and video and then recovering of images for further use. K-means algorithm offers flexibility to compress an image by just clustering similar colours in one and then fixing appropriate value of K.

REFERENCES

[1] Sachin Dhawan. 2011. A Review of Image Compression and Comparison of its Algorithms, Department of ECE, UIET, Kurukshetra University, Kurukshetra, Haryana. International Journal of Electronic and Communication Technology (IJECT). 2(1), ISSN: 7109(Online) | ISSN: 2230-9543(Print).

[2] Kehar Singh. 2011. Evolving limitations in K-means algorithm in data mining and their removal. International Journal of Computational Engineering and Management, Vol. 12, ISSN (Online): 2230-7893.

[3] Chan Y. T. 1995. Wavelet Basics, Kluwer Academic Publishers. Norwell, MA.

[4] Mallat S.G. 1989. A Theory for Multiresolution Signal Decomposition: The Wavelet Representation. IEEE Trans. PAMI. 11(7): 674-693.

[5] J.M. Shapiro. 1993. Embedded image coding using zero tree of wavelet coefficients, IEEE Trans. on Signal Processing. 41(12).

[6] R. Neelamani. 2006. JPEG compression history estimation for color images. IEEE. 15(6).

[7] Majid Rabbani, Paul W. Jones, 1st February 1991. Digital Image Compression Techniques.

[8] R.B. Arps, T.K. Truong. 1994. Comparison of international standards for lossless still image compression. 82(6).

[9]

C. Chamzas D. Duttweiler. 1991. Entropy encoder/decoder including context extractor. Published in US patent June 11 1991, publication number US5023611 A.

[10]K. Krishna, M. Narasimha Murty. 1999. Genetic K-means algorithm. 29(3).

[11]Zhexue Huang. 1998. Extensions to the k-Means Algorithm for Clustering Large Data Sets with Categorical Values, 2(3): 283-304, ACSys CRC, CSIRO Mathematical and Information Sciences Canberra Australia.

[12]J. A. Hartigan and M. A. Wong. 1979. A K-Means Clustering Algorithm.Journal of the Royal Statistical Society. Series C (Applied Statistics).28(1): 100-108.

[13]Xiaoli Tang, William A. Pearlman‡ and James W. 2002. Hyperspectral Image Compression Using Three-Dimensional Wavelet Coding: A Lossy-to-Lossless Solution, article published in Modestino Center for Image Processing Research Rensselaer Polytechnic Institute Troy, NY 12180-3590 in 2002.

(6)

[15]S. Grace Chang. 2000. Adaptive Wavelet Thresholding for Image Denoising and Compression. Student Member, IEEE. 9(9).

[16]Y. Yoo, A. Ortega and B. Yu. 1999. Image subband coding using context based classification and adaptive quantization, IEEE Trans. Image Processing. 8: 1702-1715.

[17]Petr Hurtik, Irina Perfilieva. 2017. A hybrid image compression algorithm based on JPEG and Fuzzy transform. Fuzz systems (FUZZ-IEEE) IEEE International Conference, Electronic ISBN: 978-1-5090-6034-4 on 9-12.

References

Related documents

Absolute power density of the radiofrequency radiation from selected mobile base stations was measured with the aid of BK spectrum analyzer at different selected areas with their

It should also be recognized that governmental commercial infor- mation transactions with legitimate sources (e.g., information brokers), still give rise to national security

His Zameen (1955)…the 14-foot-long canvas teems with images culled as though from a primeval memory of the archetypal Indian village, presenting a panorama of persons,

An approximate (isotropic) treatment of cell e.s.d.'s is used for estimating e.s.d.'s involving l.s.. supporting information sup-3 Acta Cryst.. supporting information sup-4 Acta

For students whose IEP team has determined a focus on successful transition from high school to the community as the student’s course of study, Super Senior may be determined by

General Plasma is continuing to develop an array of large area thin film coating processes utilizing an innovative linear source for plasma enhanced chemical vapor deposition

mosquito control organizations in the United States, the results of this study may

The aim of the study was to assess climate variability, its relationship with dairy farming and to document coping strategies for resilience against climate variability by the