원시데이터 수집 시스템
선정목록으로

Revisiting Gray Pixel for Statistical Illumination Estimation

관련 필름·전자재료 · (16) CPI(투명 폴리이미드)

기본 정보

저자
  1. Yanlin Qian — Laboratory of Signal Processing, Tampere University of Technology, Finland, Center for Machine Perception, Czech Technical University in Prague and Czech Republic, --- Select a Country ---
  2. Said Pertuz — Laboratory of Signal Processing, Tampere University of Technology and Finland, --- Select a Country ---
  3. Jarno Nikkanen — Intel Finland and Finland, --- Select a Country ---
  4. Joni‐Kristian Kämäräinen — Laboratory of Signal Processing, Tampere University of Technology and Finland, --- Select a Country ---
  5. Jiřı́ Matas — Center for Machine Perception, Czech Technical University in Prague and Czech Republic, --- Select a Country ---
DOI
10.5220/0007406900360046
저널
Proceedings of the 17th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications
발행년도
2019
발행기관
–
피인용수
28
라이선스
cc-by-nc-nd
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.5220/0007406900360046
토픽
Color Science and Applications
OpenAlex ID
W2949401834

평가 내용

관련도
관련
사업분야
필름·전자재료 · (16) CPI(투명 폴리이미드)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > CPI(투명 폴리이미드)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

We present a statistical color constancy method that relies on novel gray pixel detection and mean shift clustering. The method, called Mean Shifted Grey Pixel -- MSGP, is based on the observation: true-gray pixels are aligned towards one single direction. Our solution is compact, easy to compute and requires no training. Experiments on two real-world benchmarks show that the proposed approach outperforms state-of-the-art methods in the camera-agnostic scenario. In the setting where the camera is known, MSGP outperforms all statistical methods.

본문 58,995자

