Efficient Digital Color Image Demosaicing Directly to Ycbcr 4:2:0
Total Page:16
File Type:pdf, Size:1020Kb
Efficient Digital Color Image Demosaicing Directly to YCbCr 4:2:0 Thesis Submitted to The School of Engineering of the UNIVERSITY OF DAYTON In Partial Fulfillment of the Requirements for The Degree of Master of Science in Electrical Engineering By Daniel Christopher Whitehead UNIVERSITY OF DAYTON Dayton, Ohio December, 2013 Efficient Digital Color Image Demosaicing Directly to YCbCr 4:2:0 Name: Whitehead, Daniel Christopher APPROVED BY: Eric J. Balster, Ph.D. Keigo Hirakawa, Ph.D. Advisor Committee Chairman Committee Member Assistant Professor, Department of Assistant Professor, Department of Electrical and Computer Engineering Electrical and Computer Engineering Frank A. Scarpino, Ph.D. Committee Member Professor Emeritus, Department of Electrical and Computer Engineering John G. Weber, Ph.D. Tony E. Saliba, Ph.D. Associate Dean Dean, School of Engineering School of Engineering & Wilke Distinguished Professor ii ABSTRACT Efficient Digital Color Image Demosaicing Directly to YCbCr 4:2:0 Name: Whitehead, Daniel Christopher University of Dayton Advisor: Dr. Eric J. Balster As digital cameras replace their film based predecessors, new techniques are required to con- vert raw sensor data into a more usable format. Color image demosaicing is used to interpolate sparse color channel information received from the sensor to produce a full color image. The ideal demosaicing algorithm would minimize complexity while maximizing quality, however, in reality trade-offs must be between complexity and quality. Typically an image is demosaiced into a red-green-blue (RGB) color-space and then transformed into an alternate color-space such as YCbCr. The YCbCr color-space separates the image into a lu- minance channel, Y,and two chrominance channels, Cb and Cr, which is useful for image processing tasks, such as compression. The chrominance channel of the YCbCr image is often subsampled to reduce the amount of data processed without significantly impacting the perceived image quality. This is possible because the human visual system has a lower sensitivity to high frequency chromi- nance information compared to high frequency luminance information[1]. A common form of the YCbCr format with subsampled chrominance is YCbCr 4:2:0, which consists of one Cr and one Cb sample for every four luminance samples. iii This thesis presents an efficient method of demosaicing directly into YCbCr 4:2:0 format, by- passing the intermediate RGB image produced by most existing demosaicing methods. The pro- posed color image demosaicing algorithm is first implemented with floating point mathematics and then further simplified to operate as a fixed point algorithm. The floating point implementation of the proposed algorithm is shown to have a significantly reduced average execution time when com- pared to algorithms capable of producing similar quality images. Hardware is developed using fixed point multiplications, which has a throughput of approximately 24 bits/clock. iv ACKNOWLEDGMENTS I would like the thank all who have helped and supported, especially: • My family: For always supporting and encouraging me. • Dr. Eric Balster: For giving me this opportunity, motivating me, and advising me throughout my graduate education. • Dr. Keigo Hirakawa and Dr. Frank Scarpino: For serving on my thesis committee. • My Co-Workers: For helping me along the way. • Kerry Hill, Al Scarpelli, and the Air Force Research Laboratory at Wright-Patterson Air Force Base: For enabling this experience. v TABLE OF CONTENTS ABSTRACT . iii ACKNOWLEDGMENTS . v LIST OF FIGURES . viii LIST OF TABLES . x I. Introduction . 1 II. Background . 3 2.1 Imaging systems . 3 2.2 YCbCr Color-Space . 7 2.3 Existing Demosaicing Algorithms . 11 III. Proposed Algorithm . 13 3.1 Proposed Demosaicing Algorithm . 13 3.1.1 Green Channel Interpolation . 16 3.1.2 Red-Blue Interpolation . 16 3.1.3 Calculating Chrominance . 17 3.1.4 Calculating Luminance . 17 3.2 Results . 19 IV. Transition from Floating Point to Fixed Point Multiplication . 26 4.1 Floating Point Overview . 26 4.2 Conversion to Integer Multiplications . 27 4.3 Results . 28 vi V. VHDL Hardware Implementation . 32 5.1 Hardware Design . 32 5.1.1 Demosaicing Top Level . 34 5.1.2 Demosaicing State-Machine . 34 5.1.3 Green Interpolation . 35 5.1.4 Red/Blue Interpolation . 38 5.1.5 Chrominance, Y1 and Y2 Interpolation . 38 5.1.6 Y3 and Y4 Interpolation . 41 5.2 Results . 41 VI. Conclusion . 46 6.1 Future Research . 46 BIBLIOGRAPHY . 48 vii LIST OF FIGURES 2.1 Digital color photography using a prism to split light between multiple sensors . 4 2.2 Color wheel [2] . 5 2.3 Color artifacts common in demosaiced images . 6 2.4 Raw image to demosaiced image . 7 2.5 Absorption of light by the red, green, and blue cones in the human eye as a function of wavelength [3] . 8 2.6 Spectral sensitivity characteristics of a typical camera sensor [1] . 9 2.7 Gamma transformations . 10 3.1 Green-red starting pattern . 14 3.2 Region of interest . 15 3.3 Green channel interpolation filter developed in [4] . 16 3.4 Kodak image set [5] . 20 3.5 Average PSNR in dB . 21 3.6 Average SSIM . 22 3.7 Sample outputs from left to right, top to bottom: Original, Proposed, Method in [6],Method in [7], Method in [8],Method in [9],Method in [4],Bilinear . 23 4.1 PSNR vs. scaling factor . 29 viii 4.2 PSNR comparison of fixed point and floating point results . 30 4.3 SSIM comparison of fixed point and floating point results . 31 5.1 GiDEL ProceIV Block Diagram from [10] . 33 5.2 State-machine in demosaic control module . 36 5.3 Green interpolation module when processing a blue-green row . 37 5.4 Green interpolation module when processing a green-red row . 39 5.5 Red and blue interpolation module . 40 5.6 Chrominance interpolation segment . 42 5.7 Y1 and Y2 interpolation segment . 43 5.8 Y3 and Y4 interpolation module . 45 ix LIST OF TABLES 3.1 Operations per Pixel . 24 3.2 Average Execution Time . 24 5.1 Hardware design characteristics . 44 5.2 Hardware execution time characteristics at 200MHz . 44 x CHAPTER I Introduction Digital cameras have largely replaced film based cameras in the consumer market in over the past several years. The sensors used in digital cameras convert light intensity into a discrete picture element (pixel) values. Although the sensor captures light intensity, they give no specific informa- tion about color since without filters the light intensity is taken over a wide range of wavelengths. Despite this limitation color digital cameras can be made possible through strategic inclusion of filters that only allow limited ranges of wavelengths through to the sensor. The filtering of light is a critical step in allowing the possibility of color information, however, filtering alone will not produce a color image. The most common technique for producing color images in consumer grade digital cameras is to place a color filter array (CFA) in front of the sensor. The CFA is a known pattern of filters where a different filter is applied to each pixel. An image captured through a CFA contains partial color channel information, typical red, blue, and green color channels. This pseudo-color image that is captured by the camera’s sensor is not acceptable as an output image because each pixel only has one color component. A process of interpolating the image produced by a CFA known as demosaicing is performed to produce a full color image. Typical demosaicing algorithms produce a Red-Green-Blue (RGB) image which is useful for display purposes but for many other image processing tasks, such as compression, an RGB image 1 is not ideal. More useful color-spaces exist than RGB, such as YCbCr which splits the image into luminance and chrominance information, HSL which converts the image into hue, saturation, and luminance channels, and many more. This paper proposes a new method of demosaicing raw images directly into the YCbCr color- space, bypassing the need for a full RGB image as an intermediate step. As a low complexity method of demosaicing, the proposed algorithm is ideal for applications that are able to sacrifice quality slightly for significant increase in speed. The proposed algorithm is first introduced with the inclusion of floating point multiplications. The algorithm is then be simplified to only required integer based operations. Chapter II covers various camera designs for capturing color, the YCbCr color-space, and sum- maries some existing demosaicing algorithms. The proposed demosaicing algorithm and its results are discussed in Chapter III. In Chapter IV the proposed algorithm is converted from relying on floating point multiplications to being purely integer based. A hardware implementation of the pro- posed integer based algorithm is presented in Chapter V. Conclusions about the proposed algorithm are drawn in Chapter VI. 2 CHAPTER II Background This chapter discusses the systems for capturing color images with a digital camera, the YCbCr color-space transform, and some existing demosaicing algorithms. Section 2.1 discusses three types of color imaging systems and their advantages and disadvantages. Section 2.2 introduces the YCbCr color-space and why it is used. Section 2.3 summarizes some existing demosaicing algorithms which are used for comparison later in this paper. 2.1 Imaging systems The simplest model of a digital camera consists of a sensor array, which converts photons into an electrical charge, a lens which focuses the scene being photographed onto the sensor array, an aperture which limits the amount of light entering the lens, and a shutter to limit exposure time. The sensor arrays in digital cameras record light intensity based on the number of photons that reach the sensor. The intensities of specific wavelengths would be completely lost, leaving a gray-scale image if additional hardware is not included in this model.