On Bayer demosaicing impact on image sharpness in lens quality assessment T. Zemčík 1 , K. Horák 1 1 Brno University of Technology, Faculty of Electrical Engineering and Communications, Czech Republic E-mail: zemcikt@vut.cz, horak@vut.cz Abstract—In this short paper an ongoing research is introduced into the methods of simple lens quality assessment for low-cost computer vision applications. Also the paradigm of colour filter arrays (CFA), CFA images and their demosaicing are described. Further the paper introduces an experiment to compare selected demosaicing algorithms and their influences on image sharpness, and therefore on the lens quality assessment. Of the selected methods the AHD (Adaptive Homogeneity-Directed) algorithm proved the most suitable for the lens evaluation. Keywords—Colour filter array, Bayer matrix, demosaicing, debayering, lens quality, MTF 1. INTRODUCTION In recent years advancements in image processing and computer vision methods have made it possible for many more fields to use imaging sensors in ever increasing numbers. More and more applications are being developed that emphasise accessibility and low-cost, which at times comes with sacrifices in image quality. In many cases cameras with interchangeable lenses are used, such as the increasingly popular Raspberry Pi camera used in conventional applications such as [1, 2], and even pushed into more specialised applications such as [3]. Lenses are typically the most expensive parts of the imaging hardware, it is thus logical that in a low-cost application usage of cheap lenses is desirable. Experience shows that some of the cheap lenses on the market come with certain defects, such as miss-alignment of the optical components, or defects to the components themselves causing aberrations. As in any machine vision application assessing the image quality is necessary for a well performing system, therefore methods have been developed to quantify the qualities of the image, such as contrast, sharpness or distortion. As a part of an ongoing effort to find a reliable way to assess the quality of lenses, this paper aims to describe effects of various Bayer demosaicing approaches on image sharpness, and to select a suitable way to represent the colour image for measurement of image sharpness. 2. COLOUR FILTER ARRAYS AND DEMOSAICING A colour digital image as we know it is nothing more than a simple multi-spectral image, usually consisting of three colour images (red, green and blue) that activate the three different colour light-sensitive elements (cones) in our eyes [4]. If we are to take this multi-spectral image in one-shot (rather than using a scanning method), there are several fundamental approaches. In the first approach it is possible to decompose the image using an system of optical elements (a beam splitter) into several images, that are then passed through the desired chromatic filters, and projected onto multiple sensors (or different areas of the same sensors)- this approach was famously used in the Two-Color and Three-Color Technicolor systems [5], and is still used in specialised cameras today. The second approach involves specialised image sensors the architecture of which allows the various colour images to be taken in one light-sensitive element. Usually the sensors involve stacked photodiode architectures, such as the X3 sensors [6]. Such sensors are however still quite rare. The third approach uses a standard imaging sensor (most commonly a CCD or CMOS chip), that has different chromatic filters applied to the individual light-sensitive cells. This arrangement is called a CFA (Colour Filter Array), CFAs take many forms differing in how many and which filters are involved, and what their configuration is [7, 8]. This arrangement is by far the most common and de-facto the only method in use for the low-cost computer vision systems in question. 291 DOI: 10.13164/eeict.2022.291