본문 펼치기
We present a statistical color constancy method that relies on novel gray pixel detection and mean shift clustering. The method, called Mean Shifted Grey Pixel -MSGP -is compact, easy to compute and requires no training. Experiments on different datasets show that the proposed approach outperforms state-of-the-art methods in the camera-agnostic scenario. In the setting where the camera is known, MSGP outperforms all statistical methods. Introduction The human eye automatically adapts to changes in imaging conditions and illumination of the scenes. Analogously, the ability of making color images look natural regardless of changing illumination is known as color constancy and is an important feature of consumer digital cameras in order to yield visually canonical images. Color constancy is an important step in different computer vision applications, such as fine-grained classification, semantic segmentation, scene rendering and object tracking, among others [1]. Introduction For decades, the classical approachs for color constancy in digital cameras, statistical methods, have relied on the assumption that some global or local statistical properties of the illumination are constant and can therefore be estimated directly from the image [2,3,4,5,6,7,8]. This approach has the advantage of being independent to the acquisition device since the properties of the scene illumination are estimated in a per-image basis. Recently, state-of-the-art methods including convolutional neural networks (CNN), namely learning-based methods [9,10,11,12,13], have consistently outperformed statistical methods when validated in several mainstream benchmarks. We argue that learning-based methods depend on the assumption that the statistical distribution of the illumination in both the training and testing images is similar. In other words, learning-based methods assume that imaging and illumination conditions of a given image can be inferred from previous training examples, thus becoming heavily dependent on the training data [14]. Introduction In order to assess the limitation of color constancy methods to cope with differences between training and testing images, we focus on the Camera-agnostic color constancy setting. For illustration, consider the case when a user retrieves an image yanlin.qian@tut.fi arXiv:1803.08326v3 [cs.CV] 7 Dec 2018 from the unknown camera 1 and wants to color correct it. In this scenario, in which very little is known about the camera or capturing process of the image, color correction must be performed without strong assumptions on the source of the image or imaging device. In this less researched but still important setting, we experimentally show that, in camera-agnostic color constancy, learning-based methods perform poorly compared to statistical methods. As a result, there is a need for approaches that are insensitive to parameters such as the camera or imaging process used to capture the image. Introduction In this paper we propose a new statistical color constancy method. The proposed method, called mean-shifted gray pixel, or MSGP, is a process that detects pixels that are assumed to be gray under neutral illumination. Why gray pixels? Gray or nearly gray pixels are wide spread in indoor and outdoor images [7]. In the process of manufacturing camera, each camera is calibrated to maintain: gray pixels will be rendered gray in linear image (not raw response) under standard neutral illumination. Introduction Considering that gray pixels are informative w.r.t. casting illumination, it is possible to transform the scene illumination estimation task into gray pixel detection. This paper proposes an accurate method for the detection of gray pixels by combining a novel grayness measure with Mean-shift clustering in color space. Introduction Experimental results in camera-agnostic color constancy show that the proposed algorithm outperforms both statistical and learning-based methods of the state-of-theart. Even in the non camera-agnostic scenario, i.e. using k-fold cross validation in the same datasets, the proposed method outperforms other statistical methods and shows a competitive performance when compared to learning-based methods. Previous Related Work Assuming a photometric linear image I captured using a digital camera, with pixels below black level and above saturation level corrected, the simplified imaging formation under one global illumination source can be expressed as [15]: Previous Related Work where I i (x, y) is the measured image color value at spatial location (x, y), L(λ) the wavelength distribution of the global light source, S i (λ) the spectral response of the color sensor, R(x, y, λ) the surface reflectance and λ the wavelength. Under the narrow-band assumption (Von Kries coefficient law [16]), Eq. 1 can be further simplified as (same as [17]): Previous Related Work which shows that the whole captured image I is the element-wise Hadamard product of the white-balanced image W and the illumination L. Previous Related Work The goal of all color constancy methods, both learning-based and statistical methods, is to estimate L, so as to recover W , given I. [9,10,11,12,13,18,19] aim at building a model that relates the captured image I and the sought illumination L from extensive training data. Among the best-performing state-of-the-art approaches, the CCC method discriminatively learns convolutional filters in a 2D log-chroma space [17]. This framework was subsequently accelerated using the Fast Fourier Transform on a chroma torus [20]. Chakrabarti et al. [21] leverage the normalized luminance for illumination prediction by learning a conditional chromaticity distribution. DS-Net [22] and FC 4 Net [23] are two representative methods using deep learning. The former network chooses an estimate from multiple illumination guesses using a two-branch CNN architecture, while the later addresses local estimation ambiguities of patches using a segmentation-like framework. Learningbased methods achieve great success in predicting pre-recorded "ground-truth" illumination color to a fairly high accurate level, but heavily depending on the same cameras being used in both training and testing images (see Sections 3 and 5.2). The Corrected-Moment method [24] can also be considered as a learning-based method as it needs to train a corrected matrix for each dataset. Learning-based Methods Statistical Methods estimate illumination by making some assumptions about the local or global regularity of the illumination and reflectance of the input image. The simplest such method is Gray World [25], that assumes that the global average of reflectance is achromatic. The generalization of this assumption by restricting it to local patches and higher-order gradients has led to some classical and recent statistics-based methods, such as White Patch [2], General Gray World [3], Gray Edge [4], Shades-of-Gray [5] and LSRS [6], among others [8]. The closest works to ours are Xiong et al. [26] and Gray Pixel [7]. Xiong et al. [26] finds gray surfaces based on a special LIS space, but this method is camera-dependent. The Gray Pixel method will be discussed in Section 4. [27,28,29] estimate illumination from the understanding of the physical process of image formation (e.g. the Dichromatic Model), thus being able to model highlights and inter-reflections. Most physics-based methods estimate illumination based on intersection of multiple dichromatic lines, making them work well on toy images and images with only a few surfaces but not very reliable on natural images [29]. The latest physics-based method is [30], which relies on the longest dichromatic line segment assuming Phong reflection model holds and an ambient light exists. Although our method is based on the Dichromatic Model, we classify our approach as statistical since the core of the method is finding gray pixels based on some observed image statistics. We refer readers to [15] for more details about physics-based methods. Physics-based and other Methods The contribution of this paper is two-fold: Physics-based and other Methods -We experimentally demonstrate that, in the camera-agnostic color constancy setting, state-of-the-art learning-based methods are outperformed by statistical methods -We present the Mean-shifted Gray Pixel method, based on local contrast constraints and Mean Shift Clustering, achieving state-of-the-art performance among competing alternatives. Code will be released upon publication. Camera-agnostic Color Constancy For a given camera, noted as C, Eq. 2 can be rewritten as: Camera-agnostic Color Constancy which indicates that both, the captured image I C , the canonical image W C and the illumination L C that we need to estimate, are dependent on the camera type C. W C indicates that in canonical light, the images captured by different cameras of the same scene differ. Camera-agnostic Color Constancy The color constancy problem in learning-based methods can be stated asL C = f (w, I C ), whereL C is the estimated illumination, and f (w, ·) is the mapping to be learned with parameters w. The mapping f (w, ·) can be embodied by various machine learning models or an ensemble of them. If the learning process for a particular dataset is guided by the distance (e.g. angular error) betweenL C and L C , w will undoubtedly be biased by the particular characteristics of the camera C. In other words, the parameters of f (w, ·) will be learned to be "well-performing" on a specific dataset that encompasses one or a few pre-selected cameras. With the massive modeling capability of some machine learning models (e.g. regression trees and deep learning), the camera sensibility function of a bag of cameras can be modeled up to a high degree. In the literature, the validation of color constancy methods is customarily performed using k-fold cross-validation on the same dataset. As a result, this validation process favors learningbased methods and fails to assess their performance for color correction in images from an unknown camera [14]. Camera-agnostic Color Constancy In this work, we define camera-agnostic color constancy as the problem of estimating the illumination L C of a color-biased image I C that has been captured by a camera C of unknown properties. For learning-based methods, this implies that the input image I C has been captured by a camera not previously "seen" in the training process. Therefore, a rigorous validation process of color constancy algorithms should consider both, camera-agnostic and known-camera scenarios. By leveraging publicly available datasets, this can be achieved by training in one dataset and testing in other without overlapping cameras (see Section 5). In contrast to learning-based methods, statistical methods have the advantage of adjusting the model in a per-image basis thus having the potential to implicitly deal with the camera-agnostic problem. Mean-Shifted Gray Pixel The proposed mean-shifted gray pixel algorithm, or MSGP, is built on the assumption that achromatic pixels in the corresponding canonical image can be used to estimate the global illumination. Specifically, achromatic pixels are visually gray in the color corrected image. Yang et al. [7] claimed the mentioned assumption, and experimentally demonstrated the presence of detectable gray pixels in most natural scenes under white light. In this work, we further extend the concept of the Gray Pixel method by means of an adaptive method for the detection gray pixels that combines a new grayness function and mean-shift clustering. Original Gray Pixel (GP) Revisited In this section, we revisited the original Gray Pixel method [7], which is derived from a limited diffuse reflection model. Applying a log transformation to both sides of (2), we have: Original Gray Pixel (GP) Revisited In a small enough local neighborhood, the illumination L can be assumed as uniform under global illumination constrains. As a result, the application of a linear channelwise local contrast operator C{·} (Laplacian of Gaussian, which we will use for the remainder of the paper) on (4) yields: Original Gray Pixel (GP) Revisited Eq. (5) indicates a well-known observation: the casting illumination is irrelevant to the channel-wise local contrast of a small local neighborhood [31]. It also means that regions with no contrast are useless for obtaining illumination cues. Following [7], with balanced R, G and B responses, the following condition must be met by gray pixels: Original Gray Pixel (GP) Revisited In practice, (6) does not hold strictly. As a result, it is necessary to propose a "grayness" measure in order to detect nearly gray pixels. For the sake of simplicity, let us define the local contrast of a log-transformed image pixel located at (x, y) as [7], the grayness measure of a pixel, G(x, y), is defined as: Original Gray Pixel (GP) Revisited where∆(x, y) is the average of channels R, G and B. It is claimed that the smaller G(x, y) is, the more gray a pixel is under white light. Then some post-processing steps are applied to weaken dark pixels (luminance as dominator) and isolated pixels (local averaging), for which we refer readers to the original GP [7]. Original Gray Pixel (GP) Revisited A major drawback of Eq. 7 is that the grayness estimate depends on the luminance of the pixels. Specifically, the effect of∆ results in gray pixels having different grayness values due to differences in luminance. Alternatively, we propose that grayness should only depend on chromaticity. Therefore, in the next section, we will introduce a new grayness function to replace Eq. 7. Grayness Function We propose an ideal grayness function G(·) ∈ [0, 1] where 0 denotes pure gray of a pixel color. Our grayness function should comply with the following properties: Grayness Function is invariant to the luminance (sum of RGB values). Property 2 G(·) outputs monotonically decreasing value for increasing visual grayness, e.g. from red to white. Property 3 Pure gray pixels (on the black-to-white line) should be have value 0. In addition the three above-mentioned properties, it is also desirable that the output space of the grayness function be normalized (so that no subsequent normalization is required), as well as having a physical meaning so that it can be used for other computer vision tasks. Alternatively to the grayness measure proposed in [7], we propose a new grayness measure based on the angular error function that complies with all these properties: Property 3 where Property 3 ] is the RGB vector in location (x, y), g is the gray light reference vector [g r , g g , g b ] , and · n refers to the n norm. Our motivation behind Eq. 8 is that, even in the color-biased scenario, it is possible to assume that all gray colors captured by the same camera will have balanced R, G, B components, regardless of their luminance level. As a result, it is possible to assess their grayness level by measuring the angular error with respect to a reference gray value. Notice that, in general, the gray reference vector g can have spatially-varying values in order to adjust for changes in the illumination of the scene. In this work, however, we assume that the global illumination source remains constant in the scene and adopt the canonical gray value as reference: g = [1, 1, 1] . In this case, Eq. 8 can be further simplified as: Property 3 Eq. 9 measures how gray a pixel is, using the angular distance from the local contrast vector to the gray light g, thus meeting Properties 1 and 2. When the point (x, y) is completely gray, G(x, y) is 0 and increases monotonically with decreasing level of grayness, thus meeting Property 3. In addition, the output ranges from 0 • to cos −1 ( 1 √ 3 ) for each image, thus being normalized. Property 3 Empirical Evidence -The next question is whether this new grayness function brings different ordering of pixels according to their grayness levels. To answer this, we replace Eq. 7 with Eq. 8 in the original GP algorithm and estimate illumination in two mainstream color constancy benchmarks where GP is evaluated. Table 1 shows the performance improvement by a large margin (0.6 • reduction in median error for SFU Color Checker) when we use the proposed grayness measure Eq. 8. Results on the SFU Indoor dataset do not differ much, arguably because the preliminary gray pixels given by GP are accurate enough under the well-controlled lighting condition. For the results shown in Table 1, the top 0.1% pixels with G values are chosen as gray pixels, as recommended by [7]. The local contrast operator C{·} is the Laplacian of Gaussian. Property 3 Here we mathematically analyze the connection between the grayness function in Eq. 7 and the proposed grayness measure in Eq. 9. To avoid readers' confusion, we term the original grayness measure in Eq. 7 as G σ (x, y) and the proposed grayness function of Eq. 8 as G θ (x, y). In the sequel, we demonstrate that G σ and G θ are related by: Property 3 where γ(x, y) is a luminance-dependent term. Property 3 In order to demonstrate the relationship in Eq. 10, we approximate G θ as follows 2 : Property 3 It can be readily shown that Eq. 11 is an approximation of the same order of Eq. 9 in the interval [0, 1]. With this approximation, G θ and G σ can be rewritten as: Property 3 where α = ∆ 2 and β = 1 3 ∆ 1 . Putting a multiplier α(α + √ 3β) to both sides of Eq. 13 yields: Property 3 Finally, combing Eq. 12 and 14 we obtain the sought relationship: Property 3 where γ 2 equals to α(α + √ 3β)/3υ. From Eq. 15 it is clear that the original grayness function G σ (x, y) contains not only the real grayness -cosine distance G θ (x, y) from the gray light -but also introduces a non-linear luminance-dependent term γ(x, y), which adds noise to the grayness estimate. As a result, two points with same values of G θ (x, y) but different luminance values will yield different values of G σ (x, y). In contrast, the proposed grayness function G θ (x, y) is more robust to changes in luminance. Property 3 After some post-processing steps (e.g. local averaging and normalization by image intensity), a small percentage of pixels (N %) with the highest grayness values (lowest G) are chosen and averaged to be the illumination estimate. However, as it will be shown in the next section, the chosen gray pixels may still contain a number of colorful pixels. As a result, we will apply Mean Shift clustering in 3D RGB space in order to remove spurious color pixels. In the experiments in the remaining of this paper, we will use the new grayness function unless indicated otherwise. Mean Shift Purification Let S be the set of preselected N % pixels according to their grayness levels. Ideally, S should only contain pure-gray pixels. However, in fact S may contain a number of colorful pixels that need to be removed before estimating the global illumination of the scene. Mean Shift Purification In order to remove color pixels from S, we note that, for a color-biased image I, all the pure-gray pixels should be contained in the illumination direction [L r , L g , L b ]. This is equivalent to having all the pixels aligned towards the gray-light vector g = [1, 1, 1] in the canonical image. For illustration purposes, Fig. 1j shows all the pixels of the canonical image of Fig. 1g in RGB space and Fig. 1k shows the corresponding set S of pre-selected gray-pixels. From Fig. 1k, it is clear that S contains both color and gray pixels. As predicted by our assumption, most true-gray pixels are aligned towards one single direction. In particular, the main direction of the densest pixel cloud indicates the illumination of the scene. Mean Shift Purification In this paper, we use mean shift (MS) clustering [32,33] with a hybrid distance to seek for the dark-to-bright elongated cluster which contains the most pixels in S. MS is a non-parametric space analysis algorithm, treating the feature space as a probability density function and seeking for the modes. In this work, the density of each pixel p ∈ S in RGB space is calculated as a function of the bandwidth h: Mean Shift Purification where n the number of pixels in S, and the kernel density function K(·) is defined as: Mean Shift Purification with I(p) = [I r , I g , I b ] being the vector with RGB values of pixel p, D(p, p i ) is the defined hybrid distance computed as the product of the euclidean and angular distances I(p) − I(p i ) 2 · ∠{I(p), I(p i )}, and ∠{·} is the angle between two vectors. Finally, the centroid corresponding to the mode with highest density is used for the computation of the illumination estimate: Mean Shift Purification The effect of mean shift clustering on the detection of gray pixels is illustrated in Fig. 1. Comparing Figs. 1h and 1i, it is clear how the mean-shift clustering, simply and effectively, allows for the detection and removal of color pixels in the initial set S. It is worthy to mention that, in some cases, there is almost no colored pixels in S. Fortunately, the performance will not suffer from clustering, as MS gracefully generates only one cluster which gives us a reliable estimate. As a result, there is no need to condition when to apply clustering. The mean-shifted gray pixel algorithm (MSGP) is summarized in Algorithm 1. The proposed method depends only in two parameters: the percentage of pixels chosen from their grayness values, N %, and the clustering bandwidth h of Eq. 16. The selection of these parameters and their effect on the performance of the proposed MSGP algorithm are presented in section 5.3. Experiments Experiments were conducted in two widely known, publicly available datasets collected for the purpose of evaluation of color constancy methods: -Gehler-Shi Dataset [34]: 568 high dynamic linear images, 2 cameras 3 . Experiments -NUS 8-Camera Dataset [8]: 1736 high dynamic linear images, 8 cameras 4 . The parameters of the proposed MSGP algorithm were selected as follows: the local contrast operator used in Eq. 9 was the Laplacian of Gaussian with a range of 5 pixels. The bandwidth for MS clustering was set to h = 0.001. The percentage of pixels chosen for the generation of S was set to N = 0.1%. These parameters were selected based on preliminary experiments (see Section 5.3) and remained fixed for all the experiments. Experiments In order to allow for a rigorous comparison with state-of-the-art methods, we have considered two scenarios. The camera-agnostic setting and the camera-known setting. In the agnostic-camera setting, learning-based algorithms are trained in one dataset Fig. 1: Detection of gray pixels. After correction using ground-truth illumination, ideal gray pixel should looks purely gray. (a,g) Input image, (b,h) Initial gray pixels detected. (c,i) Purified gray pixels after the Mean Shift step. (d-f, j-l) color histograms of (a-c). Experiments Comparing (e) with (f), (j) with (l), it is clear that Mean Shift helps to discard color pixels in (e) that are not aligned with the main illumination vector. For visualization purposes, the luminance of (b,c) is multiplied by a constant 4. Experiments (e.g., Gehler-Shi) and tested on the other. This allows for testing the performance of the algorithm in cameras not previously "seen" in the training process. The camera-known setting corresponds to the typical 3-fold cross validation used in the literature, in which learning-based methods are trained and validated in the same dataset. Obtained results are summarized in Table 2 and discussed in Sections 5.2 and 5.1. Camera-known Setting Camera-known setting (also termed as single-dataset setting) is the most common setting in related works, allowing extensive pre-training using a k-fold validation for learningbased methods. The results for this setting are summarized in table 2b. Among all the compared methods, FFCC yields the best overall performance in both datasets. It is important to remark that, cross validation makes no difference in the performance of statistical methods. Therefore, in order to avoid repetition, the performance of competing statistical methods is not shown in this table (see next section). Remarkably, it is clear that, even in the known-camera setting, the proposed algorithm outperforms several learning-based methods (from Gamut [10] to the Exemplar-based method [13]) without extensive training and parameter tuning. Camera-agnostic Setting In order to allow for a fair comparison in the camera-agnostic scenario, learning-based methods should be re-trained for evaluation in the same conditions as statistical methods. Several state-of-the-art CNN-based methods are not publicly available. In this work, we were able to re-run the Bayesian method [11], Chakrabarti et al. [21], FFCC [20], and the method by Cheng et al. 2015 [40], using the codes provided by the original authors. Note that this list of methods includes FFCC, which showed the best overall performance in the camera-known setting. We train on one dataset and test on the other one. Both datasets share no common cameras, thus meeting our requirement of being "camera-agnostic". For the results reported in this section, we use the best or final setting for each method: Bayes (GT) for Bayesian; Empirical and End-to-End training for Chakrabarti et al. [21]; 30 regression trees for Cheng et al.; full image resolution and 2 channels for FFCC 5 . Obtained results are summarized in Table 2a. Camera-agnostic Setting Obtained results are summarized in Table 2a. From this table, it is clear that the proposed MSGP algorithm outperforms both learning-based and statistical methods. Except FFCC, selected learning-based methods perform relatively worse in cameraagnostic setting, as compared to statistical methods. Due to their nature, it is not surprising that learning-based methods degrade in their performance in the camera-agnostic scenario. However, the fact that learning-based methods are outperformed by statistical methods is an interesting finding. On one side, if we use learning-based methods trained for a given dataset or "a bag of camera models", we may fail in the cameraagnostic setting. In contrast, in the both camera-agnostic/known setting, the proposed statistical method provides stable performance. For (a,b) we retrieve the results of the related works in the following order: 1) the cited paper, 2) Table [1] and Table [2] from Barron et al. [20,17] considered to be up-to-date and comprehensive, 3) the color constancy benchmarking website [35]. We left dash on unreported results. In (b) results of learning-based methods worse than ours are marked in gray. The training time and testing time are reported in seconds, averagely per image, if reported in the original paper. Camera-agnostic Setting (a) Camera-agnostic setting 1 For Correct-Moment [24] we report reproduced and more detailed results by [17], which slightly differs with the original results: mean: 3.5, median: 2.6 for 19 colors and mean: 2.8, median: 2.0 for 19 edges on Gehler-Shi Dataset. 2 We rerun Grey Pixel (edge) on NUS dataset. * We mark Exemplar-based method with asterisk as it is trained and tested on a uncorrected-blacklevel dataset. Algorithm parameters The role of bandwidth h. The bandwidth h determines the domain size where Mean Shift computes the pixel divergence. Here we evaluate variants of the proposed method by changing h to be 1e−4, 1e−3 and 1e−2. Table 3 shows that the bandwidth 1e−3 gives a good trade-off between mean and median error on two datasets. For reference purposes, Table 3 also includes performance results obtained when the distance function in Eq. 17 uses only angular information in D(·). Clustering Algorithm We compare two clustering methods, Mean Shift and K-means. Algorithm parameters Here we evaluate variants of K-means by changing the number of clusters K to 2, 5 and 9. Table 3 shows that, in general, MS gives better results. This can be attributed to the fact that Mean Shift is more robust to outliers than K-means. Among all K-means invariants, the 2-cluster setting performs best. This suggests that S usually contains 1 − 2 elongated clusters. Limitations and Conclusions Our method relies on gray pixels and their statistics for illumination estimation. Therefore, in some extreme cases, when there are no detectable gray pixels or there are gray pixels representing two illuminations, our method fails. In Figure 2, two no-gray-pixel examples and two double-illumination examples are shown. In such cases, our method suffers in the absence of gray pixels or a biased group of gray pixels representing more than one illumination source. Cheng et al. [41] claimed that in SFU Color Checker Dataset [34], there are 66 two-illumination images (image list released). It is worthy to mention that the images where we fail overlap largely with this two-illumination list. Limitations and Conclusions In this paper, we presented a statistical method for tackling the problem of color constancy. The proposed method relies on gray pixel detection and mean shift clustering in order to estimate the illumination of the scene based on the statistical properties of the gray pixels of the input image. In the camera-agnostic scenario, in which color constancy is to be applied to images captured with unknown cameras, the proposed method outperforms both learning-based and statistical state-of-the-arts. The proposed method is easy to implement, training-free, and depends only on two parameters, namely the percentage of gray pixels N % and the Mean Shift bandwidth h. With our method, processing a 2000 × 1500 linear image takes about 1.32 seconds with unoptimized MATLAB code running in a CPU Intel i7 2.5 GHz. Introduction The human eye automatically adapts to changes in imaging conditions and illumination of the scenes. Analogously, the ability of making color images look natural regardless of changing illumination is known as color constancy and is an important feature of consumer digital cameras in order to yield visually canonical images. Color constancy is an important step in different computer vision applications, such as fine-grained classification, semantic segmentation, scene rendering and object tracking, among others [1]. Introduction For decades, the classical approachs for color constancy in digital cameras, statistical methods, have relied on the assumption that some global or local statistical properties of the illumination are constant and can therefore be estimated directly from the image [2,3,4,5,6,7,8]. This approach has the advantage of being independent to the acquisition device since the properties of the scene illumination are estimated in a per-image basis. Recently, state-of-the-art methods including convolutional neural networks (CNN), namely learning-based methods [9,10,11,12,13], have consistently outperformed statistical methods when validated in several mainstream benchmarks. We argue that learning-based methods depend on the assumption that the statistical distribution of the illumination in both the training and testing images is similar. In other words, learning-based methods assume that imaging and illumination conditions of a given image can be inferred from previous training examples, thus becoming heavily dependent on the training data [14]. Introduction In order to assess the limitation of color constancy methods to cope with differences between training and testing images, we focus on the Camera-agnostic color constancy setting. For illustration, consider the case when a user retrieves an image yanlin.qian@tut.fi arXiv:1803.08326v3 [cs.CV] 7 Dec 2018 from the unknown camera 1 and wants to color correct it. In this scenario, in which very little is known about the camera or capturing process of the image, color correction must be performed without strong assumptions on the source of the image or imaging device. In this less researched but still important setting, we experimentally show that, in camera-agnostic color constancy, learning-based methods perform poorly compared to statistical methods. As a result, there is a need for approaches that are insensitive to parameters such as the camera or imaging process used to capture the image. Introduction In this paper we propose a new statistical color constancy method. The proposed method, called mean-shifted gray pixel, or MSGP, is a process that detects pixels that are assumed to be gray under neutral illumination. Why gray pixels? Gray or nearly gray pixels are wide spread in indoor and outdoor images [7]. In the process of manufacturing camera, each camera is calibrated to maintain: gray pixels will be rendered gray in linear image (not raw response) under standard neutral illumination. Introduction Considering that gray pixels are informative w.r.t. casting illumination, it is possible to transform the scene illumination estimation task into gray pixel detection. This paper proposes an accurate method for the detection of gray pixels by combining a novel grayness measure with Mean-shift clustering in color space. Introduction Experimental results in camera-agnostic color constancy show that the proposed algorithm outperforms both statistical and learning-based methods of the state-of-theart. Even in the non camera-agnostic scenario, i.e. using k-fold cross validation in the same datasets, the proposed method outperforms other statistical methods and shows a competitive performance when compared to learning-based methods. Previous Related Work Assuming a photometric linear image I captured using a digital camera, with pixels below black level and above saturation level corrected, the simplified imaging formation under one global illumination source can be expressed as [15]: Previous Related Work where I i (x, y) is the measured image color value at spatial location (x, y), L(λ) the wavelength distribution of the global light source, S i (λ) the spectral response of the color sensor, R(x, y, λ) the surface reflectance and λ the wavelength. Under the narrow-band assumption (Von Kries coefficient law [16]), Eq. 1 can be further simplified as (same as [17]): Previous Related Work which shows that the whole captured image I is the element-wise Hadamard product of the white-balanced image W and the illumination L. Previous Related Work The goal of all color constancy methods, both learning-based and statistical methods, is to estimate L, so as to recover W , given I. [9,10,11,12,13,18,19] aim at building a model that relates the captured image I and the sought illumination L from extensive training data. Among the best-performing state-of-the-art approaches, the CCC method discriminatively learns convolutional filters in a 2D log-chroma space [17]. This framework was subsequently accelerated using the Fast Fourier Transform on a chroma torus [20]. Chakrabarti et al. [21] leverage the normalized luminance for illumination prediction by learning a conditional chromaticity distribution. DS-Net [22] and FC 4 Net [23] are two representative methods using deep learning. The former network chooses an estimate from multiple illumination guesses using a two-branch CNN architecture, while the later addresses local estimation ambiguities of patches using a segmentation-like framework. Learningbased methods achieve great success in predicting pre-recorded "ground-truth" illumination color to a fairly high accurate level, but heavily depending on the same cameras being used in both training and testing images (see Sections 3 and 5.2). The Corrected-Moment method [24] can also be considered as a learning-based method as it needs to train a corrected matrix for each dataset. Learning-based Methods Statistical Methods estimate illumination by making some assumptions about the local or global regularity of the illumination and reflectance of the input image. The simplest such method is Gray World [25], that assumes that the global average of reflectance is achromatic. The generalization of this assumption by restricting it to local patches and higher-order gradients has led to some classical and recent statistics-based methods, such as White Patch [2], General Gray World [3], Gray Edge [4], Shades-of-Gray [5] and LSRS [6], among others [8]. The closest works to ours are Xiong et al. [26] and Gray Pixel [7]. Xiong et al. [26] finds gray surfaces based on a special LIS space, but this method is camera-dependent. The Gray Pixel method will be discussed in Section 4. [27,28,29] estimate illumination from the understanding of the physical process of image formation (e.g. the Dichromatic Model), thus being able to model highlights and inter-reflections. Most physics-based methods estimate illumination based on intersection of multiple dichromatic lines, making them work well on toy images and images with only a few surfaces but not very reliable on natural images [29]. The latest physics-based method is [30], which relies on the longest dichromatic line segment assuming Phong reflection model holds and an ambient light exists. Although our method is based on the Dichromatic Model, we classify our approach as statistical since the core of the method is finding gray pixels based on some observed image statistics. We refer readers to [15] for more details about physics-based methods. Physics-based and other Methods The contribution of this paper is two-fold: Physics-based and other Methods -We experimentally demonstrate that, in the camera-agnostic color constancy setting, state-of-the-art learning-based methods are outperformed by statistical methods -We present the Mean-shifted Gray Pixel method, based on local contrast constraints and Mean Shift Clustering, achieving state-of-the-art performance among competing alternatives. Code will be released upon publication. Camera-agnostic Color Constancy For a given camera, noted as C, Eq. 2 can be rewritten as: Camera-agnostic Color Constancy which indicates that both, the captured image I C , the canonical image W C and the illumination L C that we need to estimate, are dependent on the camera type C. W C indicates that in canonical light, the images captured by different cameras of the same scene differ. Camera-agnostic Color Constancy The color constancy problem in learning-based methods can be stated asL C = f (w, I C ), whereL C is the estimated illumination, and f (w, ·) is the mapping to be learned with parameters w. The mapping f (w, ·) can be embodied by various machine learning models or an ensemble of them. If the learning process for a particular dataset is guided by the distance (e.g. angular error) betweenL C and L C , w will undoubtedly be biased by the particular characteristics of the camera C. In other words, the parameters of f (w, ·) will be learned to be "well-performing" on a specific dataset that encompasses one or a few pre-selected cameras. With the massive modeling capability of some machine learning models (e.g. regression trees and deep learning), the camera sensibility function of a bag of cameras can be modeled up to a high degree. In the literature, the validation of color constancy methods is customarily performed using k-fold cross-validation on the same dataset. As a result, this validation process favors learningbased methods and fails to assess their performance for color correction in images from an unknown camera [14]. Camera-agnostic Color Constancy In this work, we define camera-agnostic color constancy as the problem of estimating the illumination L C of a color-biased image I C that has been captured by a camera C of unknown properties. For learning-based methods, this implies that the input image I C has been captured by a camera not previously "seen" in the training process. Therefore, a rigorous validation process of color constancy algorithms should consider both, camera-agnostic and known-camera scenarios. By leveraging publicly available datasets, this can be achieved by training in one dataset and testing in other without overlapping cameras (see Section 5). In contrast to learning-based methods, statistical methods have the advantage of adjusting the model in a per-image basis thus having the potential to implicitly deal with the camera-agnostic problem. Mean-Shifted Gray Pixel The proposed mean-shifted gray pixel algorithm, or MSGP, is built on the assumption that achromatic pixels in the corresponding canonical image can be used to estimate the global illumination. Specifically, achromatic pixels are visually gray in the color corrected image. Yang et al. [7] claimed the mentioned assumption, and experimentally demonstrated the presence of detectable gray pixels in most natural scenes under white light. In this work, we further extend the concept of the Gray Pixel method by means of an adaptive method for the detection gray pixels that combines a new grayness function and mean-shift clustering. Original Gray Pixel (GP) Revisited In this section, we revisited the original Gray Pixel method [7], which is derived from a limited diffuse reflection model. Applying a log transformation to both sides of (2), we have: Original Gray Pixel (GP) Revisited In a small enough local neighborhood, the illumination L can be assumed as uniform under global illumination constrains. As a result, the application of a linear channelwise local contrast operator C{·} (Laplacian of Gaussian, which we will use for the remainder of the paper) on (4) yields: Original Gray Pixel (GP) Revisited Eq. (5) indicates a well-known observation: the casting illumination is irrelevant to the channel-wise local contrast of a small local neighborhood [31]. It also means that regions with no contrast are useless for obtaining illumination cues. Following [7], with balanced R, G and B responses, the following condition must be met by gray pixels: Original Gray Pixel (GP) Revisited In practice, (6) does not hold strictly. As a result, it is necessary to propose a "grayness" measure in order to detect nearly gray pixels. For the sake of simplicity, let us define the local contrast of a log-transformed image pixel located at (x, y) as [7], the grayness measure of a pixel, G(x, y), is defined as: Original Gray Pixel (GP) Revisited where∆(x, y) is the average of channels R, G and B. It is claimed that the smaller G(x, y) is, the more gray a pixel is under white light. Then some post-processing steps are applied to weaken dark pixels (luminance as dominator) and isolated pixels (local averaging), for which we refer readers to the original GP [7]. Original Gray Pixel (GP) Revisited A major drawback of Eq. 7 is that the grayness estimate depends on the luminance of the pixels. Specifically, the effect of∆ results in gray pixels having different grayness values due to differences in luminance. Alternatively, we propose that grayness should only depend on chromaticity. Therefore, in the next section, we will introduce a new grayness function to replace Eq. 7. Grayness Function We propose an ideal grayness function G(·) ∈ [0, 1] where 0 denotes pure gray of a pixel color. Our grayness function should comply with the following properties: Grayness Function is invariant to the luminance (sum of RGB values). Property 2 G(·) outputs monotonically decreasing value for increasing visual grayness, e.g. from red to white. Property 3 Pure gray pixels (on the black-to-white line) should be have value 0. In addition the three above-mentioned properties, it is also desirable that the output space of the grayness function be normalized (so that no subsequent normalization is required), as well as having a physical meaning so that it can be used for other computer vision tasks. Alternatively to the grayness measure proposed in [7], we propose a new grayness measure based on the angular error function that complies with all these properties: Property 3 where Property 3 ] is the RGB vector in location (x, y), g is the gray light reference vector [g r , g g , g b ] , and · n refers to the n norm. Our motivation behind Eq. 8 is that, even in the color-biased scenario, it is possible to assume that all gray colors captured by the same camera will have balanced R, G, B components, regardless of their luminance level. As a result, it is possible to assess their grayness level by measuring the angular error with respect to a reference gray value. Notice that, in general, the gray reference vector g can have spatially-varying values in order to adjust for changes in the illumination of the scene. In this work, however, we assume that the global illumination source remains constant in the scene and adopt the canonical gray value as reference: g = [1, 1, 1] . In this case, Eq. 8 can be further simplified as: Property 3 Eq. 9 measures how gray a pixel is, using the angular distance from the local contrast vector to the gray light g, thus meeting Properties 1 and 2. When the point (x, y) is completely gray, G(x, y) is 0 and increases monotonically with decreasing level of grayness, thus meeting Property 3. In addition, the output ranges from 0 • to cos −1 ( 1 √ 3 ) for each image, thus being normalized. Property 3 Empirical Evidence -The next question is whether this new grayness function brings different ordering of pixels according to their grayness levels. To answer this, we replace Eq. 7 with Eq. 8 in the original GP algorithm and estimate illumination in two mainstream color constancy benchmarks where GP is evaluated. Table 1 shows the performance improvement by a large margin (0.6 • reduction in median error for SFU Color Checker) when we use the proposed grayness measure Eq. 8. Results on the SFU Indoor dataset do not differ much, arguably because the preliminary gray pixels given by GP are accurate enough under the well-controlled lighting condition. For the results shown in Table 1, the top 0.1% pixels with G values are chosen as gray pixels, as recommended by [7]. The local contrast operator C{·} is the Laplacian of Gaussian. Property 3 Here we mathematically analyze the connection between the grayness function in Eq. 7 and the proposed grayness measure in Eq. 9. To avoid readers' confusion, we term the original grayness measure in Eq. 7 as G σ (x, y) and the proposed grayness function of Eq. 8 as G θ (x, y). In the sequel, we demonstrate that G σ and G θ are related by: Property 3 where γ(x, y) is a luminance-dependent term. Property 3 In order to demonstrate the relationship in Eq. 10, we approximate G θ as follows 2 : Property 3 It can be readily shown that Eq. 11 is an approximation of the same order of Eq. 9 in the interval [0, 1]. With this approximation, G θ and G σ can be rewritten as: Property 3 where α = ∆ 2 and β = 1 3 ∆ 1 . Putting a multiplier α(α + √ 3β) to both sides of Eq. 13 yields: Property 3 Finally, combing Eq. 12 and 14 we obtain the sought relationship: Property 3 where γ 2 equals to α(α + √ 3β)/3υ. From Eq. 15 it is clear that the original grayness function G σ (x, y) contains not only the real grayness -cosine distance G θ (x, y) from the gray light -but also introduces a non-linear luminance-dependent term γ(x, y), which adds noise to the grayness estimate. As a result, two points with same values of G θ (x, y) but different luminance values will yield different values of G σ (x, y). In contrast, the proposed grayness function G θ (x, y) is more robust to changes in luminance. Property 3 After some post-processing steps (e.g. local averaging and normalization by image intensity), a small percentage of pixels (N %) with the highest grayness values (lowest G) are chosen and averaged to be the illumination estimate. However, as it will be shown in the next section, the chosen gray pixels may still contain a number of colorful pixels. As a result, we will apply Mean Shift clustering in 3D RGB space in order to remove spurious color pixels. In the experiments in the remaining of this paper, we will use the new grayness function unless indicated otherwise. Mean Shift Purification Let S be the set of preselected N % pixels according to their grayness levels. Ideally, S should only contain pure-gray pixels. However, in fact S may contain a number of colorful pixels that need to be removed before estimating the global illumination of the scene. Mean Shift Purification In order to remove color pixels from S, we note that, for a color-biased image I, all the pure-gray pixels should be contained in the illumination direction [L r , L g , L b ]. This is equivalent to having all the pixels aligned towards the gray-light vector g = [1, 1, 1] in the canonical image. For illustration purposes, Fig. 1j shows all the pixels of the canonical image of Fig. 1g in RGB space and Fig. 1k shows the corresponding set S of pre-selected gray-pixels. From Fig. 1k, it is clear that S contains both color and gray pixels. As predicted by our assumption, most true-gray pixels are aligned towards one single direction. In particular, the main direction of the densest pixel cloud indicates the illumination of the scene. Mean Shift Purification In this paper, we use mean shift (MS) clustering [32,33] with a hybrid distance to seek for the dark-to-bright elongated cluster which contains the most pixels in S. MS is a non-parametric space analysis algorithm, treating the feature space as a probability density function and seeking for the modes. In this work, the density of each pixel p ∈ S in RGB space is calculated as a function of the bandwidth h: Mean Shift Purification where n the number of pixels in S, and the kernel density function K(·) is defined as: Mean Shift Purification with I(p) = [I r , I g , I b ] being the vector with RGB values of pixel p, D(p, p i ) is the defined hybrid distance computed as the product of the euclidean and angular distances I(p) − I(p i ) 2 · ∠{I(p), I(p i )}, and ∠{·} is the angle between two vectors. Finally, the centroid corresponding to the mode with highest density is used for the computation of the illumination estimate: Mean Shift Purification The effect of mean shift clustering on the detection of gray pixels is illustrated in Fig. 1. Comparing Figs. 1h and 1i, it is clear how the mean-shift clustering, simply and effectively, allows for the detection and removal of color pixels in the initial set S. It is worthy to mention that, in some cases, there is almost no colored pixels in S. Fortunately, the performance will not suffer from clustering, as MS gracefully generates only one cluster which gives us a reliable estimate. As a result, there is no need to condition when to apply clustering. The mean-shifted gray pixel algorithm (MSGP) is summarized in Algorithm 1. The proposed method depends only in two parameters: the percentage of pixels chosen from their grayness values, N %, and the clustering bandwidth h of Eq. 16. The selection of these parameters and their effect on the performance of the proposed MSGP algorithm are presented in section 5.3. Experiments Experiments were conducted in two widely known, publicly available datasets collected for the purpose of evaluation of color constancy methods: -Gehler-Shi Dataset [34]: 568 high dynamic linear images, 2 cameras 3 . Experiments -NUS 8-Camera Dataset [8]: 1736 high dynamic linear images, 8 cameras 4 . The parameters of the proposed MSGP algorithm were selected as follows: the local contrast operator used in Eq. 9 was the Laplacian of Gaussian with a range of 5 pixels. The bandwidth for MS clustering was set to h = 0.001. The percentage of pixels chosen for the generation of S was set to N = 0.1%. These parameters were selected based on preliminary experiments (see Section 5.3) and remained fixed for all the experiments. Experiments In order to allow for a rigorous comparison with state-of-the-art methods, we have considered two scenarios. The camera-agnostic setting and the camera-known setting. In the agnostic-camera setting, learning-based algorithms are trained in one dataset Fig. 1: Detection of gray pixels. After correction using ground-truth illumination, ideal gray pixel should looks purely gray. (a,g) Input image, (b,h) Initial gray pixels detected. (c,i) Purified gray pixels after the Mean Shift step. (d-f, j-l) color histograms of (a-c). Experiments Comparing (e) with (f), (j) with (l), it is clear that Mean Shift helps to discard color pixels in (e) that are not aligned with the main illumination vector. For visualization purposes, the luminance of (b,c) is multiplied by a constant 4. Experiments (e.g., Gehler-Shi) and tested on the other. This allows for testing the performance of the algorithm in cameras not previously "seen" in the training process. The camera-known setting corresponds to the typical 3-fold cross validation used in the literature, in which learning-based methods are trained and validated in the same dataset. Obtained results are summarized in Table 2 and discussed in Sections 5.2 and 5.1. Camera-known Setting Camera-known setting (also termed as single-dataset setting) is the most common setting in related works, allowing extensive pre-training using a k-fold validation for learningbased methods. The results for this setting are summarized in table 2b. Among all the compared methods, FFCC yields the best overall performance in both datasets. It is important to remark that, cross validation makes no difference in the performance of statistical methods. Therefore, in order to avoid repetition, the performance of competing statistical methods is not shown in this table (see next section). Remarkably, it is clear that, even in the known-camera setting, the proposed algorithm outperforms several learning-based methods (from Gamut [10] to the Exemplar-based method [13]) without extensive training and parameter tuning. Camera-agnostic Setting In order to allow for a fair comparison in the camera-agnostic scenario, learning-based methods should be re-trained for evaluation in the same conditions as statistical methods. Several state-of-the-art CNN-based methods are not publicly available. In this work, we were able to re-run the Bayesian method [11], Chakrabarti et al. [21], FFCC [20], and the method by Cheng et al. 2015 [40], using the codes provided by the original authors. Note that this list of methods includes FFCC, which showed the best overall performance in the camera-known setting. We train on one dataset and test on the other one. Both datasets share no common cameras, thus meeting our requirement of being "camera-agnostic". For the results reported in this section, we use the best or final setting for each method: Bayes (GT) for Bayesian; Empirical and End-to-End training for Chakrabarti et al. [21]; 30 regression trees for Cheng et al.; full image resolution and 2 channels for FFCC 5 . Obtained results are summarized in Table 2a. Camera-agnostic Setting Obtained results are summarized in Table 2a. From this table, it is clear that the proposed MSGP algorithm outperforms both learning-based and statistical methods. Except FFCC, selected learning-based methods perform relatively worse in cameraagnostic setting, as compared to statistical methods. Due to their nature, it is not surprising that learning-based methods degrade in their performance in the camera-agnostic scenario. However, the fact that learning-based methods are outperformed by statistical methods is an interesting finding. On one side, if we use learning-based methods trained for a given dataset or "a bag of camera models", we may fail in the cameraagnostic setting. In contrast, in the both camera-agnostic/known setting, the proposed statistical method provides stable performance. For (a,b) we retrieve the results of the related works in the following order: 1) the cited paper, 2) Table [1] and Table [2] from Barron et al. [20,17] considered to be up-to-date and comprehensive, 3) the color constancy benchmarking website [35]. We left dash on unreported results. In (b) results of learning-based methods worse than ours are marked in gray. The training time and testing time are reported in seconds, averagely per image, if reported in the original paper. Camera-agnostic Setting (a) Camera-agnostic setting 1 For Correct-Moment [24] we report reproduced and more detailed results by [17], which slightly differs with the original results: mean: 3.5, median: 2.6 for 19 colors and mean: 2.8, median: 2.0 for 19 edges on Gehler-Shi Dataset. 2 We rerun Grey Pixel (edge) on NUS dataset. * We mark Exemplar-based method with asterisk as it is trained and tested on a uncorrected-blacklevel dataset. Algorithm parameters The role of bandwidth h. The bandwidth h determines the domain size where Mean Shift computes the pixel divergence. Here we evaluate variants of the proposed method by changing h to be 1e−4, 1e−3 and 1e−2. Table 3 shows that the bandwidth 1e−3 gives a good trade-off between mean and median error on two datasets. For reference purposes, Table 3 also includes performance results obtained when the distance function in Eq. 17 uses only angular information in D(·). Clustering Algorithm We compare two clustering methods, Mean Shift and K-means. Algorithm parameters Here we evaluate variants of K-means by changing the number of clusters K to 2, 5 and 9. Table 3 shows that, in general, MS gives better results. This can be attributed to the fact that Mean Shift is more robust to outliers than K-means. Among all K-means invariants, the 2-cluster setting performs best. This suggests that S usually contains 1 − 2 elongated clusters. Limitations and Conclusions Our method relies on gray pixels and their statistics for illumination estimation. Therefore, in some extreme cases, when there are no detectable gray pixels or there are gray pixels representing two illuminations, our method fails. In Figure 2, two no-gray-pixel examples and two double-illumination examples are shown. In such cases, our method suffers in the absence of gray pixels or a biased group of gray pixels representing more than one illumination source. Cheng et al. [41] claimed that in SFU Color Checker Dataset [34], there are 66 two-illumination images (image list released). It is worthy to mention that the images where we fail overlap largely with this two-illumination list. Limitations and Conclusions In this paper, we presented a statistical method for tackling the problem of color constancy. The proposed method relies on gray pixel detection and mean shift clustering in order to estimate the illumination of the scene based on the statistical properties of the gray pixels of the input image. In the camera-agnostic scenario, in which color constancy is to be applied to images captured with unknown cameras, the proposed method outperforms both learning-based and statistical state-of-the-arts. The proposed method is easy to implement, training-free, and depends only on two parameters, namely the percentage of gray pixels N % and the Mean Shift bandwidth h. With our method, processing a 2000 × 1500 linear image takes about 1.32 seconds with unoptimized MATLAB code running in a CPU Intel i7 2.5 GHz.

