International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 5 – March 2015 Blocking Artifacts Reduction in DCT Image using Fuzzy Filtering Techniques K.Bhargavi#1, A.Sai Varun#2, D.Abhishek #3, K.pallaviteja*4 # Student of Department of ece, Lendi institute of engineering and technology Near Jonnada village, Vizianagaram-535005, India. Abstract : An image consists of large data and requires more space in the memory. The large data results in more transmission time from transmitter to receiver. Uncompressed multimedia (graphics, audio and video) data requires considerable storage capacity and transmission bandwidth. However, for block based compressed images, we face the problem of unwanted blocking artifacts due to lack of correlation between edges of an image. Blocking artifacts can take on several forms in DCT compressed images. These artifacts are visually very annoying and have a substantial impaction to the subjectively perceived image quality. The artifacts removal algorithms are cost effective and yield better performance in terms of both objective and subjectively. Fuzzy filtering, dfuzzyfiltering and edge fuzzy filtering are different filters Used to remove artifacts during decompression phase. In this work, spatial neighboring pixels are used to deal with blocking and ringing artifacts while temporal neighboring pixels are utilized to remove mosquito and flickering artifacts. Objective fidelity metrics, peak signal to noise ratio (PSNR), Mean Square Error (MSE) and compression ratio relevant to different images can be improved in proposed technique. Proposed work can be implemented using Matlab 2011a version. Keywords - Artifacts, DCT Compression, Dfuzzyfiltering, Edge fuzzy filtering, Fuzzy filtering, Fidelity metrics (PSNR, MSE, Compression Ratio).. I. INTRODUCTION Image processing has been a key prophecy for improving image quality obtained from camera or any other source. Many image processing techniques has been evolved. One of the most significant techniques is image compression which is used to reduce the amount of data required to represent an image. The objective of image compression is to reduce irrelevance and redundancy of the image data in order to be able to store or transmit (text, fax, images) data in an efficient form. Some of the finer details in the image can be ignored for the purpose of saving a little more bandwidth or storage space required to store an image. Compression is classified in to 2 types Compression Lossless Lossy Lossy b) Lossless Image Compression a) Lossy Image Compression: It is a data encoding method that compresses data by losing some of it. The key aim is to minimize the amount of data that needs to be held and transmitted by a computer .Lossy image compression is most commonly used for compressing multimedia data such as audio, video and still images, especially in applications such as streaming media and internet telephony. Ideally lossy compression is transparent or imperceptible, which can be verified through an ABX test. b) Lossless Image Compression: This is a class of data compression algorithms that allows the exact accurate original data to be reconstructed from the compressed data. The lossless compression is used in cases where it is important that the original and the decompressed data be identical, such as X-ray images. Some other examples are executable programs, text documents, and spreadsheet and source code. Some images having file formats of PNG or GIF use only lossless compression. It is the method mostly used in medical applications. Lossy compression methods, especially when used at low bitrates, introduce compression artifacts and are especially suitable for natural images such as photographs in applications where minor loss of fidelity is acceptable to achieve a substantial reduction in bit rate. The process of image compression is required in many imaging and video applications. However, these applications are all bothered by an annoying problem i.e. blocking artifacts. Block based compressed signals results in blocking, ringing, mosquito, and flickering artifacts, especially at low-bit-rate encoding. Compressing block edges the correlation between pixels at the border of neighboring blocks and causes blocking artifacts individual. Ringing artifacts occur due to the loss of high frequencies when quantizing the DCT coefficients with a coarse quantization. Mosquito artifacts come from ringing artifacts of compressed frames when displayed in a sequence and becomes more annoying for blocks on the boundary of moving object and background which has significant Interframe prediction errors in the residual signal Flickering artifacts occurs due to the inconsistency in quality over frames at the same spatial position. This inconsistency is from the temporal distortion over compressed frames caused by quantizing the residual signal. These flickering artifacts will be perceived more in the flat areas, also come from different quantization levels for rate-distortion optimization. Fig.1 compression types a) Lossy Image Compression ISSN: 2231-5381 http://www.ijettjournal.org Page 275 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 5 – March 2015 Many filter-based denoising methods had been proposed to reduce these artifacts, most of which are frame-based enhancement. In previous techniques a linear low-pass filter was used for blocking artifact reduction, to remove the high frequencies caused by blocky edges at borders, but excessive blur was introduced since the high frequencies components of the image were also almost eliminated. Low-pass filters were applied to the DCT coefficients of shifted blocks. In this paper we are proposing different filters like Fuzzy filter, Directional fuzzy filter and Edge based fuzzy filters to overcome the problem of over-blurring the images. The boundary regions between blocks are identified as either smooth or non-smooth regions. The blocking artifacts in smooth regions are removed by modifying a few DCT coefficients appropriately, whilst an edge-preserving smoothing filter is applied to the non-smooth regions. To reduce ringing artifacts we use the linear or nonlinear isotropic filters in the ringing areas. For flickering artifact removal, most of the current methods focused reducing flickering artifacts in all Interframe coding. The quantization error is considered to obtain the optimal intra prediction mode and to help in reducing the flickering artifact. II. ARCHITECTURE The proposed architecture mainly consist of Dct function deals mainly with separation of r, g, b planes with the help of jpeg compression. In this proposed work our architecture is sub divided in to 2 parts. They are a) Discrete Cosine Transform (DCT) b) Fuzzy Filters a) Discrete Cosine Transform (DCT): Discrete Cosine Transform (DCT) attempts to de correlate the image data. After de correlation each transform coefficient can be encoded independently without losing compression efficiency. The Discrete Cosine Transform (DCT) is a technique that converts a spatial domain waveform into its corresponding frequency components as represented by a set of coefficients. The process of reconstructing a set of spatial domain samples from frequency components is called the Inverse Discrete Cosine Transform (IDCT). For data compression of image/video frames, usually a block of data is converted from spatial domain samples to another domain (usually frequency domain), which also offers more compact representation. The optimal transform is the Karhunen-Loeve Transform (KLT), as it packs most of the block energy into a fewer number of frequency domain elements, it minimizes the total entropy of the block, and it completely de correlates its elements. However, its main disadvantage is that its basis functions are image-dependent. This complicates the digital implementation. The Discrete Cosine Transform introduced by Ahmed in 1974, has the next best performance in compaction efficiency, while also having image-independent basis functions. Hence DCT is used to provide the necessary transform and the resultant data is then compressed using quantization and various coding techniques to offer lossless as well as lossy compression. ISSN: 2231-5381 b)Fuzzy Filters: Fuzzy filters improve on median filters or rank condition rank selection filters by replacing the binary spatial-rank relation by a real-valued relation. The conventional way to define the fuzzy filters is by generalizing the binary spatial-rank relation. In this paper, the fuzzy filter is introduced from the artifact reduction problem. Assume that a filter is applied to a set of neighboring samples x [m + m’, n + n’] around x [m, n] the input to form the output and its unbiased form with normalization. Y [m, n] = (1) e.q.(2) In (1), h(x [m + m’, n + n’], x [m, n]) controls the contribution of the input x [m +m’, n +n’] to the output. For a linear filter, h is fixed and input-independent. In the case of a nonlinear filter, h is a function of the input, such as for median filter. (3) Where round (u) is the nearest integer of u. Due to the input independence of the filter coefficients, a lowpass filter is designed to perform effectively in the flat areas may introduce blurring artifacts in fine detail areas. In artifact reduction, especially for low bit-rate compression, it is desirable to preserve the details while removing the artifacts. This can be achieved by imposing the constraint such that if x [m +m’, n +n’] is far from x [m, n], its contribution to the output is small. In that case, the filter coefficients h [k, l] must follow the constraints. (4) &(5) (6) The function h(x [m + m’, n + n’], x [m, n]) is referred to as the membership function and there are many functions which http://www.ijettjournal.org Page 276 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 5 – March 2015 fulfill these requirements. For a Gaussian membership function (7) Where σ represents the spread parameter of the input and controls the strength of the fuzzy filter. Note that the contribution of the input x [m, n] to the output is always highest compared to the contribution of other samples (8) For the same, x [m + m’, n + n’] - x [m, n] the higher the value, the higher the contribution of x [m + m’, n + n’] relatively compared to the contribution of x [m, n] to the output. This implies x [m, n] that will be more averaged to x [m + m’, n + n’]. Smaller σ values will keep the signal x [m, n] more isolated from its neighboring samples. This spread parameter should be adaptive to different areas which have different activity levels such as smooth or detail areas. For multidimensional signals, the conventional fuzzy filter assigns a fixed spread parameter for every surrounding sample and ignores the relative position between them. In image and video compression, artifacts such as blocking, ringing or flickering artifacts are directional, and, thus, the fuzzy filter should consider the directions between x[n] and its surrounding samples x[m + m’, n + n’]. This can be achieved by an adaptive spread parameter. (9) Where σ m is a position-dependent amplitude of the spread parameter σ and k is the scaling function controlled by the direction of x [m + m’, n + n’] to x [m, n]. Fuzzy filters are classified in to 3 types according to proposed architecture a) Fuzzy Logic Early applications: The Japanese were the first to utilize fuzzy logic for practical applications. The first notable application was on the high-speed train in Sendai, in which fuzzy logic was able to improve the economy, comfort, and precision of the ride. It has also been used in recognition of hand written symbols in Sony pocket computers; flight aid for helicopters; controlling of subway systems in order to improve driving comfort, precision of halting, and power economy; improved fuel consumption for auto mobiles; single-button control for washing machines, automatic motor control for vacuum cleaners with recognition of surface condition and degree of soiling; and prediction systems for early recognition of earthquakes through the Institute of Seismology Bureau of Metrology, Japan. Fuzzy logic works the way that humans think as opposed to the way that computers typically work. For example, consider the task of driving a car. You notice that the stoplight ahead is red and the car ahead is braking. Your mind might go through the thought process, "I see that I need to stop. The roads are wet because it's raining and there is a car only a short distance in front of me. Therefore I need to apply a significant pressure on the brake pedal." This is all subconscious (in general), but that's the way we think - in fuzzy terms. Do our brains compute the precise distance to the car ahead of us and the exact coefficient of friction between our tires and the road, and then use a Kalman filter to derive the optimal pressure which should be applied to the brakes? Of course not. We use common-sense rules and they seem to work pretty well. On the other hand, when we do finally get around to pressing the brake pedal there is some exact force that we apply, say 1.326 pounds. So although we think in fuzzy, noncrisp ways, our final actions are crisp. The process of translating the results of fuzzy reasoning to a crisp, non-fuzzy action is called defuzzification. b) Directional Fuzzy Spatial Filter: When highly compressed, the ringing artifacts in JPEG images are prevalent along strong edges and the filter strength should adapt to the edge direction. b) Directional Fuzzy Spatial Filter c) Edge Based Directional Fuzzy Filter a) Fuzzy Logic: In recent years, the number and variety of applications of fuzzy logic have increased significantly. The applications range from consumer products such as cameras, camcorders, washing machines, and microwave ovens to industrial process control, medical instrumentation, decisionsupport systems, and portfolio selection. To understand why use of fuzzy logic has grown, we must first understand what is meant by fuzzy logic. Fuzzy logic has two different meanings. In a narrow sense, fuzzy logic is a logical system, which is an extension of multi valued logic. However, in a wider sense fuzzy logic (FL) is almost synonymous with the theory of fuzzy sets, a theory which relates to classes of objects with unsharp boundaries in ISSN: 2231-5381 which membership is a matter of degree. In this perspective, fuzzy logic in its narrow sense is a branch of FL. Even in its more narrow definition, fuzzy logic differs both in concept and substance from traditional multivalued logical systems. In this technique we have to observe in compressed image that in which direction the blurriness is more so to apply strong filtering action in that direction and vice versa.. For example, the filter should ideally apply stronger smoothing in a direction which is having more blurriness or ringing artifacts let us say in horizontal direction where the ringing artifacts are likely to have no relation with the original value, and a weaker filtering in that direction let us say it as vertical direction, which is the edge direction of the image. One general form of cosine-based spread parameter which satisfies http://www.ijettjournal.org Page 277 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 5 – March 2015 this requirement is shown in below figure Fig: -Angle and spread parameter for directional fuzzy filter a) Angle, b) Spread parameter (10) where is the direction between the pixel of interestI[m,n] and its surrounding pixel I[m+m’,n+n,] as shown in Figure. is the amplitude of the spread parameter , and are positive scaling factors which control the maximum and minimum strength of the directional filter. In (10) , attains the minimum value in the vertical direction and the maximum value in the horizontal direction. An example of the directional spread parameter is plotted in Fig. below with , c) Edge Based Directional Fuzzy Filter: For real images when we stuck with more complicated edges, the strongest filtering is applied to the direction perpendicular to the edge. Based on the sobel operator with horizontal and vertical derivative approximation of the gradient. Fig. Flow chart of the directional fuzzy filter. To be adaptive for different areas having different activity levels, the standard deviation STD (I [m, n]) of pixels in the window W centered on I [m, n] is used to control the amplitude of the spread parameter m as III. PROPOSED TECHNIQUE Our proposed technique consists of a flowchart and a block diagram shown below a) Proposed block diagram of fuzzy filtering technique and the edges are detected by using the gradient magnitude G=sqrt (Gx2+Gy2) Its corresponding direction is determined by angle, θ0=atan (Gy/Gx). The spread function in this Case is determined by the angle. (θ-θ0) instead of in θ (10), where the angles θ and θ0 are Defined as in Figure below Fig. Block diagram of fuzzy filtering technique Fig. Angles and of the edge-based directional fuzzy filter. ISSN: 2231-5381 http://www.ijettjournal.org Page 278 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 5 – March 2015 b) Articrafted image Fig. Flowchart of proposed architecture b) steps of above flowchart: Take an input image of size m x n. Resize it to n x n (mostly in DCT we prefer n=8) and we get different blocks with size n x n. c) Fuzzy filtered image Apply Discrete Cosine Transform (DCT) to each block of RGB plane separation. Apply different filtering techniques like Fuzzy, Dfuzzy, Edge fuzzy to each plane of separation and obtained different fidelity metrics like MSE, PSNR, CR. And also obtained fuzzy filtered output images with minimum and maximum directions. IV. RESULT AND ANALYIS d) edge based fuzzy filter image when c=0 The image fidelity metrics for different input images and their articrafted and fuzzy filtered outputs are shown below and the output are considered in db. Fig. Koala.jpg e) edge based fuzzy filter image when c=1 a) ISSN: 2231-5381 Original image http://www.ijettjournal.org Page 279 International Journal of Engineering Trends and Technology (IJETT) – Volume 21 Number 5 – March 2015 Table I: Comparison Of PSNR Units In dB For Different Image Conclusion [8] K. Barner and R. Hardie, “Spatial-rank order Selection filter,” in Nonlinear Signal Processing, S. K.Mitra and G. Sicuranza, Eds. New York: Academic, Apr. 2006, vol. 15, pp. 910–9 [9] Gonzalez, Rafael C. “ Image processing,” Digital Image Processing / Richard E.Woods ISBN 0-201-18075-8 Apr. 2006, vol. 15, pp. 910–9. [10] Haskell , B.G.. and Netravali , A.N [1997]. Digital pictures: Representation, Compression and Standards ,Perseus publishing Newyark. [11] Huang, T.S., ed.[1975]. “ Picture Pocessing And Digital Filtering” Springer- Verlag Newyark. [12] Huang, T.S.[1981], “ Image Sequence Analysis” Springer- Verlag Newyork. V. CONCLUSION An effective algorithm for image denoising using different filtering techniques like fuzzy filter, directional fuzzy and edge based fuzzy filter is proposed. This novel method overcomes the limitations of conventional nonlinear filters by accounting for pixel’s activity and the direction between pixels. It is shown that the proposed filtering techniques improves image fidelity metrics like Mean square error (MSE) and Peak signal to noise ratio (PSNR) and compression ratio of compressed images compared to existing approaches and improves visual quality of image. Human visual system (HVS) should also be incorporated to evaluate the flicking artifacts based on artifact perception for different areas and thus we conclude that the proposed techniques are better and efficient qualitatively and quantitatively compared to existing techniques. VI REFERENCES [1] X. Fan, W. GAO, Y. Lu, and D. Zhao, “Flicking reduction In all intra frame coding,” Joint Video Team of ISO/IEC MPEG and ITU-TVCEG, JVTE070, Oct. 2002. [2] T. Jarske, P. Haavisto, and I. Defee, “Post-filtering Methods for reducing blocking effects from coded Images,” IEEE Trans. Cosum. Electron. vol. 40, No. 8, pp. 521–526, Aug. 1994. [3] S. Liu and A. Bovik, “Efficient DCT-domain blind Measurement and reduction of blocking artifacts, ”IEEE Trans. Circuits Syst. Video Technol., vol. 12, no. 12, pp. 1139–1149, Dec. 2002. [4] S. Oguz, Y.Hu, and T.Nguyen, “Image coding ringing artifact reduction using morphological is post-filtering,” in Proc. IEEE Int. Work. Multimedia Signal Processing, 1998, pp. 628–633. [5] A. Leontaris, Y. Tonomura, T. Nakachi, and P. Cosman, “Flicker suppression in JPEG2000 using Segmentation-based adjustment of block truncation lengths,” In Proc. IEEE Int. Conf. Acoustics, Speech and Signal Processing, Apr. 2007, vol. 1, pp. 1117–1120. [6] S. Kim and J. P. Allebach, “ image sharpening and noise removal,” J.Electron. Image. vol. 15, p. 0230071, 2005. [7] Y. Nie and K. Barner, “The fuzzy transformation And its application in image processing,” IEEE Trans. Image Process. vol. 15, no. 4, pp. 910–927, Apr. 2006. ISSN: 2231-5381 http://www.ijettjournal.org Page 280