섹션 본문 117문단 · 56,500자

(제목 없음)

1We present a statistical color constancy method that relies on novel gray pixel detection and mean shift clustering. The method, called Mean Shifted Grey Pixel -MSGP -is compact, easy to compute and requires no training. Experiments on different datasets show that the proposed approach outperforms state-of-the-art methods in the camera-agnostic scenario. In the setting where the camera is known, MSGP outperforms all statistical methods.

Introduction

2The human eye automatically adapts to changes in imaging conditions and illumination of the scenes. Analogously, the ability of making color images look natural regardless of changing illumination is known as color constancy and is an important feature of consumer digital cameras in order to yield visually canonical images. Color constancy is an important step in different computer vision applications, such as fine-grained classification, semantic segmentation, scene rendering and object tracking, among others [1].

3For decades, the classical approachs for color constancy in digital cameras, statistical methods, have relied on the assumption that some global or local statistical properties of the illumination are constant and can therefore be estimated directly from the image [2,3,4,5,6,7,8]. This approach has the advantage of being independent to the acquisition device since the properties of the scene illumination are estimated in a per-image basis. Recently, state-of-the-art methods including convolutional neural networks (CNN), namely learning-based methods [9,10,11,12,13], have consistently outperformed statistical methods when validated in several mainstream benchmarks. We argue that learning-based methods depend on the assumption that the statistical distribution of the illumination in both the training and testing images is similar. In other words, learning-based methods assume that imaging and illumination conditions of a given image can be inferred from previous training examples, thus becoming heavily dependent on the training data [14].

4In order to assess the limitation of color constancy methods to cope with differences between training and testing images, we focus on the Camera-agnostic color constancy setting. For illustration, consider the case when a user retrieves an image yanlin.qian@tut.fi arXiv:1803.08326v3 [cs.CV] 7 Dec 2018 from the unknown camera 1 and wants to color correct it. In this scenario, in which very little is known about the camera or capturing process of the image, color correction must be performed without strong assumptions on the source of the image or imaging device. In this less researched but still important setting, we experimentally show that, in camera-agnostic color constancy, learning-based methods perform poorly compared to statistical methods. As a result, there is a need for approaches that are insensitive to parameters such as the camera or imaging process used to capture the image.

5In this paper we propose a new statistical color constancy method. The proposed method, called mean-shifted gray pixel, or MSGP, is a process that detects pixels that are assumed to be gray under neutral illumination. Why gray pixels? Gray or nearly gray pixels are wide spread in indoor and outdoor images [7]. In the process of manufacturing camera, each camera is calibrated to maintain: gray pixels will be rendered gray in linear image (not raw response) under standard neutral illumination.

6Considering that gray pixels are informative w.r.t. casting illumination, it is possible to transform the scene illumination estimation task into gray pixel detection. This paper proposes an accurate method for the detection of gray pixels by combining a novel grayness measure with Mean-shift clustering in color space.

7Experimental results in camera-agnostic color constancy show that the proposed algorithm outperforms both statistical and learning-based methods of the state-of-theart. Even in the non camera-agnostic scenario, i.e. using k-fold cross validation in the same datasets, the proposed method outperforms other statistical methods and shows a competitive performance when compared to learning-based methods.

Previous Related Work

8Assuming a photometric linear image I captured using a digital camera, with pixels below black level and above saturation level corrected, the simplified imaging formation under one global illumination source can be expressed as [15]:

9where I i (x, y) is the measured image color value at spatial location (x, y), L(λ) the wavelength distribution of the global light source, S i (λ) the spectral response of the color sensor, R(x, y, λ) the surface reflectance and λ the wavelength. Under the narrow-band assumption (Von Kries coefficient law [16]), Eq. 1 can be further simplified as (same as [17]):

10which shows that the whole captured image I is the element-wise Hadamard product of the white-balanced image W and the illumination L.

11The goal of all color constancy methods, both learning-based and statistical methods, is to estimate L, so as to recover W , given I. [9,10,11,12,13,18,19] aim at building a model that relates the captured image I and the sought illumination L from extensive training data. Among the best-performing state-of-the-art approaches, the CCC method discriminatively learns convolutional filters in a 2D log-chroma space [17]. This framework was subsequently accelerated using the Fast Fourier Transform on a chroma torus [20]. Chakrabarti et al. [21] leverage the normalized luminance for illumination prediction by learning a conditional chromaticity distribution. DS-Net [22] and FC 4 Net [23] are two representative methods using deep learning. The former network chooses an estimate from multiple illumination guesses using a two-branch CNN architecture, while the later addresses local estimation ambiguities of patches using a segmentation-like framework. Learningbased methods achieve great success in predicting pre-recorded "ground-truth" illumination color to a fairly high accurate level, but heavily depending on the same cameras being used in both training and testing images (see Sections 3 and 5.2). The Corrected-Moment method [24] can also be considered as a learning-based method as it needs to train a corrected matrix for each dataset.

Learning-based Methods

12Statistical Methods estimate illumination by making some assumptions about the local or global regularity of the illumination and reflectance of the input image. The simplest such method is Gray World [25], that assumes that the global average of reflectance is achromatic. The generalization of this assumption by restricting it to local patches and higher-order gradients has led to some classical and recent statistics-based methods, such as White Patch [2], General Gray World [3], Gray Edge [4], Shades-of-Gray [5] and LSRS [6], among others [8]. The closest works to ours are Xiong et al. [26] and Gray Pixel [7]. Xiong et al. [26] finds gray surfaces based on a special LIS space, but this method is camera-dependent. The Gray Pixel method will be discussed in Section 4. [27,28,29] estimate illumination from the understanding of the physical process of image formation (e.g. the Dichromatic Model), thus being able to model highlights and inter-reflections. Most physics-based methods estimate illumination based on intersection of multiple dichromatic lines, making them work well on toy images and images with only a few surfaces but not very reliable on natural images [29]. The latest physics-based method is [30], which relies on the longest dichromatic line segment assuming Phong reflection model holds and an ambient light exists. Although our method is based on the Dichromatic Model, we classify our approach as statistical since the core of the method is finding gray pixels based on some observed image statistics. We refer readers to [15] for more details about physics-based methods.

Physics-based and other Methods

13The contribution of this paper is two-fold:

14-We experimentally demonstrate that, in the camera-agnostic color constancy setting, state-of-the-art learning-based methods are outperformed by statistical methods -We present the Mean-shifted Gray Pixel method, based on local contrast constraints and Mean Shift Clustering, achieving state-of-the-art performance among competing alternatives. Code will be released upon publication.

Camera-agnostic Color Constancy

15For a given camera, noted as C, Eq. 2 can be rewritten as:

16which indicates that both, the captured image I C , the canonical image W C and the illumination L C that we need to estimate, are dependent on the camera type C. W C indicates that in canonical light, the images captured by different cameras of the same scene differ.

17The color constancy problem in learning-based methods can be stated asL C = f (w, I C ), whereL C is the estimated illumination, and f (w, ·) is the mapping to be learned with parameters w. The mapping f (w, ·) can be embodied by various machine learning models or an ensemble of them. If the learning process for a particular dataset is guided by the distance (e.g. angular error) betweenL C and L C , w will undoubtedly be biased by the particular characteristics of the camera C. In other words, the parameters of f (w, ·) will be learned to be "well-performing" on a specific dataset that encompasses one or a few pre-selected cameras. With the massive modeling capability of some machine learning models (e.g. regression trees and deep learning), the camera sensibility function of a bag of cameras can be modeled up to a high degree. In the literature, the validation of color constancy methods is customarily performed using k-fold cross-validation on the same dataset. As a result, this validation process favors learningbased methods and fails to assess their performance for color correction in images from an unknown camera [14].

18In this work, we define camera-agnostic color constancy as the problem of estimating the illumination L C of a color-biased image I C that has been captured by a camera C of unknown properties. For learning-based methods, this implies that the input image I C has been captured by a camera not previously "seen" in the training process. Therefore, a rigorous validation process of color constancy algorithms should consider both, camera-agnostic and known-camera scenarios. By leveraging publicly available datasets, this can be achieved by training in one dataset and testing in other without overlapping cameras (see Section 5). In contrast to learning-based methods, statistical methods have the advantage of adjusting the model in a per-image basis thus having the potential to implicitly deal with the camera-agnostic problem.

Mean-Shifted Gray Pixel

19The proposed mean-shifted gray pixel algorithm, or MSGP, is built on the assumption that achromatic pixels in the corresponding canonical image can be used to estimate the global illumination. Specifically, achromatic pixels are visually gray in the color corrected image. Yang et al. [7] claimed the mentioned assumption, and experimentally demonstrated the presence of detectable gray pixels in most natural scenes under white light. In this work, we further extend the concept of the Gray Pixel method by means of an adaptive method for the detection gray pixels that combines a new grayness function and mean-shift clustering.

Original Gray Pixel (GP) Revisited

20In this section, we revisited the original Gray Pixel method [7], which is derived from a limited diffuse reflection model. Applying a log transformation to both sides of (2), we have:

21In a small enough local neighborhood, the illumination L can be assumed as uniform under global illumination constrains. As a result, the application of a linear channelwise local contrast operator C{·} (Laplacian of Gaussian, which we will use for the remainder of the paper) on (4) yields:

22Eq. (5) indicates a well-known observation: the casting illumination is irrelevant to the channel-wise local contrast of a small local neighborhood [31]. It also means that regions with no contrast are useless for obtaining illumination cues. Following [7], with balanced R, G and B responses, the following condition must be met by gray pixels:

23In practice, (6) does not hold strictly. As a result, it is necessary to propose a "grayness" measure in order to detect nearly gray pixels. For the sake of simplicity, let us define the local contrast of a log-transformed image pixel located at (x, y) as [7], the grayness measure of a pixel, G(x, y), is defined as:

24where∆(x, y) is the average of channels R, G and B. It is claimed that the smaller G(x, y) is, the more gray a pixel is under white light. Then some post-processing steps are applied to weaken dark pixels (luminance as dominator) and isolated pixels (local averaging), for which we refer readers to the original GP [7].

25A major drawback of Eq. 7 is that the grayness estimate depends on the luminance of the pixels. Specifically, the effect of∆ results in gray pixels having different grayness values due to differences in luminance. Alternatively, we propose that grayness should only depend on chromaticity. Therefore, in the next section, we will introduce a new grayness function to replace Eq. 7.

Grayness Function

26We propose an ideal grayness function G(·) ∈ [0, 1] where 0 denotes pure gray of a pixel color. Our grayness function should comply with the following properties:

27is invariant to the luminance (sum of RGB values). Property 2 G(·) outputs monotonically decreasing value for increasing visual grayness, e.g. from red to white.

Property 3

28Pure gray pixels (on the black-to-white line) should be have value 0. In addition the three above-mentioned properties, it is also desirable that the output space of the grayness function be normalized (so that no subsequent normalization is required), as well as having a physical meaning so that it can be used for other computer vision tasks. Alternatively to the grayness measure proposed in [7], we propose a new grayness measure based on the angular error function that complies with all these properties:

29where

30] is the RGB vector in location (x, y), g is the gray light reference vector [g r , g g , g b ] , and · n refers to the n norm. Our motivation behind Eq. 8 is that, even in the color-biased scenario, it is possible to assume that all gray colors captured by the same camera will have balanced R, G, B components, regardless of their luminance level. As a result, it is possible to assess their grayness level by measuring the angular error with respect to a reference gray value. Notice that, in general, the gray reference vector g can have spatially-varying values in order to adjust for changes in the illumination of the scene. In this work, however, we assume that the global illumination source remains constant in the scene and adopt the canonical gray value as reference: g = [1, 1, 1] . In this case, Eq. 8 can be further simplified as:

31Eq. 9 measures how gray a pixel is, using the angular distance from the local contrast vector to the gray light g, thus meeting Properties 1 and 2. When the point (x, y) is completely gray, G(x, y) is 0 and increases monotonically with decreasing level of grayness, thus meeting Property 3. In addition, the output ranges from 0 • to cos −1 ( 1 √ 3 ) for each image, thus being normalized.

32Empirical Evidence -The next question is whether this new grayness function brings different ordering of pixels according to their grayness levels. To answer this, we replace Eq. 7 with Eq. 8 in the original GP algorithm and estimate illumination in two mainstream color constancy benchmarks where GP is evaluated. Table 1 shows the performance improvement by a large margin (0.6 • reduction in median error for SFU Color Checker) when we use the proposed grayness measure Eq. 8. Results on the SFU Indoor dataset do not differ much, arguably because the preliminary gray pixels given by GP are accurate enough under the well-controlled lighting condition. For the results shown in Table 1, the top 0.1% pixels with G values are chosen as gray pixels, as recommended by [7]. The local contrast operator C{·} is the Laplacian of Gaussian.

33Here we mathematically analyze the connection between the grayness function in Eq. 7 and the proposed grayness measure in Eq. 9. To avoid readers' confusion, we term the original grayness measure in Eq. 7 as G σ (x, y) and the proposed grayness function of Eq. 8 as G θ (x, y). In the sequel, we demonstrate that G σ and G θ are related by:

34where γ(x, y) is a luminance-dependent term.

35In order to demonstrate the relationship in Eq. 10, we approximate G θ as follows 2 :

36It can be readily shown that Eq. 11 is an approximation of the same order of Eq. 9 in the interval [0, 1]. With this approximation, G θ and G σ can be rewritten as:

37where α = ∆ 2 and β = 1 3 ∆ 1 . Putting a multiplier α(α + √ 3β) to both sides of Eq. 13 yields:

38Finally, combing Eq. 12 and 14 we obtain the sought relationship:

39where γ 2 equals to α(α + √ 3β)/3υ. From Eq. 15 it is clear that the original grayness function G σ (x, y) contains not only the real grayness -cosine distance G θ (x, y) from the gray light -but also introduces a non-linear luminance-dependent term γ(x, y), which adds noise to the grayness estimate. As a result, two points with same values of G θ (x, y) but different luminance values will yield different values of G σ (x, y). In contrast, the proposed grayness function G θ (x, y) is more robust to changes in luminance.

40After some post-processing steps (e.g. local averaging and normalization by image intensity), a small percentage of pixels (N %) with the highest grayness values (lowest G) are chosen and averaged to be the illumination estimate. However, as it will be shown in the next section, the chosen gray pixels may still contain a number of colorful pixels. As a result, we will apply Mean Shift clustering in 3D RGB space in order to remove spurious color pixels. In the experiments in the remaining of this paper, we will use the new grayness function unless indicated otherwise.

Mean Shift Purification

41Let S be the set of preselected N % pixels according to their grayness levels. Ideally, S should only contain pure-gray pixels. However, in fact S may contain a number of colorful pixels that need to be removed before estimating the global illumination of the scene.

42In order to remove color pixels from S, we note that, for a color-biased image I, all the pure-gray pixels should be contained in the illumination direction [L r , L g , L b ]. This is equivalent to having all the pixels aligned towards the gray-light vector g = [1, 1, 1] in the canonical image. For illustration purposes, Fig. 1j shows all the pixels of the canonical image of Fig. 1g in RGB space and Fig. 1k shows the corresponding set S of pre-selected gray-pixels. From Fig. 1k, it is clear that S contains both color and gray pixels. As predicted by our assumption, most true-gray pixels are aligned towards one single direction. In particular, the main direction of the densest pixel cloud indicates the illumination of the scene.

43In this paper, we use mean shift (MS) clustering [32,33] with a hybrid distance to seek for the dark-to-bright elongated cluster which contains the most pixels in S. MS is a non-parametric space analysis algorithm, treating the feature space as a probability density function and seeking for the modes. In this work, the density of each pixel p ∈ S in RGB space is calculated as a function of the bandwidth h:

44where n the number of pixels in S, and the kernel density function K(·) is defined as:

45with I(p) = [I r , I g , I b ] being the vector with RGB values of pixel p, D(p, p i ) is the defined hybrid distance computed as the product of the euclidean and angular distances I(p) − I(p i ) 2 · ∠{I(p), I(p i )}, and ∠{·} is the angle between two vectors. Finally, the centroid corresponding to the mode with highest density is used for the computation of the illumination estimate:

46The effect of mean shift clustering on the detection of gray pixels is illustrated in Fig. 1. Comparing Figs. 1h and 1i, it is clear how the mean-shift clustering, simply and effectively, allows for the detection and removal of color pixels in the initial set S. It is worthy to mention that, in some cases, there is almost no colored pixels in S. Fortunately, the performance will not suffer from clustering, as MS gracefully generates only one cluster which gives us a reliable estimate. As a result, there is no need to condition when to apply clustering. The mean-shifted gray pixel algorithm (MSGP) is summarized in Algorithm 1. The proposed method depends only in two parameters: the percentage of pixels chosen from their grayness values, N %, and the clustering bandwidth h of Eq. 16. The selection of these parameters and their effect on the performance of the proposed MSGP algorithm are presented in section 5.3.

Experiments

47Experiments were conducted in two widely known, publicly available datasets collected for the purpose of evaluation of color constancy methods: -Gehler-Shi Dataset [34]: 568 high dynamic linear images, 2 cameras 3 .

48-NUS 8-Camera Dataset [8]: 1736 high dynamic linear images, 8 cameras 4 . The parameters of the proposed MSGP algorithm were selected as follows: the local contrast operator used in Eq. 9 was the Laplacian of Gaussian with a range of 5 pixels. The bandwidth for MS clustering was set to h = 0.001. The percentage of pixels chosen for the generation of S was set to N = 0.1%. These parameters were selected based on preliminary experiments (see Section 5.3) and remained fixed for all the experiments.

49In order to allow for a rigorous comparison with state-of-the-art methods, we have considered two scenarios. The camera-agnostic setting and the camera-known setting. In the agnostic-camera setting, learning-based algorithms are trained in one dataset Fig. 1: Detection of gray pixels. After correction using ground-truth illumination, ideal gray pixel should looks purely gray. (a,g) Input image, (b,h) Initial gray pixels detected. (c,i) Purified gray pixels after the Mean Shift step. (d-f, j-l) color histograms of (a-c).

50Comparing (e) with (f), (j) with (l), it is clear that Mean Shift helps to discard color pixels in (e) that are not aligned with the main illumination vector. For visualization purposes, the luminance of (b,c) is multiplied by a constant 4.

51(e.g., Gehler-Shi) and tested on the other. This allows for testing the performance of the algorithm in cameras not previously "seen" in the training process. The camera-known setting corresponds to the typical 3-fold cross validation used in the literature, in which learning-based methods are trained and validated in the same dataset. Obtained results are summarized in Table 2 and discussed in Sections 5.2 and 5.1.

Camera-known Setting

52Camera-known setting (also termed as single-dataset setting) is the most common setting in related works, allowing extensive pre-training using a k-fold validation for learningbased methods. The results for this setting are summarized in table 2b. Among all the compared methods, FFCC yields the best overall performance in both datasets. It is important to remark that, cross validation makes no difference in the performance of statistical methods. Therefore, in order to avoid repetition, the performance of competing statistical methods is not shown in this table (see next section). Remarkably, it is clear that, even in the known-camera setting, the proposed algorithm outperforms several learning-based methods (from Gamut [10] to the Exemplar-based method [13]) without extensive training and parameter tuning.

Camera-agnostic Setting

53In order to allow for a fair comparison in the camera-agnostic scenario, learning-based methods should be re-trained for evaluation in the same conditions as statistical methods. Several state-of-the-art CNN-based methods are not publicly available. In this work, we were able to re-run the Bayesian method [11], Chakrabarti et al. [21], FFCC [20], and the method by Cheng et al. 2015 [40], using the codes provided by the original authors. Note that this list of methods includes FFCC, which showed the best overall performance in the camera-known setting. We train on one dataset and test on the other one. Both datasets share no common cameras, thus meeting our requirement of being "camera-agnostic". For the results reported in this section, we use the best or final setting for each method: Bayes (GT) for Bayesian; Empirical and End-to-End training for Chakrabarti et al. [21]; 30 regression trees for Cheng et al.; full image resolution and 2 channels for FFCC 5 . Obtained results are summarized in Table 2a.

54Obtained results are summarized in Table 2a. From this table, it is clear that the proposed MSGP algorithm outperforms both learning-based and statistical methods. Except FFCC, selected learning-based methods perform relatively worse in cameraagnostic setting, as compared to statistical methods. Due to their nature, it is not surprising that learning-based methods degrade in their performance in the camera-agnostic scenario. However, the fact that learning-based methods are outperformed by statistical methods is an interesting finding. On one side, if we use learning-based methods trained for a given dataset or "a bag of camera models", we may fail in the cameraagnostic setting. In contrast, in the both camera-agnostic/known setting, the proposed statistical method provides stable performance. For (a,b) we retrieve the results of the related works in the following order: 1) the cited paper, 2) Table [1] and Table [2] from Barron et al. [20,17] considered to be up-to-date and comprehensive, 3) the color constancy benchmarking website [35]. We left dash on unreported results. In (b) results of learning-based methods worse than ours are marked in gray. The training time and testing time are reported in seconds, averagely per image, if reported in the original paper.

55(a) Camera-agnostic setting 1 For Correct-Moment [24] we report reproduced and more detailed results by [17], which slightly differs with the original results: mean: 3.5, median: 2.6 for 19 colors and mean: 2.8, median: 2.0 for 19 edges on Gehler-Shi Dataset. 2 We rerun Grey Pixel (edge) on NUS dataset. * We mark Exemplar-based method with asterisk as it is trained and tested on a uncorrected-blacklevel dataset.

Algorithm parameters

56The role of bandwidth h. The bandwidth h determines the domain size where Mean Shift computes the pixel divergence. Here we evaluate variants of the proposed method by changing h to be 1e−4, 1e−3 and 1e−2. Table 3 shows that the bandwidth 1e−3 gives a good trade-off between mean and median error on two datasets. For reference purposes, Table 3 also includes performance results obtained when the distance function in Eq. 17 uses only angular information in D(·). Clustering Algorithm We compare two clustering methods, Mean Shift and K-means.

57Here we evaluate variants of K-means by changing the number of clusters K to 2, 5 and 9. Table 3 shows that, in general, MS gives better results. This can be attributed to the fact that Mean Shift is more robust to outliers than K-means. Among all K-means invariants, the 2-cluster setting performs best. This suggests that S usually contains 1 − 2 elongated clusters.

Limitations and Conclusions

58Our method relies on gray pixels and their statistics for illumination estimation. Therefore, in some extreme cases, when there are no detectable gray pixels or there are gray pixels representing two illuminations, our method fails. In Figure 2, two no-gray-pixel examples and two double-illumination examples are shown. In such cases, our method suffers in the absence of gray pixels or a biased group of gray pixels representing more than one illumination source. Cheng et al. [41] claimed that in SFU Color Checker Dataset [34], there are 66 two-illumination images (image list released). It is worthy to mention that the images where we fail overlap largely with this two-illumination list.

59In this paper, we presented a statistical method for tackling the problem of color constancy. The proposed method relies on gray pixel detection and mean shift clustering in order to estimate the illumination of the scene based on the statistical properties of the gray pixels of the input image. In the camera-agnostic scenario, in which color constancy is to be applied to images captured with unknown cameras, the proposed method outperforms both learning-based and statistical state-of-the-arts. The proposed method is easy to implement, training-free, and depends only on two parameters, namely the percentage of gray pixels N % and the Mean Shift bandwidth h. With our method, processing a 2000 × 1500 linear image takes about 1.32 seconds with unoptimized MATLAB code running in a CPU Intel i7 2.5 GHz.

Introduction

60The human eye automatically adapts to changes in imaging conditions and illumination of the scenes. Analogously, the ability of making color images look natural regardless of changing illumination is known as color constancy and is an important feature of consumer digital cameras in order to yield visually canonical images. Color constancy is an important step in different computer vision applications, such as fine-grained classification, semantic segmentation, scene rendering and object tracking, among others [1].

61For decades, the classical approachs for color constancy in digital cameras, statistical methods, have relied on the assumption that some global or local statistical properties of the illumination are constant and can therefore be estimated directly from the image [2,3,4,5,6,7,8]. This approach has the advantage of being independent to the acquisition device since the properties of the scene illumination are estimated in a per-image basis. Recently, state-of-the-art methods including convolutional neural networks (CNN), namely learning-based methods [9,10,11,12,13], have consistently outperformed statistical methods when validated in several mainstream benchmarks. We argue that learning-based methods depend on the assumption that the statistical distribution of the illumination in both the training and testing images is similar. In other words, learning-based methods assume that imaging and illumination conditions of a given image can be inferred from previous training examples, thus becoming heavily dependent on the training data [14].

62In order to assess the limitation of color constancy methods to cope with differences between training and testing images, we focus on the Camera-agnostic color constancy setting. For illustration, consider the case when a user retrieves an image yanlin.qian@tut.fi arXiv:1803.08326v3 [cs.CV] 7 Dec 2018 from the unknown camera 1 and wants to color correct it. In this scenario, in which very little is known about the camera or capturing process of the image, color correction must be performed without strong assumptions on the source of the image or imaging device. In this less researched but still important setting, we experimentally show that, in camera-agnostic color constancy, learning-based methods perform poorly compared to statistical methods. As a result, there is a need for approaches that are insensitive to parameters such as the camera or imaging process used to capture the image.

63In this paper we propose a new statistical color constancy method. The proposed method, called mean-shifted gray pixel, or MSGP, is a process that detects pixels that are assumed to be gray under neutral illumination. Why gray pixels? Gray or nearly gray pixels are wide spread in indoor and outdoor images [7]. In the process of manufacturing camera, each camera is calibrated to maintain: gray pixels will be rendered gray in linear image (not raw response) under standard neutral illumination.

64Considering that gray pixels are informative w.r.t. casting illumination, it is possible to transform the scene illumination estimation task into gray pixel detection. This paper proposes an accurate method for the detection of gray pixels by combining a novel grayness measure with Mean-shift clustering in color space.

65Experimental results in camera-agnostic color constancy show that the proposed algorithm outperforms both statistical and learning-based methods of the state-of-theart. Even in the non camera-agnostic scenario, i.e. using k-fold cross validation in the same datasets, the proposed method outperforms other statistical methods and shows a competitive performance when compared to learning-based methods.

Previous Related Work

66Assuming a photometric linear image I captured using a digital camera, with pixels below black level and above saturation level corrected, the simplified imaging formation under one global illumination source can be expressed as [15]:

67where I i (x, y) is the measured image color value at spatial location (x, y), L(λ) the wavelength distribution of the global light source, S i (λ) the spectral response of the color sensor, R(x, y, λ) the surface reflectance and λ the wavelength. Under the narrow-band assumption (Von Kries coefficient law [16]), Eq. 1 can be further simplified as (same as [17]):

68which shows that the whole captured image I is the element-wise Hadamard product of the white-balanced image W and the illumination L.

69The goal of all color constancy methods, both learning-based and statistical methods, is to estimate L, so as to recover W , given I. [9,10,11,12,13,18,19] aim at building a model that relates the captured image I and the sought illumination L from extensive training data. Among the best-performing state-of-the-art approaches, the CCC method discriminatively learns convolutional filters in a 2D log-chroma space [17]. This framework was subsequently accelerated using the Fast Fourier Transform on a chroma torus [20]. Chakrabarti et al. [21] leverage the normalized luminance for illumination prediction by learning a conditional chromaticity distribution. DS-Net [22] and FC 4 Net [23] are two representative methods using deep learning. The former network chooses an estimate from multiple illumination guesses using a two-branch CNN architecture, while the later addresses local estimation ambiguities of patches using a segmentation-like framework. Learningbased methods achieve great success in predicting pre-recorded "ground-truth" illumination color to a fairly high accurate level, but heavily depending on the same cameras being used in both training and testing images (see Sections 3 and 5.2). The Corrected-Moment method [24] can also be considered as a learning-based method as it needs to train a corrected matrix for each dataset.

Learning-based Methods

70Statistical Methods estimate illumination by making some assumptions about the local or global regularity of the illumination and reflectance of the input image. The simplest such method is Gray World [25], that assumes that the global average of reflectance is achromatic. The generalization of this assumption by restricting it to local patches and higher-order gradients has led to some classical and recent statistics-based methods, such as White Patch [2], General Gray World [3], Gray Edge [4], Shades-of-Gray [5] and LSRS [6], among others [8]. The closest works to ours are Xiong et al. [26] and Gray Pixel [7]. Xiong et al. [26] finds gray surfaces based on a special LIS space, but this method is camera-dependent. The Gray Pixel method will be discussed in Section 4. [27,28,29] estimate illumination from the understanding of the physical process of image formation (e.g. the Dichromatic Model), thus being able to model highlights and inter-reflections. Most physics-based methods estimate illumination based on intersection of multiple dichromatic lines, making them work well on toy images and images with only a few surfaces but not very reliable on natural images [29]. The latest physics-based method is [30], which relies on the longest dichromatic line segment assuming Phong reflection model holds and an ambient light exists. Although our method is based on the Dichromatic Model, we classify our approach as statistical since the core of the method is finding gray pixels based on some observed image statistics. We refer readers to [15] for more details about physics-based methods.

Physics-based and other Methods

71The contribution of this paper is two-fold:

72-We experimentally demonstrate that, in the camera-agnostic color constancy setting, state-of-the-art learning-based methods are outperformed by statistical methods -We present the Mean-shifted Gray Pixel method, based on local contrast constraints and Mean Shift Clustering, achieving state-of-the-art performance among competing alternatives. Code will be released upon publication.

Camera-agnostic Color Constancy

73For a given camera, noted as C, Eq. 2 can be rewritten as:

74which indicates that both, the captured image I C , the canonical image W C and the illumination L C that we need to estimate, are dependent on the camera type C. W C indicates that in canonical light, the images captured by different cameras of the same scene differ.

75The color constancy problem in learning-based methods can be stated asL C = f (w, I C ), whereL C is the estimated illumination, and f (w, ·) is the mapping to be learned with parameters w. The mapping f (w, ·) can be embodied by various machine learning models or an ensemble of them. If the learning process for a particular dataset is guided by the distance (e.g. angular error) betweenL C and L C , w will undoubtedly be biased by the particular characteristics of the camera C. In other words, the parameters of f (w, ·) will be learned to be "well-performing" on a specific dataset that encompasses one or a few pre-selected cameras. With the massive modeling capability of some machine learning models (e.g. regression trees and deep learning), the camera sensibility function of a bag of cameras can be modeled up to a high degree. In the literature, the validation of color constancy methods is customarily performed using k-fold cross-validation on the same dataset. As a result, this validation process favors learningbased methods and fails to assess their performance for color correction in images from an unknown camera [14].

76In this work, we define camera-agnostic color constancy as the problem of estimating the illumination L C of a color-biased image I C that has been captured by a camera C of unknown properties. For learning-based methods, this implies that the input image I C has been captured by a camera not previously "seen" in the training process. Therefore, a rigorous validation process of color constancy algorithms should consider both, camera-agnostic and known-camera scenarios. By leveraging publicly available datasets, this can be achieved by training in one dataset and testing in other without overlapping cameras (see Section 5). In contrast to learning-based methods, statistical methods have the advantage of adjusting the model in a per-image basis thus having the potential to implicitly deal with the camera-agnostic problem.

Mean-Shifted Gray Pixel

77The proposed mean-shifted gray pixel algorithm, or MSGP, is built on the assumption that achromatic pixels in the corresponding canonical image can be used to estimate the global illumination. Specifically, achromatic pixels are visually gray in the color corrected image. Yang et al. [7] claimed the mentioned assumption, and experimentally demonstrated the presence of detectable gray pixels in most natural scenes under white light. In this work, we further extend the concept of the Gray Pixel method by means of an adaptive method for the detection gray pixels that combines a new grayness function and mean-shift clustering.

Original Gray Pixel (GP) Revisited

78In this section, we revisited the original Gray Pixel method [7], which is derived from a limited diffuse reflection model. Applying a log transformation to both sides of (2), we have:

79In a small enough local neighborhood, the illumination L can be assumed as uniform under global illumination constrains. As a result, the application of a linear channelwise local contrast operator C{·} (Laplacian of Gaussian, which we will use for the remainder of the paper) on (4) yields:

80Eq. (5) indicates a well-known observation: the casting illumination is irrelevant to the channel-wise local contrast of a small local neighborhood [31]. It also means that regions with no contrast are useless for obtaining illumination cues. Following [7], with balanced R, G and B responses, the following condition must be met by gray pixels:

81In practice, (6) does not hold strictly. As a result, it is necessary to propose a "grayness" measure in order to detect nearly gray pixels. For the sake of simplicity, let us define the local contrast of a log-transformed image pixel located at (x, y) as [7], the grayness measure of a pixel, G(x, y), is defined as:

82where∆(x, y) is the average of channels R, G and B. It is claimed that the smaller G(x, y) is, the more gray a pixel is under white light. Then some post-processing steps are applied to weaken dark pixels (luminance as dominator) and isolated pixels (local averaging), for which we refer readers to the original GP [7].

83A major drawback of Eq. 7 is that the grayness estimate depends on the luminance of the pixels. Specifically, the effect of∆ results in gray pixels having different grayness values due to differences in luminance. Alternatively, we propose that grayness should only depend on chromaticity. Therefore, in the next section, we will introduce a new grayness function to replace Eq. 7.

Grayness Function

84We propose an ideal grayness function G(·) ∈ [0, 1] where 0 denotes pure gray of a pixel color. Our grayness function should comply with the following properties:

85is invariant to the luminance (sum of RGB values). Property 2 G(·) outputs monotonically decreasing value for increasing visual grayness, e.g. from red to white.

Property 3

86Pure gray pixels (on the black-to-white line) should be have value 0. In addition the three above-mentioned properties, it is also desirable that the output space of the grayness function be normalized (so that no subsequent normalization is required), as well as having a physical meaning so that it can be used for other computer vision tasks. Alternatively to the grayness measure proposed in [7], we propose a new grayness measure based on the angular error function that complies with all these properties:

87where

88] is the RGB vector in location (x, y), g is the gray light reference vector [g r , g g , g b ] , and · n refers to the n norm. Our motivation behind Eq. 8 is that, even in the color-biased scenario, it is possible to assume that all gray colors captured by the same camera will have balanced R, G, B components, regardless of their luminance level. As a result, it is possible to assess their grayness level by measuring the angular error with respect to a reference gray value. Notice that, in general, the gray reference vector g can have spatially-varying values in order to adjust for changes in the illumination of the scene. In this work, however, we assume that the global illumination source remains constant in the scene and adopt the canonical gray value as reference: g = [1, 1, 1] . In this case, Eq. 8 can be further simplified as:

89Eq. 9 measures how gray a pixel is, using the angular distance from the local contrast vector to the gray light g, thus meeting Properties 1 and 2. When the point (x, y) is completely gray, G(x, y) is 0 and increases monotonically with decreasing level of grayness, thus meeting Property 3. In addition, the output ranges from 0 • to cos −1 ( 1 √ 3 ) for each image, thus being normalized.

90Empirical Evidence -The next question is whether this new grayness function brings different ordering of pixels according to their grayness levels. To answer this, we replace Eq. 7 with Eq. 8 in the original GP algorithm and estimate illumination in two mainstream color constancy benchmarks where GP is evaluated. Table 1 shows the performance improvement by a large margin (0.6 • reduction in median error for SFU Color Checker) when we use the proposed grayness measure Eq. 8. Results on the SFU Indoor dataset do not differ much, arguably because the preliminary gray pixels given by GP are accurate enough under the well-controlled lighting condition. For the results shown in Table 1, the top 0.1% pixels with G values are chosen as gray pixels, as recommended by [7]. The local contrast operator C{·} is the Laplacian of Gaussian.

91Here we mathematically analyze the connection between the grayness function in Eq. 7 and the proposed grayness measure in Eq. 9. To avoid readers' confusion, we term the original grayness measure in Eq. 7 as G σ (x, y) and the proposed grayness function of Eq. 8 as G θ (x, y). In the sequel, we demonstrate that G σ and G θ are related by:

92where γ(x, y) is a luminance-dependent term.

93In order to demonstrate the relationship in Eq. 10, we approximate G θ as follows 2 :

94It can be readily shown that Eq. 11 is an approximation of the same order of Eq. 9 in the interval [0, 1]. With this approximation, G θ and G σ can be rewritten as:

95where α = ∆ 2 and β = 1 3 ∆ 1 . Putting a multiplier α(α + √ 3β) to both sides of Eq. 13 yields:

96Finally, combing Eq. 12 and 14 we obtain the sought relationship:

97where γ 2 equals to α(α + √ 3β)/3υ. From Eq. 15 it is clear that the original grayness function G σ (x, y) contains not only the real grayness -cosine distance G θ (x, y) from the gray light -but also introduces a non-linear luminance-dependent term γ(x, y), which adds noise to the grayness estimate. As a result, two points with same values of G θ (x, y) but different luminance values will yield different values of G σ (x, y). In contrast, the proposed grayness function G θ (x, y) is more robust to changes in luminance.

98After some post-processing steps (e.g. local averaging and normalization by image intensity), a small percentage of pixels (N %) with the highest grayness values (lowest G) are chosen and averaged to be the illumination estimate. However, as it will be shown in the next section, the chosen gray pixels may still contain a number of colorful pixels. As a result, we will apply Mean Shift clustering in 3D RGB space in order to remove spurious color pixels. In the experiments in the remaining of this paper, we will use the new grayness function unless indicated otherwise.

Mean Shift Purification

99Let S be the set of preselected N % pixels according to their grayness levels. Ideally, S should only contain pure-gray pixels. However, in fact S may contain a number of colorful pixels that need to be removed before estimating the global illumination of the scene.

100In order to remove color pixels from S, we note that, for a color-biased image I, all the pure-gray pixels should be contained in the illumination direction [L r , L g , L b ]. This is equivalent to having all the pixels aligned towards the gray-light vector g = [1, 1, 1] in the canonical image. For illustration purposes, Fig. 1j shows all the pixels of the canonical image of Fig. 1g in RGB space and Fig. 1k shows the corresponding set S of pre-selected gray-pixels. From Fig. 1k, it is clear that S contains both color and gray pixels. As predicted by our assumption, most true-gray pixels are aligned towards one single direction. In particular, the main direction of the densest pixel cloud indicates the illumination of the scene.

101In this paper, we use mean shift (MS) clustering [32,33] with a hybrid distance to seek for the dark-to-bright elongated cluster which contains the most pixels in S. MS is a non-parametric space analysis algorithm, treating the feature space as a probability density function and seeking for the modes. In this work, the density of each pixel p ∈ S in RGB space is calculated as a function of the bandwidth h:

102where n the number of pixels in S, and the kernel density function K(·) is defined as:

103with I(p) = [I r , I g , I b ] being the vector with RGB values of pixel p, D(p, p i ) is the defined hybrid distance computed as the product of the euclidean and angular distances I(p) − I(p i ) 2 · ∠{I(p), I(p i )}, and ∠{·} is the angle between two vectors. Finally, the centroid corresponding to the mode with highest density is used for the computation of the illumination estimate:

104The effect of mean shift clustering on the detection of gray pixels is illustrated in Fig. 1. Comparing Figs. 1h and 1i, it is clear how the mean-shift clustering, simply and effectively, allows for the detection and removal of color pixels in the initial set S. It is worthy to mention that, in some cases, there is almost no colored pixels in S. Fortunately, the performance will not suffer from clustering, as MS gracefully generates only one cluster which gives us a reliable estimate. As a result, there is no need to condition when to apply clustering. The mean-shifted gray pixel algorithm (MSGP) is summarized in Algorithm 1. The proposed method depends only in two parameters: the percentage of pixels chosen from their grayness values, N %, and the clustering bandwidth h of Eq. 16. The selection of these parameters and their effect on the performance of the proposed MSGP algorithm are presented in section 5.3.

Experiments

105Experiments were conducted in two widely known, publicly available datasets collected for the purpose of evaluation of color constancy methods: -Gehler-Shi Dataset [34]: 568 high dynamic linear images, 2 cameras 3 .

106-NUS 8-Camera Dataset [8]: 1736 high dynamic linear images, 8 cameras 4 . The parameters of the proposed MSGP algorithm were selected as follows: the local contrast operator used in Eq. 9 was the Laplacian of Gaussian with a range of 5 pixels. The bandwidth for MS clustering was set to h = 0.001. The percentage of pixels chosen for the generation of S was set to N = 0.1%. These parameters were selected based on preliminary experiments (see Section 5.3) and remained fixed for all the experiments.

107In order to allow for a rigorous comparison with state-of-the-art methods, we have considered two scenarios. The camera-agnostic setting and the camera-known setting. In the agnostic-camera setting, learning-based algorithms are trained in one dataset Fig. 1: Detection of gray pixels. After correction using ground-truth illumination, ideal gray pixel should looks purely gray. (a,g) Input image, (b,h) Initial gray pixels detected. (c,i) Purified gray pixels after the Mean Shift step. (d-f, j-l) color histograms of (a-c).

108Comparing (e) with (f), (j) with (l), it is clear that Mean Shift helps to discard color pixels in (e) that are not aligned with the main illumination vector. For visualization purposes, the luminance of (b,c) is multiplied by a constant 4.

109(e.g., Gehler-Shi) and tested on the other. This allows for testing the performance of the algorithm in cameras not previously "seen" in the training process. The camera-known setting corresponds to the typical 3-fold cross validation used in the literature, in which learning-based methods are trained and validated in the same dataset. Obtained results are summarized in Table 2 and discussed in Sections 5.2 and 5.1.

Camera-known Setting

110Camera-known setting (also termed as single-dataset setting) is the most common setting in related works, allowing extensive pre-training using a k-fold validation for learningbased methods. The results for this setting are summarized in table 2b. Among all the compared methods, FFCC yields the best overall performance in both datasets. It is important to remark that, cross validation makes no difference in the performance of statistical methods. Therefore, in order to avoid repetition, the performance of competing statistical methods is not shown in this table (see next section). Remarkably, it is clear that, even in the known-camera setting, the proposed algorithm outperforms several learning-based methods (from Gamut [10] to the Exemplar-based method [13]) without extensive training and parameter tuning.

Camera-agnostic Setting

111In order to allow for a fair comparison in the camera-agnostic scenario, learning-based methods should be re-trained for evaluation in the same conditions as statistical methods. Several state-of-the-art CNN-based methods are not publicly available. In this work, we were able to re-run the Bayesian method [11], Chakrabarti et al. [21], FFCC [20], and the method by Cheng et al. 2015 [40], using the codes provided by the original authors. Note that this list of methods includes FFCC, which showed the best overall performance in the camera-known setting. We train on one dataset and test on the other one. Both datasets share no common cameras, thus meeting our requirement of being "camera-agnostic". For the results reported in this section, we use the best or final setting for each method: Bayes (GT) for Bayesian; Empirical and End-to-End training for Chakrabarti et al. [21]; 30 regression trees for Cheng et al.; full image resolution and 2 channels for FFCC 5 . Obtained results are summarized in Table 2a.

112Obtained results are summarized in Table 2a. From this table, it is clear that the proposed MSGP algorithm outperforms both learning-based and statistical methods. Except FFCC, selected learning-based methods perform relatively worse in cameraagnostic setting, as compared to statistical methods. Due to their nature, it is not surprising that learning-based methods degrade in their performance in the camera-agnostic scenario. However, the fact that learning-based methods are outperformed by statistical methods is an interesting finding. On one side, if we use learning-based methods trained for a given dataset or "a bag of camera models", we may fail in the cameraagnostic setting. In contrast, in the both camera-agnostic/known setting, the proposed statistical method provides stable performance. For (a,b) we retrieve the results of the related works in the following order: 1) the cited paper, 2) Table [1] and Table [2] from Barron et al. [20,17] considered to be up-to-date and comprehensive, 3) the color constancy benchmarking website [35]. We left dash on unreported results. In (b) results of learning-based methods worse than ours are marked in gray. The training time and testing time are reported in seconds, averagely per image, if reported in the original paper.

113(a) Camera-agnostic setting 1 For Correct-Moment [24] we report reproduced and more detailed results by [17], which slightly differs with the original results: mean: 3.5, median: 2.6 for 19 colors and mean: 2.8, median: 2.0 for 19 edges on Gehler-Shi Dataset. 2 We rerun Grey Pixel (edge) on NUS dataset. * We mark Exemplar-based method with asterisk as it is trained and tested on a uncorrected-blacklevel dataset.

Algorithm parameters

114The role of bandwidth h. The bandwidth h determines the domain size where Mean Shift computes the pixel divergence. Here we evaluate variants of the proposed method by changing h to be 1e−4, 1e−3 and 1e−2. Table 3 shows that the bandwidth 1e−3 gives a good trade-off between mean and median error on two datasets. For reference purposes, Table 3 also includes performance results obtained when the distance function in Eq. 17 uses only angular information in D(·). Clustering Algorithm We compare two clustering methods, Mean Shift and K-means.

115Here we evaluate variants of K-means by changing the number of clusters K to 2, 5 and 9. Table 3 shows that, in general, MS gives better results. This can be attributed to the fact that Mean Shift is more robust to outliers than K-means. Among all K-means invariants, the 2-cluster setting performs best. This suggests that S usually contains 1 − 2 elongated clusters.

Limitations and Conclusions

116Our method relies on gray pixels and their statistics for illumination estimation. Therefore, in some extreme cases, when there are no detectable gray pixels or there are gray pixels representing two illuminations, our method fails. In Figure 2, two no-gray-pixel examples and two double-illumination examples are shown. In such cases, our method suffers in the absence of gray pixels or a biased group of gray pixels representing more than one illumination source. Cheng et al. [41] claimed that in SFU Color Checker Dataset [34], there are 66 two-illumination images (image list released). It is worthy to mention that the images where we fail overlap largely with this two-illumination list.

117In this paper, we presented a statistical method for tackling the problem of color constancy. The proposed method relies on gray pixel detection and mean shift clustering in order to estimate the illumination of the scene based on the statistical properties of the gray pixels of the input image. In the camera-agnostic scenario, in which color constancy is to be applied to images captured with unknown cameras, the proposed method outperforms both learning-based and statistical state-of-the-arts. The proposed method is easy to implement, training-free, and depends only on two parameters, namely the percentage of gray pixels N % and the Mean Shift bandwidth h. With our method, processing a 2000 × 1500 linear image takes about 1.32 seconds with unoptimized MATLAB code running in a CPU Intel i7 2.5 GHz.

참고문헌

참고문헌 정보가 없습니다.