TW201830335A - Method and device for determining an illuminant of an image and for chromatic adaptation of an image - Google Patents

Method and device for determining an illuminant of an image and for chromatic adaptation of an image Download PDF

Info

Publication number
TW201830335A
TW201830335A TW107104182A TW107104182A TW201830335A TW 201830335 A TW201830335 A TW 201830335A TW 107104182 A TW107104182 A TW 107104182A TW 107104182 A TW107104182 A TW 107104182A TW 201830335 A TW201830335 A TW 201830335A
Authority
TW
Taiwan
Prior art keywords
light source
value
image
coordinate
adaptation
Prior art date
Application number
TW107104182A
Other languages
Chinese (zh)
Other versions
TWI649724B (en
Inventor
李盈儀
賢哲 李
Original Assignee
聯發科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US15/425,113 external-priority patent/US10224004B2/en
Priority claimed from US15/675,221 external-priority patent/US20180176420A1/en
Application filed by 聯發科技股份有限公司 filed Critical 聯發科技股份有限公司
Publication of TW201830335A publication Critical patent/TW201830335A/en
Application granted granted Critical
Publication of TWI649724B publication Critical patent/TWI649724B/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/73Colour balance circuits, e.g. white balance circuits or colour temperature control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/56Cameras or camera modules comprising electronic image sensors; Control thereof provided with illuminating means
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/70Circuitry for compensating brightness variation in the scene
    • H04N23/76Circuitry for compensating brightness variation in the scene by influencing the image signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/88Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/64Circuits for processing colour signals
    • H04N9/68Circuits for processing colour signals for controlling the amplitude of colour signals, e.g. automatic chroma control circuits
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N9/00Details of colour television systems
    • H04N9/77Circuits for processing the brightness signal and the chrominance signal relative to each other, e.g. adjusting the phase of the brightness signal relative to the colour signal, correcting differential gain or differential phase

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Processing Of Color Television Signals (AREA)
  • Image Processing (AREA)

Abstract

A method and a device determining an illuminant of an image and for chromatic adaptation of an image. The method for determining an illuminant of an image, comprising: calculating an indicator value for each of a set of candidate illuminants of the image, wherein each candidate illuminant is described by a corresponding coordinate pair (p, q) in a chromaticity coordinate system; determining a threshold for indicator values of the candidate illuminants; identifying a subset of the candidate illuminants that have the indicator values not greater than the threshold; and for all candidate illuminants in the subset, calculating a weighted average of corresponding coordinate pairs to obtain an averaged coordinate pair to describe the illuminant of the image in the chromaticity coordinate system.

Description

確定圖像的光源和對圖像進行色覺適配的方法及設備    Method and device for determining light source of image and color vision adaptation of image   

本發明所揭露之實施例有關於彩色攝影、數碼相機、彩色打印和數字彩色圖像處理領域。 The disclosed embodiments relate to the fields of color photography, digital cameras, color printing, and digital color image processing.

所有用戶的彩色顯示設備都經過校準,以便於在顏色通道的紅色(R)=綠色(G)=藍色(B)時,顯示的色彩為標準的“白點”色度,根據國際照明委員會(International Commission on Illumination,簡稱CIE)標準,其大部分為D65或D50。使用互補性氧化金屬半導體(complementary metal-oxide semiconductor,CMOS)或者電荷耦合元件(charge-coupled device,CCD)的數字彩色相機對RGB通道具有不同的敏感度,從而導致原始圖像具有某種偏色(例如,偏綠)。此外,物體的顏色會因為光源的顏色(例如鎢絲燈或日光)和周圍的物體的彼此反射作用而變化。因此,在處理和以合適的顏色再現顯示圖像前,常常需要調節原始圖像的“白點”。白點的調節被稱為白平衡(white balance,WB),其通常通過對顏色通道應用適當的增益來實現,這樣圖像中的中性物 件(例如黑色,灰色和白色)被呈現為大致相等的R、G、B值。在數字相機中,白點可以被手動或者自動調節。自動白平衡(Automatic white balance,AWB)因此是彩色成像應用中的重要操作。 All users' color display devices are calibrated so that when the color channel's red (R) = green (G) = blue (B), the displayed color is the standard "white point" chromaticity, according to the International Commission on Illumination (International Commission on Illumination, CIE for short) standards, most of which are D65 or D50. Digital color cameras using complementary metal-oxide semiconductor (CMOS) or charge-coupled device (CCD) have different sensitivities to RGB channels, resulting in a certain color cast of the original image (E.g. greenish). In addition, the color of an object changes due to the color of the light source (such as a tungsten lamp or daylight) and the reflection of surrounding objects from each other. Therefore, it is often necessary to adjust the "white point" of the original image before processing and rendering the display image in appropriate colors. The adjustment of the white point is called white balance (WB), which is usually achieved by applying appropriate gains to the color channels so that neutral objects (such as black, gray, and white) in the image are rendered approximately equal R, G, B values. In digital cameras, the white point can be adjusted manually or automatically. Automatic white balance (AWB) is therefore an important operation in color imaging applications.

大多數傳統的AWB算法依賴於自然場景的一些物理特徵(例如色域)和統計特徵(例如平均顏色分佈)。傳統的AWB算法對場景內容的統計比較敏感,常常遇到以下一個或多個難點:1)主色色偏影響結果,2)當圖像中沒有中性色時,預估出現錯誤的概率很高,3)錯誤的相機校正可能會導致場景統計與相機使用的統計不同,4)需要大量的參考標準當訓練樣本來建立可靠的統計,以及,5)算法的性能受到相機的批量生產中的元件與元件的差異的影響。因此,非常需要開發出一種對多場景內容更加具有穩健性且相對不敏感的AWB技術。 Most traditional AWB algorithms rely on some physical characteristics (such as color gamut) and statistical characteristics (such as average color distribution) of natural scenes. The traditional AWB algorithm is sensitive to the statistics of the scene content, and often encounters one or more of the following difficulties: 1) the main color color deviation affects the result, 2) when there is no neutral color in the image, the probability of error is high 3) Incorrect camera calibration may cause scene statistics to be different from those used by the camera, 4) A large number of reference standards are required as training samples to establish reliable statistics, and 5) the performance of the algorithm is affected by the components in the camera's mass production The effect of differences with components. Therefore, there is a great need to develop an AWB technology that is more robust and relatively insensitive to multi-scenario content.

依據本發明的示範性實施例,提出一種饋通信號傳輸裝置/方法以及相關饋通信號傳輸電路以解決上述問題。 According to an exemplary embodiment of the present invention, a feedthrough signal transmission device / method and a related feedthrough signal transmission circuit are provided to solve the above problems.

本發明提供一種確定圖像的光源和對圖像進行色覺適配的方法及設備。 The invention provides a method and a device for determining a light source of an image and performing color vision adaptation on the image.

在一個實施例中,提供一種確定圖像的光源的方法。該方法包括:計算圖像的一組候選光源中的每一個候選光源的指示值,其中每一個候選光源都由在色度坐標系中的相應的坐標對(p,q)來描述;確定候選光源的指示值的閾值;識別具有不大於閾值的指示值的候選光源的子集;以及對於該子集 中的所有候選光源,計算該相應的坐標對的加權平均,獲得用於在該色度坐標系中描述該圖像的該光源的平均坐標對。 In one embodiment, a method of determining a light source of an image is provided. The method includes: calculating an indication value of each candidate light source in a group of candidate light sources of an image, wherein each candidate light source is described by a corresponding coordinate pair ( p, q ) in a chromaticity coordinate system; determining a candidate A threshold value of the indication value of the light source; identifying a subset of candidate light sources having an indication value that is not greater than the threshold value; and for all candidate light sources in the subset, calculating a weighted average of the corresponding coordinate pair to obtain a color coordinate for the The system describes the average coordinate pair of the light source of the image.

在另一個實施例中,提供一種對圖像進行色覺適配的方法。該方法包括:計算圖像的光源,其中光源由在色度坐標系中的坐標對(p,q)來描述;識別圖像中景物的亮度級;使用至少部分地根據適配要求和圖像中景物的亮度級推導出的一個或多個適配度,來調整光源的坐標對(p,q)以獲得適配光源;以及將圖像的顏色適配於該適配光源。 In another embodiment, a method for color vision adaptation of an image is provided. The method includes: calculating a light source of an image, wherein the light source is described by a coordinate pair ( p, q ) in a chromaticity coordinate system; identifying a brightness level of a scene in the image; using at least part of the adaptation requirements and the image One or more adaptation degrees derived from the brightness level of the middle scene to adjust the coordinate pair ( p, q ) of the light source to obtain an adapted light source; and adapt the color of the image to the adapted light source.

在又一個實施例中,提供一種確定圖像的光源的設備。該設備包括:存儲器,用於存儲圖像;以及耦接於存儲器的圖像處理管道。圖像處理管道用於:計算圖像的一組候選光源中的每一個候選光源的指示值,其中每一個候選光源由在色度坐標系中的相應的坐標對(p,q)來描述;確定該候選光源的指示值的閾值;識別具有不大於閾值的指示值的候選光源的子集;以及對於子集中的所有候選光源,計算相應的坐標對的加權平均,獲得用於在色度坐標系中描述該圖像的光源的平均坐標對。 In yet another embodiment, an apparatus for determining a light source of an image is provided. The device includes: a memory for storing an image; and an image processing pipeline coupled to the memory. The image processing pipeline is used to calculate an indication value of each candidate light source in a group of candidate light sources of an image, where each candidate light source is described by a corresponding coordinate pair ( p, q ) in a chromaticity coordinate system; Determine the threshold value of the indication value of the candidate light source; identify a subset of candidate light sources having an indication value not greater than the threshold value; and calculate a weighted average of the corresponding coordinate pairs for all candidate light sources in the subset to obtain The average coordinate pair of the light source describing the image.

在再一個實施例中,提供一種對圖像進行色覺適配的設備。該設備包括:存儲器,用於存儲圖像;以及耦接於存儲器的圖像處理管道。圖像處理管道用於:計算圖像的光源,其中光源由在色度坐標系中的坐標對(p,q)來描述;識別圖像中景物的亮度級;使用至少部分地根據適配要求和圖像中景物的亮度級推導出的一個或多個適配度,來調整光源的坐標對(p,q)以獲得適配光源;以及將圖像的顏色使適配於該適配 光源。 In yet another embodiment, a device for color vision adaptation of an image is provided. The device includes: a memory for storing an image; and an image processing pipeline coupled to the memory. The image processing pipeline is used to calculate the light source of the image, where the light source is described by the coordinate pair ( p, q ) in the chromaticity coordinate system; identify the brightness level of the scene in the image; use at least partially according to the adaptation requirements One or more fitting degrees derived from the brightness level of the scene in the image to adjust the coordinate pair ( p, q ) of the light source to obtain the adapted light source; and adapt the color of the image to the adapted light source .

本發明的實施例改善了AWB計算的結果。另外,可以根據給定的規範有效地執行色覺適配。在下面的描述中將詳細解釋實施例的優點。 Embodiments of the present invention improve the results of AWB calculations. In addition, color vision adaptation can be efficiently performed according to a given specification. The advantages of the embodiments will be explained in detail in the following description.

100‧‧‧圖像處理管道 100‧‧‧Image Processing Pipeline

110‧‧‧AWB模組 110‧‧‧AWB Module

120‧‧‧色彩校正矩陣模組 120‧‧‧Color Correction Matrix Module

130‧‧‧灰度校正模組 130‧‧‧Gray Correction Module

140‧‧‧顯示器 140‧‧‧ Display

150‧‧‧設備 150‧‧‧ Equipment

160‧‧‧存儲器 160‧‧‧Memory

300、500、700‧‧‧AWB模組 300, 500, 700‧‧‧AWB modules

310、510‧‧‧預處理單元 310, 510‧‧‧ pretreatment unit

320‧‧‧投影平面計算器 320‧‧‧ Projection Plane Calculator

330‧‧‧投影面積計算器 330‧‧‧ Projected Area Calculator

340、730‧‧‧比較器 340, 730‧‧‧ Comparator

345‧‧‧偏置值 345‧‧‧offset

350‧‧‧增益調整單元 350‧‧‧Gain adjustment unit

380‧‧‧MPA計算器 380‧‧‧MPA calculator

515‧‧‧區塊劃分單元 515‧‧‧block division unit

540‧‧‧加權平均單元 540‧‧‧weighted average unit

600‧‧‧MPA方法 600‧‧‧MPA method

610~640‧‧‧步驟 610 ~ 640‧‧‧step

720‧‧‧差值計算器 720‧‧‧ Difference calculator

780‧‧‧MTV計算器 780‧‧‧MTV calculator

800‧‧‧MPA方法 800‧‧‧MPA method

810~880‧‧‧步驟 810 ~ 880‧‧‧step

900‧‧‧方法 900‧‧‧ Method

910~940‧‧‧步驟 910 ~ 940‧‧‧ steps

1181‧‧‧MPA計算器 1181‧‧‧MPA calculator

1101‧‧‧平均計算器 1101‧‧‧Average Calculator

1182‧‧‧MTV計算器 1182‧‧‧MTV Calculator

1200‧‧‧方法 1200‧‧‧Method

1210~1240‧‧‧步驟 1210 ~ 1240‧‧‧step

1310‧‧‧適配要求 1310‧‧‧ Adaptation requirements

1320‧‧‧Ap曲線 1320‧‧‧A p curve

1410、1420‧‧‧AWB模組 1410, 1420‧‧‧AWB Module

1450‧‧‧色覺適配模組 1450‧‧‧Color Vision Adaptation Module

1500‧‧‧方法 1500‧‧‧Method

1510~1540‧‧‧步驟 1510 ~ 1540‧‧‧‧step

第1A圖是本發明提供的一實施例中執行色彩校正的圖像處理管道的示例;第1B圖是本發明一實施例中的包括第1A圖所示的圖像處理管道的設備的形式的系統;第2圖是本發明一實施例中的在垂直於光源向量的平面上的兩個顏色表面的投影的示例;第3圖是本發明提供的一實施例中的用於執行最小投影面積(minimum projected area,MPA)方法的自動白平衡模組的結構圖;第4A、4B和4C圖是本發明一實施例中的使用三種不同候選光源的投影結果;第5圖是本發明一實施例中的執行區塊MPA方法的自動白平衡模組的結構示意圖;第6圖是本發明一實施例中的MPA方法的流程圖;第7圖是本發明一實施例中的執行最小總變差(minimum total variation,MTV)方法的自動白平衡模組的結構示意圖;第8圖是本發明另一實施例中的MTV方法的流程圖;第9圖是本發明一實施例中的用於自動白平衡的方法的流 程示意圖;第10圖是本發明一實施例中的在一定範圍的G/R比率,其中指示值小於閾值的示例;第11A圖是本發明一實施例中的MPA計算器的示例;第11B圖是本發明一實施例中的MTV計算器的示例;第12圖是本發明一實施例中的用於確定圖像光源的方法的流程圖;第13圖是本發明一實施例中的適配要求的圖表示意圖;第14A圖是本發明一實施例中的AWB模組的示例;第14B圖是本發明另一實施例中的AWB模組的示例;第15圖是本發明一實施例中的基於一組亮度級的適配要求而對圖像進行色覺適配的方法的流程圖。 FIG. 1A is an example of an image processing pipeline performing color correction in an embodiment provided by the present invention; FIG. 1B is a form of a device including the image processing pipeline shown in FIG. 1A in an embodiment of the present invention System; FIG. 2 is an example of projection of two color surfaces on a plane perpendicular to a light source vector in an embodiment of the present invention; and FIG. 3 is a diagram for performing a minimum projection area in an embodiment provided by the present invention (minimum projected area, MPA) method structure diagram of the automatic white balance module; Figures 4A, 4B and 4C are projection results using three different candidate light sources in an embodiment of the present invention; Figure 5 is an implementation of the present invention The schematic diagram of the structure of the automatic white balance module that executes the block MPA method in the example; FIG. 6 is a flowchart of the MPA method in an embodiment of the present invention; and FIG. 7 is the implementation of the minimum total change in an embodiment of the present invention The structure diagram of the automatic white balance module of the minimum total variation (MTV) method; FIG. 8 is a flowchart of the MTV method in another embodiment of the present invention; and FIG. 9 is a flowchart for the MTV method in an embodiment of the present invention. Square of Auto White Balance Figure 10 is an example of the G / R ratio in a certain range in the embodiment of the present invention, where the indicated value is less than the threshold; Figure 11A is an example of the MPA calculator in the embodiment of the present invention; FIG. 11B is an example of an MTV calculator in an embodiment of the present invention; FIG. 12 is a flowchart of a method for determining an image light source in an embodiment of the present invention; and FIG. 13 is a flowchart of an embodiment of the present invention. Schematic diagram of the adaptation requirements; Figure 14A is an example of an AWB module in one embodiment of the invention; Figure 14B is an example of an AWB module in another embodiment of the invention; Figure 15 is an implementation of the invention A flowchart of a method for performing color vision adaptation on an image based on a set of brightness level adaptation requirements in the example.

在下面的描述中,陳述了很多具體細節。然而,可以理解的是,本發明的實施例可以在沒有這些具體細節的情況下實施。在其他實施例中,眾所周知的電路、結構和技術沒有被詳細說明,以免模糊對本說明書的理解。然而,所屬領域中具有習知技術者可以理解,可以在沒有這些具體情節的情況下實踐本發明。所屬領域中具有習知技術者通過所具有的描述將能夠無需過度的實驗而實現適當的功能。 In the following description, many specific details are stated. It is understood, however, that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known circuits, structures, and techniques have not been described in detail, so as not to obscure the understanding of this specification. However, those skilled in the art will understand that the present invention can be practiced without these specific circumstances. Those skilled in the art will be able to implement appropriate functions without undue experimentation through the descriptions they have.

本發明提供基於表面反射分解的系統和方法來執行自動白平衡(automatic white balance,AWB)。當與基於傳統的AWB算法的系統和方法相比,該系統和方法具有穩健性且對場景內容相對不敏感。該系統和方法不依賴詳細的場景統 計或用於訓練的大量圖像資料庫。在下文中,描述了最小投影面積方法(minimum projected area,MPA)和最小總變差(minimum total variation,MTV)方法,這兩者都基於將表面反射分解為鏡面反射分量和漫反射分量,並且基於鏡面反射分量的消除。 The present invention provides a system and method based on surface reflection decomposition to perform automatic white balance (AWB). When compared to systems and methods based on traditional AWB algorithms, the systems and methods are robust and relatively insensitive to scene content. The system and method do not rely on detailed scene statistics or large image databases for training. In the following, the minimum projected area (MPA) method and the minimum total variation (MTV) method are described, both of which are based on decomposing the surface reflection into specular and diffuse reflection components, and based on Elimination of specular reflection components.

如本文中所使用的,術語“三色值”或等同的“RGB值”或“RGB通道”,是指彩色圖像的三個顏色值(紅、綠、藍)。術語“光源(illuminant)”和“光源(light source)”可互換使用。此外,色度圖像指的是色彩差異圖像,其可通過獲取一個色彩通道和另一個色彩通道之間的差異計算出,或者可以通過色彩通道的線性組合之間的差異來計算出。 As used herein, the term "tri-color value" or equivalent "RGB value" or "RGB channel" refers to the three color values (red, green, blue) of a color image. The terms "illuminant" and "light source" are used interchangeably. In addition, a chroma image refers to a color difference image, which can be calculated by obtaining a difference between one color channel and another color channel, or can be calculated by a difference between linear combinations of color channels.

第1A圖是本發明的一實施例中,執行色彩校正的圖像處理管道(image processing pipeline)100的示例。圖像處理管道100包括AWB模組110,其接收原始RGB值作為輸入,並且輸出白平衡校正後的RGB值。原始RGB值可以由圖像傳感器、相機、錄像機等生成。AWB模組110的操作將會在下文參考第2圖-9進行詳細解釋。圖像處理管道100還包括色彩校正矩陣(color correction matrix,CCM)模組120,色彩校正矩陣120對從AWB模組110輸出的RGB值執行3×3矩陣計算。CCM模組120可以降低圖像傳感器的光譜特性和標準的色彩設備(例如,標準RGB彩色顯示器)的光譜響應之間的差異。圖像處理管道100還可以包括圖像灰度校正模組130,其對從CCM模組120輸出的RGB值應用非線性函數來補償顯示設備的非線性亮度效應。圖像處理管道100的輸出是 準備好用於顯示的標準RGB(standard RGB,sRGB)的值的集合。在一個實施例中,圖像處理管道100包括多個處理元件(例如,算術邏輯單元(Arithmetic and Logic Units,ALU)、通用處理器、專用電路,或者上述的任何組合),用於實現AWB模組110、CCM模組120和圖像灰度校正模組130的功能。 FIG. 1A is an example of an image processing pipeline 100 that performs color correction in an embodiment of the present invention. The image processing pipeline 100 includes an AWB module 110 that receives an original RGB value as an input, and outputs an RGB value after white balance correction. Raw RGB values can be generated by image sensors, cameras, video recorders, etc. The operation of the AWB module 110 will be explained in detail below with reference to FIGS. 2-9. The image processing pipeline 100 further includes a color correction matrix (CCM) module 120. The color correction matrix 120 performs a 3 × 3 matrix calculation on the RGB values output from the AWB module 110. The CCM module 120 can reduce the difference between the spectral characteristics of the image sensor and the spectral response of a standard color device (eg, a standard RGB color display). The image processing pipeline 100 may further include an image grayscale correction module 130 that applies a non-linear function to the RGB values output from the CCM module 120 to compensate for the non-linear brightness effect of the display device. The output of the image processing pipeline 100 is a set of standard RGB (sRGB) values ready for display. In one embodiment, the image processing pipeline 100 includes a plurality of processing elements (for example, Arithmetic and Logic Units (ALU), general-purpose processors, special-purpose circuits, or any combination thereof) for implementing the AWB module. Functions of the group 110, the CCM module 120, and the image grayscale correction module 130.

第1B圖是本發明一實施例中包括第1A圖所示的圖像處理管道100的設備150的系統結構示意圖,除了圖像處理管道100之外,設備150包括存儲器160,其用於存儲圖像資料或者將被圖像處理管道100處理的中間圖像資料,設備150還包括顯示器140,顯示器140用於顯示具有標準RGB值的圖像。可以理解的是,設備150還可以包括其他額外的部件,包括但不限於:圖像傳感器、一個或者多個處理器、用戶接口、網絡接口等。在一個實施例中,設備150可以是數碼相機,或者,設備150可以是諸如計算機、筆記本電腦、智能手機、智能手錶之類的計算和/或通信設備的一部分。 FIG. 1B is a schematic diagram of a system structure of a device 150 including the image processing pipeline 100 shown in FIG. 1A according to an embodiment of the present invention. In addition to the image processing pipeline 100, the device 150 includes a memory 160 for storing images. Like data or intermediate image data to be processed by the image processing pipeline 100, the device 150 further includes a display 140 for displaying an image having a standard RGB value. It can be understood that the device 150 may further include other additional components, including but not limited to: an image sensor, one or more processors, a user interface, a network interface, and the like. In one embodiment, the device 150 may be a digital camera, or the device 150 may be part of a computing and / or communication device such as a computer, laptop, smart phone, smart watch, or the like.

在描述AWB模組110的實施例之前,首先解釋AWB模組110的操作所根據的原理是有利於理解的。 Before describing the embodiment of the AWB module 110, it is helpful to first explain the principle on which the AWB module 110 operates.

f(θλ)為雙向光譜反射分佈函數(bidirectional spectral reflectance distribution function,BSRDF),其中θ代表所有的角度相關因子(angle-dependent factor),而λ代表光的波長。大多數有色物體表面的BSRDF可以被描述為兩個反射分量的組合,這兩個反射分量為界面反射(鏡面)分量和本體反射(漫反射)分量。界面反射(interface reflection)通常是非選擇性的,即其對所有具有可見光波長的光進行同樣的反射。 這個模型被稱為中性界面反射(neutral interface reflection,NIR)模型。基於NIR模型,BSRDF f(θλ)可以表示為:f(θλ)=ρ(λ)h(θ)+ρ s k(θ), (1)其中ρ(λ)是漫反射率因子(diffuse reflectance factor),ρ s 鏡面反射率因子(specular reflectance factor),h(θ)和k(θ)是兩個反射率因子的角度相關函數。NIR模型的關鍵特徵在於每種反射分量中的光譜因子和幾何因子是完全分開的。 Let f ( θ ; λ ) be a bidirectional spectral reflectance distribution function (BSRDF), where θ represents all angle-dependent factors, and λ represents the wavelength of light. The BSRDF of the surface of most colored objects can be described as a combination of two reflection components, which are the interface reflection (specular) component and the body reflection (diffuse reflection) component. Interface reflection is usually non-selective, that is, it reflects all light with the same wavelength as visible light. This model is called a neutral interface reflection (NIR) model. Based on the NIR model, BSRDF f ( θ ; λ ) can be expressed as: f ( θ ; λ ) = ρ ( λ ) h ( θ ) + ρ s k ( θ ), (1) where ρ ( λ ) is the diffuse reflectance factor (diffuse reflectance factor), ρ s specular reflectivity (specular reflectance factor), h ( θ) and k (θ) is the angle two reflectivity correlation function. The key feature of the NIR model is that the spectral and geometric factors in each reflection component are completely separated.

假定L(λ)是光源的光譜功率分佈,S r (λ)、S g (λ)和S b (λ)是三個傳感器基礎(即,光譜響應函數)。RGB色彩空間可以推導為:RL(λ)f(θλ)S r (λ)=h(θL(λ)ρ(λ)S r (λ)+ρ s k(θL(λ)S r (λ)G=h(θL(λ)ρ(λ)S g (λ)+ρ s k(θL(λ)S g (λ)B=h(θL(λ)ρ(λ)S b (λ)+ρ s k(θL(λ)S b (λ)。 (2) Assumed that L (λ) is the spectral power distribution of light source, S r (λ), S g (λ) and S b (λ) is the basis of the three sensors (i.e., the spectral response function). The RGB color space can be derived as: R = ʃ L ( λ ) f ( θ ; λ ) S r ( λ ) = h ( θ ) ʃ L ( λ ) ρ ( λ ) S r ( λ ) + ρ s k ( θ ) ʃ L ( λ ) S r ( λ ) , G = h ( θ ) ʃ L ( λ ) ρ ( λ ) S g ( λ ) + ρ s k ( θ ) ʃ L ( λ ) S g ( λ ) , B = h ( θ ) ʃ L ( λ ) ρ ( λ ) S b ( λ ) + ρ s k ( θ ) ʃ L ( λ ) S b ( λ ) . (2)

L r L(λ)S r (λ)L g L(λ)S g (λ)L b L(λ)S b (λ) Let L r = ʃ L ( λ ) S r ( λ ) , L g = ʃ L ( λ ) S g ( λ ) , L b = ʃ L ( λ ) S b ( λ ) , , , .

於是,R=L r [ρ r h(θ)+ρ s k(θ)],G=L g [ρ g h(θ)+ρ s k(θ)],B=L b [ρ b h(θ)+ρ s k(θ)], (3)其中,L r L g L b 是光源的三色值,RGB色彩空間可以改寫為如下所示的矩陣形式: Then, R = L r [ ρ r h ( θ ) + ρ s k ( θ )], G = L g [ ρ g h ( θ ) + ρ s k ( θ )], and B = L b [ ρ b h (θ) + ρ s k ( θ)], (3) where, L r, L g, and L b are tristimulus values of light, RGB color space can be rewritten in matrix form as shown below:

v 1 v 2是RGB空間中的兩個獨立向量。如果將RGB值投影到 v 1 v 2所生成的平面 V 上,投影坐標將為 Let v 1 and v 2 be two independent vectors in RGB space. If the RGB values are projected onto the plane V generated by v 1 and v 2 , the projected coordinates will be

L =[L r L g L b ]T為光源向量,在[ v 1 v 2] T L =0時,等式(5)中的第二項消失。這意味著當平面 V 垂直於光源向量 L 時,鏡面反射分量被消除。 Let L = [ L r L g L b ] T be the light source vector. When [ v 1 v 2 ] T L = 0, the second term in equation (5) disappears. This means that when the plane V is perpendicular to the light source vector L , the specular reflection component is eliminated.

第2圖是本發明一實施例中將兩個表面的顏色投影到平面 V 的示例。根據NIR模型,在給定的表面(例如,S1)上的每個顏色向量是鏡面反射分量(由光源向量 L 表示)和漫反射分量(由 C 1表示)的線性組合。S1的所有顏色與 L C 1在同一個平面上。類似的,另一個表面(例如S2)的所有顏色與 L C 2在同一平面上。因此,同一光源下的所有顏色所在的平面上共享共同向量 L 。如果所有顏色都沿光源向量 L 投影,則它們的投影將形成多條線,且這多條線在一點處相交,該點為光源向量的投影點。如果投影的方向不是沿著光源向量 L 的方向,(即,如果 V 不垂直於 L ),則鏡面分量不被消除。在這種情況下,投影的顏色將不再在平面 V 上形成線,但是會在平面 V 的二維區域上展開。該二維區域被稱為平面 V 上的投影面積。當 v 1 v 2正交時可以計算出該二維區域的面積。當 v 1 v 2變化時,平面 V 隨之變化。通過改變 v 1 v 2,當平面 V 垂直於光源向量 L 時,投影面積會變為最小。使用 v 1 v 2中特定 的哪一個作為基礎向量並不重要,因為它們都會產生實質相同的結果。 FIG. 2 is an example of projecting the colors of two surfaces onto a plane V in an embodiment of the present invention. The NIR model, at a given surface (e.g., 1 S) on each of the color vector is the specular component (represented by the light source vector L) and diffuse reflection components (indicated by C 1) is a linear combination. All colors of S 1 are on the same plane as L and C 1 . Similarly, all colors of the other surface (eg, S 2 ) are on the same plane as L and C 2 . Therefore, the common vector L is shared by the planes of all colors under the same light source. If all colors are projected along the light source vector L , their projections will form multiple lines, and these multiple lines intersect at a point, which is the projection point of the light source vector. If the direction of the projection is not along the direction of the light source vector L (ie, if V is not perpendicular to L ), the specular component is not eliminated. In this case, the color of the projected line is formed not on the plane V, but will expand on the two-dimensional area of the V plane. This two-dimensional area is called the projected area on the plane V. When v 1 and v 2 are orthogonal, the area of the two-dimensional region can be calculated. When v 1 and v 2 change, the plane V changes accordingly. By changing v 1 and v 2 , when the plane V is perpendicular to the light source vector L , the projection area becomes the smallest. It doesn't matter which particular of v 1 and v 2 is used as the basis vector, because they both produce essentially the same result.

在AWB計算中,真實光源的光源向量 L 是未知的。MPA方法通過選擇不同的候選光源來改變平面 V 。從候選光源的選出的光源向量 L =(L r L g L b ),可以計算出正交的基礎向量 v 1 v 2,並且也可以計算出給定圖像在由 v 1 v 2生成的平面上的投影面積。當選擇的光源向量 L 最接近該圖像的真實光源時,投影面積最小。 In the AWB calculation, the light source vector L of the real light source is unknown. The MPA method changes the plane V by selecting different candidate light sources. From the selected candidate light source vector L = (L r, L g , L b), can be calculated orthogonal basis vectors v 1 and v 2, and also given image can be calculated by v 1 and v 2 Projected area on the generated plane. When the selected light source vector L is closest to the real light source of the image, the projection area is the smallest.

在一個實施例中,正交的基礎向量可以被參數化如下: In one embodiment, the orthogonal basis vectors can be parameterized as follows:

α=L g /L r ,且β=L g /L b 時,平面 V (αβ)垂直於 L When α = L g / L r and β = L g / L b , the plane V ( α , β ) is perpendicular to L.

在一個實施例中,因為搜索所有可能的平面 V (α,β)是非常耗時的,光源的搜索範圍被縮窄到光源更可能發生的子空間。縮小搜索範圍也有利於減少找到錯誤光源的可能性。在一個實施例中,搜索範圍可以被設置為在預期的應用領域中的用戶圖像中(consumer image)經常發生的一組光源。術語“用戶圖像”指的是通常可以在內容用戶使用的圖像顯示設備上看到的彩色圖像。或者或另外,可以使用日光軌跡(daylight locus)和黑體輻射軌跡(blackbody radiator locus)的適當混合。這個混合可以提供覆蓋了用戶圖像中大多數的光源的光源軌跡。為了搜索到圖像的光源,用MPA方法為沿著光源軌跡的一組 候選光源中的每一個候選光源計算圖像的投影面積。產生最小的投影面積的候選光源就是場景光源(即,真實光源)的最佳估計,且圖像根據該場景光源的最佳估計被白平衡。在一個實施例中,MPA方法尋找最小投影面積的表達式如下所示:argmin α,β w(α,β)Area(α,β), (8)其中,w(α,β)是偏置函數(bias function),Area(α,β)是在平面 V (α,β)投影的面積,該面積是通過 v 1(α,β)和 v 2(α,β)生成的。該偏置函數可以用於修改投影面積,從而改善MPA方法的性能。該偏置函數依賴於總體場景光源分佈,而不是場景內容。因此,相同的偏置函數可以適用於相機校準後的任何相機模型。偏置函數w(α,β)的詳細內容將在稍後提供。在其他實施例中,可以省略偏置函數(即,設定為1)。 In one embodiment, because searching all possible planes V ( α, β ) is very time-consuming, the search range of the light source is narrowed to a subspace where the light source is more likely to occur. Narrowing the search also helps reduce the possibility of finding the wrong light source. In one embodiment, the search range may be set to a set of light sources that often occur in consumer images in the intended field of application. The term "user image" refers to a color image that can generally be seen on an image display device used by content users. Alternatively or in addition, a suitable mixture of daylight locus and blackbody radiator locus can be used. This blend can provide a light source trace that covers most of the light sources in the user's image. In order to search for the light source of the image, the MPA method is used to calculate the projected area of the image for each candidate light source in the set of candidate light sources along the light source trajectory. The candidate light source that produces the smallest projection area is the best estimate of the scene light source (ie, the real light source), and the image is white-balanced according to the best estimate of the scene light source. In one embodiment, the expression for the MPA method to find the minimum projection area is as follows: argmin α, β w ( α, β ) Area ( α, β ), (8) where w ( α, β ) is an offset A function (bias function), Area ( α, β ) is the area projected on the plane V ( α, β ), and this area is generated by v 1 ( α, β ) and v 2 ( α, β ). This bias function can be used to modify the projection area, thereby improving the performance of the MPA method. The bias function depends on the overall scene light distribution, not the scene content. Therefore, the same offset function can be applied to any camera model after camera calibration. Details of the bias function w ( α, β ) will be provided later. In other embodiments, the bias function may be omitted (ie, set to 1).

第3圖是本發明提供的一實施例中用於執行MPA方法的AWB模組300的結構圖。AWB模組300是第1A圖中所示的AWB模組110的一個示例。AWB模組300包括預處理單元310,預處理單元310用於處理輸入圖像的原始RGB資料以移除過度曝光、曝光不足和飽和的像素。移除這些像素可以提升AWB的計算速度並可減少噪點。在一個實施例中,如果一個像素的R值、G值和B值中的一個或多個的色彩通道大於閾值時,則認為該像素是過度曝光,則移除該像素。在這些像素被移除後,預處理單元310可以通過將圖像劃分為多組相鄰像素,並計算每一組中的相鄰像素的三色值的加權平均值,來對輸入圖像進行分組平均。每一個組的權重可以是一或其他數值。在一個實施例中,在計算出分組平均之後,預處理單元310 可以從圖像中移除曝光不足的像素。如果一個像素的R值、G值和B值之和高於第一閾值,則該像素被過度曝光;如果一個像素的R值、G值和B值之和低於第二閾值,則該像素曝光不足。預處理單元310也可以從圖像中移除飽和像素。如果一個像素的R值、G值和B值之一低於預定閾值,則該像素飽和。 FIG. 3 is a structural diagram of an AWB module 300 for performing an MPA method according to an embodiment of the present invention. The AWB module 300 is an example of the AWB module 110 shown in FIG. 1A. The AWB module 300 includes a pre-processing unit 310 for processing raw RGB data of an input image to remove over-exposed, under-exposed, and saturated pixels. Removing these pixels can speed up AWB calculations and reduce noise. In one embodiment, if the color channel of one or more of the R value, G value, and B value of a pixel is greater than the threshold, the pixel is considered to be overexposed, and the pixel is removed. After these pixels are removed, the pre-processing unit 310 may perform an operation on the input image by dividing the image into multiple groups of adjacent pixels and calculating a weighted average of the tri-color values of the adjacent pixels in each group. Group average. The weight of each group can be one or other values. In one embodiment, after calculating the group average, the pre-processing unit 310 may remove underexposed pixels from the image. If the sum of the R, G, and B values of a pixel is higher than the first threshold, the pixel is overexposed; if the sum of the R, G, and B values of a pixel is lower than the second threshold, the pixel Underexposure. The pre-processing unit 310 may also remove saturated pixels from the image. If one of the R value, G value, and B value of a pixel is lower than a predetermined threshold, the pixel is saturated.

在一個實施例中,在移除過度曝光、曝光不足和/或飽和的像素和分組平均操作之後,預處理單元310可以對圖像進行子採樣以產生預處理圖像。預處理後的圖像被提供給AWB模組300中的MPA計算器380,用於MPA計算。 In one embodiment, after removing over-exposed, under-exposed, and / or saturated pixel and group averaging operations, the pre-processing unit 310 may sub-sample the image to generate a pre-processed image. The pre-processed image is provided to the MPA calculator 380 in the AWB module 300 for MPA calculation.

在一個實施例中,MPA計算器380包括投影平面計算器320和投影面積計算器330。投影平面計算器320計算兩個正交向量 v 1 v 2 v 1 v 2生成了垂直於候選光源的光源向量 L (L r ,L g ,L b )的平面。在一個實施例中,當α和β的值已經被給出或者從候選光源中計算出時,投影平面計算器320可以根據等式(6)和(7)計算出 v 1 v 2In one embodiment, the MPA calculator 380 includes a projection plane calculator 320 and a projection area calculator 330. The projection plane calculator 320 calculates two orthogonal vectors v 1 and v 2 , and v 1 and v 2 generate a plane perpendicular to the light source vector L ( L r , L g , L b ) of the candidate light source. In one embodiment, when the values of α and β have been given or calculated from candidate light sources, the projection plane calculator 320 may calculate v 1 and v 2 according to equations (6) and (7).

在確定投影平面之後,投影面積計算器330將預處理圖像中的每一個像素的RGB值投影到該投影平面。投影的結果是落在投影平面上的點的集合。如果每種顏色被表示為單點,那麼投影的結果將在投影平面上產生一組散亂的點,如第4A、4B和4C圖的所示,第4A、4B和4C圖中的每一幅圖式都是採用不同的候選光源進行投影的結果。當沿著真實光源向量進行投影時,局部的點的密度變更高。然而,計算點的密度需要大量的計算。在一個實施例中,投影平面被分成一組空間倉(spatial bins)(例如正方形)。當一個或多個像素投影到 正方形中時,計數該正方形。計數的正方形的數量可以作為投影面積的估算結果。 After determining the projection plane, the projection area calculator 330 projects the RGB value of each pixel in the preprocessed image to the projection plane. The result of the projection is a collection of points that fall on the projection plane. If each color is represented as a single point, the result of the projection will produce a scattered set of points on the projection plane, as shown in Figures 4A, 4B, and 4C, and each of Figures 4A, 4B, and 4C The images are the result of projection using different candidate light sources. When the projection is performed along the real light source vector, the density of local points is changed to be high. However, calculating the density of points requires a lot of calculations. In one embodiment, the projection plane is divided into a set of spatial bins (eg, squares). When one or more pixels are projected into a square, the square is counted. The number of counted squares can be used as an estimate of the projected area.

參考第4A、4B和4C圖,在每一個示例中,“x”標記代表圖像中所有像素的投影點。當候選光源越接近真實光源,被“x”標記的投影的總面積就越小。每一個示例都採用了由不同正交基礎向量 v 1 v 2所描述的不同的候選光源。第4B圖所示的投影面積119面積最小,因此其相應的候選光源在三個候選光源中最接近真實光源。 Referring to Figures 4A, 4B, and 4C, in each example, the "x" mark represents the projection points of all pixels in the image. The closer the candidate light source is to the real light source, the smaller the total area of the projection marked by "x". Each example uses different candidate light sources described by different orthogonal basis vectors v 1 and v 2 . The projection area 119 shown in FIG. 4B has the smallest area, so its corresponding candidate light source is closest to the real light source among the three candidate light sources.

請再次參閱第3圖,在投影面積計算器330計算出一組不同候選光源的投影面積之後,比較器340比較這些投影面積的大小並識別產生最小投影面積的候選光源。在一個實施例中,在比較之前,比較器340可以將每一個投影面積與前文所述的偏置函數相乘,以作為改進AWB結果的選項,在本實施例中示為偏置值345(即,權重)。偏置值345可以基於在用戶圖像中光源沿著光源軌跡的頻率的先驗知識來決定。也就是說,偏置值345代表的是場景光源分佈的先驗知識,而不與場景內容相關。在一個實施例中,每一個候選光源都與一個偏置值相關聯,該偏置值可以被表示為函數w(α,β),其中αβ是候選光源的色彩比率。從一種相機模型到另一種相機模型,偏置值是穩定不變的。 Please refer to FIG. 3 again. After the projection area calculator 330 calculates the projection areas of a set of different candidate light sources, the comparator 340 compares the sizes of these projection areas and identifies the candidate light source that produces the smallest projection area. In one embodiment, before the comparison, the comparator 340 may multiply each projected area with the offset function described above as an option to improve the AWB result, which is shown as the offset value 345 in this embodiment ( That is, weights). The offset value 345 may be determined based on prior knowledge of the frequency of the light source along the light source trajectory in the user image. That is, the offset value 345 represents the prior knowledge of the scene light source distribution, and is not related to the scene content. In one embodiment, each candidate light source is associated with an offset value, which can be expressed as a function w ( α, β ), where α and β are the color ratios of the candidate light sources. From one camera model to another, the offset value is stable.

在比較器340識別出產生最小投影面積的候選光源之後,增益調整單元350根據候選光源的色彩比率α和β調整輸入圖像的色彩增益。 After the comparator 340 recognizes the candidate light source that produces the smallest projection area, the gain adjustment unit 350 adjusts the color gain of the input image according to the color ratios α and β of the candidate light source.

對於具有多個不同顏色的物體的圖像,當投影沿 著光源向量時,投影面積通常是最小的,然而對於只有單個主色的圖像,當主色的鏡面反射分量或者漫反射分量被消除時,才會出現最小投影面積。為了更好地處理這種顏色種類很少的圖像,搜索範圍被限制在僅由於鏡面反射分量被消除而不是漫反射分量被消除所引起的最小投影面積。一種方法是在色度空間中搜索這些靠近潛在光源的所在位置的候選光源。因此,沿著穿過已知光源的群體(population)的光源軌跡搜索到最小投影面積。 For images with multiple different colors, when projecting along the light source vector, the projection area is usually the smallest. However, for images with only a single main color, when the specular or diffuse reflection components of the main color are eliminated Only when the minimum projection area appears. In order to better process this kind of image with few color types, the search range is limited to the smallest projection area caused only by the specular reflection component being eliminated instead of the diffuse reflection component being eliminated. One method is to search for these candidate light sources in the chromaticity space near the location of potential light sources. Therefore, a minimum projection area is searched along a light source trajectory that passes through a population of known light sources.

在一個實施例中,色度坐標系(p,q)可以在較小失真的色度區域中的參數化光源軌跡的分佈。該坐標系(p,q)被定義為: 其中,r=R/(R+G+B),g=G/(R+G+B),b=B/(R+G+B)。 In one embodiment, the chromaticity coordinate system ( p, q ) can parameterize the distribution of the light source trajectory in a less distorted chromaticity region. The coordinate system ( p, q ) is defined as: Where r = R / ( R + G + B ), g = G / ( R + G + B ), and b = B / ( R + G + B ).

對於候選光源(L r ,L g ,L b ),其(p,q)坐標系可以通過將等式(9)中的R、G、B值更換為L r L g L b 值來決定。 For the candidate light source ( L r , L g , L b ), its ( p, q ) coordinate system can be changed by replacing the R, G, and B values in equation (9) with L r , L g , and L b values. Decide.

可以通過擬合(fitting)由參考相機在不同光源下獲取的色彩資料獲得光源軌跡。例如,對來自三種光源(陰影、日光和鎢絲燈)光線進行曲線擬合可以提供非常好的光源軌跡。在一個實施例中,一個給定的光源軌跡可以由二階多項式函數在(p,q)域中表示,其具有如下的形式:q=a i p 2+a 2 p+a 3. (10) The light source trajectory can be obtained by fitting color data obtained by the reference camera under different light sources. For example, curve fitting of light from three light sources (shadow, daylight, and tungsten lamp) can provide very good light source trajectories. In one embodiment, a given light source trajectory can be represented by a second-order polynomial function in the ( p, q ) domain, which has the form: q = a i p 2 + a 2 p + a 3. (10)

給定(p,q)的值,如下所示的等式用於計算(r,g,b): Given the value of ( p, q ), the equation shown below is used to calculate ( r, g, b ):

色彩比率αβ可以通過如下所示的等式獲得: The color ratios α and β can be obtained by the equation shown below:

因此,給出沿著光源軌跡的(p,q),可以計算色彩比率αβ。正交向量 v 1(α,β)和 v 2(α,β)可以使用等式(6)和(7)計算出。並且圖像投影到由 v 1(α,β)和 v 2(α,β)所展開的平面 V 上的面積也可以計算。 Therefore, given ( p, q ) along the trajectory of the light source, the color ratios α and β can be calculated. The orthogonal vectors v 1 ( α, β ) and v 2 ( α, β ) can be calculated using equations (6) and (7). And the area of the image projected onto the plane V developed by v 1 ( α, β ) and v 2 ( α, β ) can also be calculated.

當場景被單個主光源照射時,MPA方法可以準確地估算出光源。但是,有些場景有不止一個光源。在一個實施例中,區塊MPA方法被用於處理這樣的多光源場景。使用區塊MPA方法,就是將圖像分成幾個區塊,並將MPA方法應用於每一個區塊。 When the scene is illuminated by a single main light source, the MPA method can accurately estimate the light source. However, some scenes have more than one light source. In one embodiment, the block MPA method is used to process such a multi-light source scene. Using the block MPA method is to divide the image into several blocks and apply the MPA method to each block.

第5圖是本發明一實施例中執行區塊MPA方法的AWB模組500。AWB模組500是第1A圖中所示的AWB模組110的一個示例。AWB模組500包括預處理單元510,預處理單元510還包括區塊劃分單元515,區塊劃分單元515用於將輸入圖像劃分為多個區塊。預處理單元510在每一個區塊上執行與第3圖中所示的預處理單元310相同的像素移除操作,預處理單元510移除過度曝光,曝光不足和飽和的像素。預處理單元510還在移除像素操作之後確定每一個區塊是否具有足夠數量的像素(例如,10個像素)來進行MPA方法。如果具有足夠像素的區塊數量小於閾值數量(例如,區塊總數的一半), 則預處理單元510將圖像重新劃分為更少數量的區塊,使得圖像中的新區塊的數量大於閾值數量。 FIG. 5 is an AWB module 500 that executes the block MPA method according to an embodiment of the present invention. The AWB module 500 is an example of the AWB module 110 shown in FIG. 1A. The AWB module 500 includes a pre-processing unit 510, and the pre-processing unit 510 further includes a block dividing unit 515. The block dividing unit 515 is configured to divide an input image into a plurality of blocks. The pre-processing unit 510 performs the same pixel removal operation on each block as the pre-processing unit 310 shown in FIG. 3. The pre-processing unit 510 removes pixels that are overexposed, underexposed, and saturated. The pre-processing unit 510 also determines whether each block has a sufficient number of pixels (for example, 10 pixels) to perform the MPA method after the pixel removal operation. If the number of blocks with sufficient pixels is less than the threshold number (for example, half of the total number of blocks), the pre-processing unit 510 re-divides the image into a smaller number of blocks such that the number of new blocks in the image is greater than the threshold Quantity.

在一個實施例中,AWB模組500包括一個或多個MPA計算器310 MPA計算器310用於在每一個區塊上執行MPA方法。每一個區塊的結果都被加權平均單元540收集,加權平均單元540首先對色度坐標p進行平均,然後基於給定光源軌跡的擬合曲線(例如(10)中的二階多項式函數)找出另一個色度坐標q。在一個實施例中,加權平均單元540給每一個區塊都應用一個權重。例如,具有主要物件的區塊的權重可能高於其他區塊。在其他實施例中,加權平均單元540可以對所有的區塊應用相同的權重。加權平均單元540的輸出是結果候選光源或其代表候選光源。然後增益調整單元350根據結果候選光源的色彩比率αβ調整輸入圖像的色彩增益。 In one embodiment, the AWB module 500 includes one or more MPA calculators 310. The MPA calculator 310 is used to perform MPA methods on each block. The results of each block are collected by the weighted average unit 540. The weighted average unit 540 first averages the chromaticity coordinates p , and then finds out based on the fitted curve of the given light source trajectory (such as the second-order polynomial function in (10)) Another chromaticity coordinate q . In one embodiment, the weighted average unit 540 applies a weight to each block. For example, a block with a main object may have a higher weight than other blocks. In other embodiments, the weighted average unit 540 may apply the same weight to all the blocks. The output of the weighted average unit 540 is the result candidate light source or its representative candidate light source. The gain adjustment unit 350 then adjusts the color gain of the input image according to the color ratios α and β of the result candidate light sources.

第6圖是本發明一實施例中在彩色圖像上執行的MPA方法600的流程圖。MPA方法600可以由諸如第1B圖的設備150的設備執行;更具體地說,MPA方法600可以由第1A圖的AWB模組110、第3圖的AWB模組300和/或第5圖的AWB模組500執行。 FIG. 6 is a flowchart of an MPA method 600 performed on a color image according to an embodiment of the present invention. MPA method 600 may be performed by a device such as device 150 of FIG. 1B; more specifically, MPA method 600 may be performed by AWB module 110 of FIG. 1A, AWB module 300 of FIG. 3, and / or FIG. The AWB module 500 is executed.

在MPA方法600中,設備首先開始對圖像進行預處理以獲得預處理像素,每一個預處理像素由三色值表示,三色值包括紅(red,R)值,綠(green,G)值和藍(blue,B)值(步驟610)。對於一組候選光源中的每一個候選光源,設備執行如下操作:計算與候選光源的三色值的向量垂直的投影平面(步驟620),將每一個預處理像素的三色值投影到計算出的 投影平面以獲取投影面積(步驟630)。將候選光源中投影面積最小的一個識別為結果光源(resulting illuminant)(步驟640)。設備可以使用結果光源的色彩比率調整圖像的色彩增益。 In the MPA method 600, the device first starts preprocessing the image to obtain preprocessed pixels. Each preprocessed pixel is represented by a three-color value. The three-color value includes red (red, R) values, and green (green, G). Value and blue (B, B) value (step 610). For each candidate light source in a group of candidate light sources, the device performs the following operations: calculates a projection plane perpendicular to the vector of the three color values of the candidate light sources (step 620), and projects the three color values of each preprocessed pixel to the calculated To obtain a projection area (step 630). The one with the smallest projection area among the candidate light sources is identified as a result illuminant (step 640). The device can use the color ratio of the resulting light source to adjust the color gain of the image.

根據另一個實施例,可以使用MTV方法來執行AWB方法,該MTV方法也基於與MPA方法相同的原理:通過設法消除鏡面反射分量。根據NIR模型,可以從給定的圖像中,通過縮放一個顏色通道並與另一個顏色通道相減,來創建一對色度圖像(αC 1-C 2)和(βC 3-C 2)。(C 1 ,C 2 ,C 3)是三色值(R,G,B)的線性變換。 According to another embodiment, the AWB method can be performed using the MTV method, which is also based on the same principle as the MPA method: by trying to eliminate the specular reflection component. According to the NIR model, a pair of chroma images ( αC 1 - C 2 ) and ( βC 3 - C 2 ) can be created from a given image by scaling one color channel and subtracting from another color channel. . ( C 1 , C 2 , C 3 ) is a linear transformation of the three color values (R, G, B).

(αC 1-C 2)和(βC 3-C 2)都是圖像中空間位置的函數。兩個色度圖像可以表示為:(αC 1-C 2)=[(αa 11-a 21)L r ρ r +(αa 12-a 22)L g ρ g +(αa 13-a 23)L b ρ b ]h(θ)+[(αa 11-a 21)L r +(αa 12-a 22)L g +(αa 13-a 23)L b ]ρ s k(θ),(βC 3-C 2)=[(βa 31-a 21)L r ρ r +(βa 32-a 22)L g ρ g +(βa 33-a 23)L b ρ b ]h(θ)+[(βa 31-a 21)L r +(βa 32-a 22)L g +(βa 33-a 23)L b ]ρ s k(θ)。(14) ( αC 1 - C 2 ) and ( βC 3 - C 2 ) are both functions of the spatial position in the image. The two chroma images can be expressed as: ( αC 1 - C 2 ) = [( αa 11 - a 21 ) L r ρ r + ( αa 12 - a 22 ) L g ρ g + ( αa 13 - a 23 ) L b ρ b ] h ( θ ) + [( αa 11 - a 21 ) L r + ( αa 12 - a 22 ) L g + ( αa 13 - a 23 ) L b ] ρ s k ( θ ), ( βC 3 - C 2 ) = [( βa 31 - a 21 ) L r ρ r + ( βa 32 - a 22 ) L g ρ g + ( βa 33 - a 23 ) L b ρ b ] h ( θ ) + (( βa 31 - a 21 ) L r + ( βa 32 - a 22 ) L g + ( βa 33 - a 23 ) L b ] ρ s k ( θ ). (14)

α=(a 21 L r +a 22 L g +a 23 L b )/(a 11 L r +a 12 L g +a 13 L b )且β=(a 21 L r +a 22 L g +a 23 L b )/(a 31 L r +a 32 L g +a 33 L b )時:(αC 1-C 2)=[(αa 11-a 21)L r ρ r +(αa 12-a 22)L g ρ g +(αa 13-a 23)L b ρ b ]h(θ),(βC 3-C 2)=[(βa 31-a 21)L r ρ r +(βa 32-a 22)L g ρ g +(βa 33-a 23)L b ρ b ]h(θ)。(15) When α = ( a 21 L r + a 22 L g + a 23 L b ) / ( a 11 L r + a 12 L g + a 13 L b ) and β = ( a 21 L r + a 22 L g + a 23 L b ) / ( a 31 L r + a 32 L g + a 33 L b ): ( αC 1 - C 2 ) = [( αa 11 - a 21 ) L r ρ r + ( αa 12 - a 22 ) L g ρ g + ( αa 13 - a 23 ) L b ρ b ] h ( θ ), ( βC 3 - C 2 ) = [( βa 31 - a 21 ) L r ρ r + ( βa 32 - a 22 ) L g ρ g + ( βa 33 - a 23 ) L b ρ b ] h ( θ ). (15)

對於(αC 1-C 2)和(βC 3-C 2),鏡面反射分量都被消除。當消除發生時,由於鏡面反射分量引起的調製消失,所以 (αC 1-C 2)和(βC 3-C 2)的總變差大大減小。只剩下漫反射分量的信號調製。 For ( αC 1 - C 2 ) and ( βC 3 - C 2 ), the specular reflection components are eliminated. When cancellation occurs, the total variation of ( αC 1 -C 2 ) and ( βC 3 -C 2 ) is greatly reduced because the modulation caused by the specular reflection component disappears. Only the signal modulation of the diffuse reflection component remains.

通過沿著給定的光源軌跡搜索,MTV方法可以找到候選光源,該候選光源由色彩比率αβ表示,使得總變差在接下來的表示中最小化。可以使用等式(11)和(12)從給定的光源軌跡上的給定的點(p,q)計算出色彩比率αβ。本實施例中的總變差可以表示為等式(14)中的兩個色度圖像的絕對梯度大小之和: By searching along a given light source trajectory, the MTV method can find candidate light sources, which are represented by the color ratios α and β , so that the total variation is minimized in the following representations. The color ratios α and β can be calculated using equations (11) and (12) from a given point ( p, q ) on a given light source locus. The total variation in this embodiment can be expressed as the sum of the magnitudes of the absolute gradients of the two chroma images in equation (14):

需要注意的是,二維圖像的梯度是具有x分量和y分量的向量。為了提升計算效率,可以使用簡化的一維近似總變差: It should be noted that the gradient of a two-dimensional image is a vector with x and y components. To improve the calculation efficiency, a simplified one-dimensional approximation of total variation can be used:

在一個實施例中,如果任何一個相鄰像素都由於過度曝光、曝光不足或顏色飽和而已經被移除,則從總變差計算中排除該像素的梯度。 In one embodiment, if any adjacent pixel has been removed due to overexposure, underexposure, or color saturation, the gradient of that pixel is excluded from the total variation calculation.

第7圖是本發明一實施例中執行MTV方法的自動白平衡模組700的結構示意圖。AWB模組700是第1A圖的AWB模組110的另一個示例。AWB模組700包括預處理單元310,預處理單元310用於處理輸入圖像的原始RGB資料以移除過度曝光、曝光不足和飽和的像素。AWB模組700還包括MTV計算器780,MTV計算器780在一組候選光源中搜索最小總變差的變化的解決方案。更具體地說,MTV計算器780 還包括差值計算器720和比較器730。差值計算器720計算每一個候選光源的總變差,比較器730比較差值計算器720計算的結果以識別出最小總變差。在一個實施例中,比較器730在比較前可以將每一個總變差乘以偏置值345(即,權重)。偏置值345可以基於在用戶圖像中光源沿著光源軌跡的頻率的先驗知識來確定。也就是說,偏置值345表示場景光源分佈的先驗知識,並且與場景內容無關。在一個實施例中,每一個候選光源與一個偏置值相關聯,該偏置值可被表示為函數w(α,β),其中αβ是候選光源的色彩比率,從一個相機模型到另一個相機模型,偏置值保持穩定。 FIG. 7 is a schematic structural diagram of an automatic white balance module 700 performing an MTV method according to an embodiment of the present invention. The AWB module 700 is another example of the AWB module 110 in FIG. 1A. The AWB module 700 includes a pre-processing unit 310 for processing raw RGB data of an input image to remove over-exposed, under-exposed, and saturated pixels. The AWB module 700 also includes an MTV calculator 780, which searches for a solution of the smallest total variation in the set of candidate light sources. More specifically, the MTV calculator 780 further includes a difference calculator 720 and a comparator 730. The difference calculator 720 calculates the total variation of each candidate light source, and the comparator 730 compares the results calculated by the difference calculator 720 to identify the smallest total variation. In one embodiment, the comparator 730 may multiply each total variation by an offset value 345 (ie, a weight) before comparison. The offset value 345 may be determined based on prior knowledge of the frequency of the light source along the light source trajectory in the user image. That is, the offset value 345 represents the prior knowledge of the scene light source distribution and has nothing to do with the scene content. In one embodiment, each candidate light source is associated with an offset value, which can be expressed as a function w ( α, β ), where α and β are the color ratios of the candidate light sources, from a camera model to In another camera model, the offset value remains stable.

在比較器730識別出產生最小總變差的候選光源之後,增益調節單元350使用候選光源的色彩比率αβ調節輸入圖像的色彩增益。實驗結果表明,MTV方法在單個主光源以及多個光源的場景下表現良好。 After the comparator 730 identifies the candidate light source that produces the smallest total variation, the gain adjustment unit 350 adjusts the color gain of the input image using the color ratios α and β of the candidate light source. The experimental results show that the MTV method performs well in the scenario of a single main light source and multiple light sources.

第8圖是本發明另一實施例中在彩色圖像上執行的MTV方法800的流程圖。在本實可替代施例中,在計算總變差的過程中採用線性變換來計算三色值。MTV方法800可以由諸如第1B圖中所示的設備150的設備來執行,更具體地,MTV方法800可以由第1A圖中所示的AWB模組110和/或第7圖中所示的AWB模組700來執行。 FIG. 8 is a flowchart of an MTV method 800 performed on a color image in another embodiment of the present invention. In this alternative embodiment, a linear transformation is used to calculate the three-color value in the process of calculating the total variation. MTV method 800 may be performed by a device such as device 150 shown in FIG. 1B. More specifically, MTV method 800 may be performed by AWB module 110 shown in FIG. 1A and / or shown in FIG. 7 AWB module 700.

在MPA方法800中,設備首先開始對圖像進行預處理以獲得多個預處理像素,每一個預處理像素由三色值表示,三色值包括紅(R)值,綠(G)值和藍(B)值的(步驟810)。對於一組候選光源中的每一個候選光源,設備計算預處理像素 中的相鄰像素之間的三色值總變差值(步驟820)。計算總變差值的步驟包括如下操作:計算三色值的線性變換以獲得三個變換值(步驟830);計算第一縮放因子和第二縮放因子,第一縮放因子和第二縮放因子用於表示候選光源的兩個色彩比率(步驟840);通過獲取按第一縮放因子縮放的第一變換值與第二變換值之間的差值(difference)來構建第一色度圖像(步驟850);通過獲取按第二縮放因子縮放的第三變換值與第二變換值之間的差值來構建第二色度圖像(步驟860);以及通過將第一色度圖像的絕對梯度大小和第二色度圖像的絕對梯度大小相加來計算總變差(步驟870)。在計算出所有候選光源的總變差之後,設備選擇在所有總變差中值最小的總變差相應的候選光源(步驟880)。 In the MPA method 800, the device first starts preprocessing the image to obtain a plurality of preprocessed pixels, each of which is represented by a three-color value, and the three-color value includes a red (R) value, a green (G) value, and Blue (B) value (step 810). For each candidate light source in the set of candidate light sources, the device calculates the total variation of the tri-color values between adjacent pixels in the pre-processed pixels (step 820). The step of calculating the total variation value includes the following operations: calculating a linear transformation of the three-color values to obtain three transformation values (step 830); calculating a first scaling factor and a second scaling factor, the first scaling factor and the second scaling factor being used Representing two color ratios of candidate light sources (step 840); constructing a first chroma image by obtaining a difference between a first transform value and a second transform value scaled by a first scaling factor (step 850); construct a second chroma image by obtaining a difference between the third transform value and the second transform value scaled by the second scaling factor (step 860); and by converting the absolute value of the first chroma image The gradient magnitude and the absolute gradient magnitude of the second chrominance image are added to calculate a total variation (step 870). After calculating the total variation of all candidate light sources, the device selects the candidate light source corresponding to the total variation with the smallest median value of all total variations (step 880).

第9圖是本發明一實施例中對圖像執行自動白平衡的方法的流程示意圖。方法900可以由諸如第1B圖所示的設備150的設備來執行;更具體地,方法900可以由第1A圖所示的AWB模組110,第3圖所示的AWB模組300,第5圖所示的AWB模組500和/或第7圖所示的AWB模組700來執行。 FIG. 9 is a schematic flowchart of a method for performing automatic white balance on an image according to an embodiment of the present invention. Method 900 may be performed by a device such as device 150 shown in FIG. 1B; more specifically, method 900 may be performed by AWB module 110 shown in FIG. 1A, AWB module 300 shown in FIG. 3, and The AWB module 500 shown in the figure and / or the AWB module 700 shown in FIG. 7 are executed.

在方法900中,設備首先開始對圖像進行預處理以獲得多個預處理像素,每一個預處理像素由三色值表示,三色值包括紅(R)值,綠(G)值和藍(B)值(步驟910)。對於一組候選光源中的每一個候選光源,設備計算其包括鏡面反射分量和漫反射分量的指示值(步驟920)。然後設備識別出多個候選光源中的一個候選光源為結果光源,其相應的指示值是 所有候選光源中的最小指示值,其中,最小指示值相應於鏡面反射分量的消除(步驟930)。根據從結果光源推導出的色彩比率,設備調製圖像的色彩增益(步驟940)。在一個實施例中,指示值是如第6圖中所示的MPA方法600中所描述的投影面積,在其他實施例中,指示值是如第8圖中所示的MTV方法800所描述的總變差值。 In method 900, the device first begins to pre-process the image to obtain a plurality of pre-processed pixels, each of which is represented by a tri-color value, the tri-color value includes a red (R) value, a green (G) value, and blue (B) value (step 910). For each candidate light source in the set of candidate light sources, the device calculates an indication value including a specular reflection component and a diffuse reflection component (step 920). The device then identifies one candidate light source among the plurality of candidate light sources as the result light source, and its corresponding indication value is the smallest indication value among all candidate light sources, where the smallest indication value corresponds to the elimination of the specular reflection component (step 930). Based on the color ratio derived from the resulting light source, the device modulates the color gain of the image (step 940). In one embodiment, the indication value is the projection area as described in the MPA method 600 shown in FIG. 6. In other embodiments, the indication value is the description of the MTV method 800 as shown in FIG. 8. Total variation.

在接下來的描述中,將展示MPA和MTV方法的改進。該改進的目的在於使得計算出的圖像的光源更接近真實光源,例如當多個候選光源生成的投影區域(或者總變差)具有相似的大小;也就是說,它們在數值上的差異可能在誤差範圍內。因此,將PQ色度域(PQ domain)中的這些候選光源的坐標值進行平均以生成平均光源,而不是將這些候選光源中的一個作為圖像的光源。在一個實施場景中,當圖像中大量的像素位於用於獲取候選光源的光源軌跡上,或者在該光源軌跡的閾值距離內,該方法可能是有用的。在這種情況下,通過MPA方法計算出的最小投影面積和通過MTV方法計算出的最小總變差可能是不穩定的,且平均光源可能比在計算中產生最小投影面積(或者最小總變差)的候選光源更接近真實光源。在本文的描述中,術語“平均值”可與“加權平均值”可互換使用,其中權重可以是1或另一數值;例如從關於候選光源的先驗知識推導出的概率值。例如,如果在用戶圖像群體中第一候選光源比第二候選光源更加頻繁地出現,則第一候選光源的概率值可能高於第二候選光源的概率值。 In the following description, improvements to the MPA and MTV methods will be demonstrated. The purpose of this improvement is to make the light source of the calculated image closer to the real light source, for example, when the projection area (or total variation) generated by multiple candidate light sources has similar sizes; that is, their numerical differences may be Within the error range. Therefore, the coordinate values of the candidate light sources in the PQ domain are averaged to generate an average light source, instead of using one of the candidate light sources as the light source of the image. In one implementation scenario, this method may be useful when a large number of pixels in an image are located on the light source trajectory used to obtain a candidate light source, or within a threshold distance of the light source trajectory. In this case, the minimum projection area calculated by the MPA method and the minimum total variation calculated by the MTV method may be unstable, and the average light source may produce the minimum projection area (or the minimum total variation) than in the calculation. The candidate light source is closer to the real light source. In the description herein, the term "average" may be used interchangeably with "weighted average", where the weight may be 1 or another value; for example, a probability value derived from prior knowledge about candidate light sources. For example, if the first candidate light source appears more frequently than the second candidate light source in the user image group, the probability value of the first candidate light source may be higher than the probability value of the second candidate light source.

為了簡化描述,在接下來的描述中術語“指示值” 用於指代MPA方法中的“投影面積”、MTV方法中的“總變差”以及它們各自的加權值中的任何一個。第10圖是將MPA方法應用到圖像上的結果的示例,其中對於一定範圍的G/R比率,指示值(例如,加權面積)保持基本相同,其中每個G/R比率都代表候選光源。在本實施例中,真實光源的指示值不是最小指示值,但是真實光源的指示值和最小指示值均低於閾值(T)。在一個實施例中,將所有指示值小於或者不大於閾值(T)的候選光源用來計算平均光源,並且平均光源可以是通過平均計算相應的候選光源的pq的坐標值來獲得的。平均光源可以作為圖像的光源。 To simplify the description, the term "indicative value" is used in the following description to refer to any of the "projected area" in the MPA method, the "total variation" in the MTV method, and their respective weighted values. Figure 10 is an example of the results of applying the MPA method to an image, where for a range of G / R ratios, the indicated value (for example, weighted area) remains substantially the same, where each G / R ratio represents a candidate light source . In this embodiment, the indication value of the real light source is not the minimum indication value, but both the indication value and the minimum indication value of the real light source are lower than the threshold (T). In one embodiment, all candidate light sources with an indication value less than or not greater than the threshold (T) are used to calculate the average light source, and the average light source may be obtained by averaging the coordinate values of p and q of the corresponding candidate light sources. The average light source can be used as the light source of the image.

在一個實施例中,閾值(T)可以是指示值的最大值和最小值之間的值,例如T=V_min+,其中V_min是候選光源生成的所有指示值中的最小指示值,小於指示值的最大值和最小值之間的差值。在一些情況下,可以大於零,例如當生成最小指示值的候選光源不是邊界候選光源時。需要注意的是這裡的術語“邊界”是指p坐標邊界,因為使用q坐標邊界來計算閾值(T)可能引起在計算平均光源的結果中產生顯著的誤差。 In one embodiment, the threshold (T) may be a value between the maximum value and the minimum value of the indication value, for example, T = V_min +, where V_min is the smallest indication value among all indication values generated by the candidate light source, and is smaller than The difference between the maximum and minimum values. In some cases, it may be greater than zero, such as when the candidate light source generating the minimum indication value is not a boundary candidate light source. It should be noted that the term “boundary” here refers to the p- coordinate boundary, because using the q- coordinate boundary to calculate the threshold (T) may cause significant errors in the result of calculating the average light source.

在一些情況下,可以是零,例如當邊界候選光源中的一個生成最小指示值時,和/或當最小指示值和第二最小指示值之間的差值大於容忍範圍時。通過坐標對(p,q)來描述邊界候選光源,其中p坐標值處於包括色度坐標系中的所有候選光源的時間或空間(interval or space)的邊界處。例如,如果所有的候選光源位於由p坐標值範圍參數化的(p,q)空間中的 一維曲線上,則在光源軌跡上具有最小和最大的p坐標值的候選光源是邊界候選光源。如果所有候選光源位於由p坐標值範圍和q坐標值範圍描述的二維色度空間中,則具有最小和最大的p坐標值的候選光源是邊界候選光源。 In some cases, it may be zero, such as when one of the boundary candidate light sources generates the minimum indication value, and / or when the difference between the minimum indication value and the second minimum indication value is greater than the tolerance range. The boundary candidate light source is described by a coordinate pair ( p, q ), where the p- coordinate value is at the boundary of time or space including all candidate light sources in the chromaticity coordinate system. For example, a one-dimensional curve if all candidate light source is a p-coordinate value range of the parameter of the (p, Q) space, it has on the light source trajectory candidate illuminants minimum and maximum p-coordinate value is a boundary candidate illuminants. If all candidate light sources are located in a two-dimensional chromaticity space described by a p- coordinate value range and a q- coordinate value range, the candidate light sources with the smallest and largest p- coordinate values are boundary candidate light sources.

因此,閾值T的通式可以是:T=min[(V_min+k(V_max-V_min)),V_boundary],其中k是0與1之間的值(例如,k=0.125),V_min是最小指示值,V_max是最大指示值,V_boundary表示如上文中定義的邊界候選光源生成的邊界指示值。 Therefore, the general formula of the threshold T can be: T = min [(V_min + k (V_max-V_min)), V_boundary], where k is a value between 0 and 1 (for example, k = 0.125), and V_min is the minimum indication Value, V_max is the maximum indication value, and V_boundary represents the boundary indication value generated by the boundary candidate light source as defined above.

第11A圖是本發明一實施例中MPA計算器1181的示例。MPA計算器1181是第3圖和第5圖中的MPA計算器380的可替代示例。如前文中所述,投影平面計算器320和投影面積計算器330計算每個候選光源的投影面積。比較器340比較投影面積或加權投影面積,確定閾值(T),並識別投影面積或加權投影面積不大於T的那些候選光源。MPA計算器1181還包括平均計算器1101,用於計算識別出的候選光源的平均值。這些候選光源中的每一個都由在色度坐標系中的相應坐標對(p,q)來描述。平均計算器1101分別對這些相應的p坐標值和相應的q坐標值進行平均,以確定平均p坐標值(p avg)和平均q坐標值(q avg)。由色度坐標系中的平均坐標對(p avg,q avg)識別或描述的結果平均光源,可以作為用於隨後的圖像處理(例如,AWB處理)的圖像的光源。 FIG. 11A is an example of an MPA calculator 1181 in an embodiment of the present invention. The MPA calculator 1181 is an alternative example of the MPA calculator 380 in FIGS. 3 and 5. As described in the foregoing, the projection plane calculator 320 and the projection area calculator 330 calculate the projection area of each candidate light source. The comparator 340 compares the projection area or weighted projection area, determines a threshold (T), and identifies those candidate light sources whose projection area or weighted projection area is not greater than T. The MPA calculator 1181 further includes an average calculator 1101 for calculating an average value of the identified candidate light sources. Each of these candidate light sources is described by a corresponding coordinate pair ( p, q ) in the chromaticity coordinate system. The average calculator 1101 averages the corresponding p- coordinate values and the corresponding q- coordinate values, respectively, to determine an average p- coordinate value ( p avg ) and an average q- coordinate value ( q avg ). A result average light source identified or described by an average coordinate pair ( p avg , q avg ) in the chromaticity coordinate system can be used as a light source for an image for subsequent image processing (eg, AWB processing).

類似的,第11B圖是本發明一實施例中MTV計算器1182的示例。MTV計算器1182是第7圖中的MTV計算器 780的可替代示例。如前文中所述,差值計算器720計算每個候選光源的總變差。比較器730比較總變差或加權總變差,確定閾值(T),並識別那些總變差或加權總變差不大於T的候選光源。MTV計算器1182還包括平均計算器1102,用於計算識別出的候選光源的平均值。這些候選光源中的每一個都由在色度坐標系中的相應坐標對(p,q)來描述。平均計算器1102分別對這些相應的p坐標值和相應的q坐標值進行平均,以確定平均p坐標值(p avg)和平均q坐標值(q avg)。圖像的光源由色度坐標系中的平均坐標對(p avg,q avg)來識別或描述。 Similarly, FIG. 11B is an example of the MTV calculator 1182 in an embodiment of the present invention. The MTV calculator 1182 is an alternative example of the MTV calculator 780 in FIG. 7. As described earlier, the difference calculator 720 calculates the total variation of each candidate light source. The comparator 730 compares the total variation or weighted total variation, determines a threshold (T), and identifies candidate light sources whose total variation or weighted total variation is not greater than T. The MTV calculator 1182 also includes an average calculator 1102 for calculating an average value of the identified candidate light sources. Each of these candidate light sources is described by a corresponding coordinate pair ( p, q ) in the chromaticity coordinate system. The average calculator 1102 averages these corresponding p- coordinate values and corresponding q- coordinate values, respectively, to determine an average p- coordinate value ( p avg ) and an average q- coordinate value ( q avg ). The light source of the image is identified or described by the average coordinate pair ( p avg , q avg ) in the chromaticity coordinate system.

第12圖是本發明一實施例中用於確定圖像的光源的方法1200的流程圖。方法1200可以由諸如第1B圖中所示的設備150的設備來執行,更具體地,方法1200可以由第11A圖的MPA計算器1181或第11B圖的MTV計算器1182來執行。 FIG. 12 is a flowchart of a method 1200 for determining a light source of an image according to an embodiment of the present invention. The method 1200 may be performed by a device such as the device 150 shown in FIG. 1B. More specifically, the method 1200 may be performed by the MPA calculator 1181 of FIG. 11A or the MTV calculator 1182 of FIG. 11B.

在方法1200中,設備首先開始計算圖像的一組候選光源中的每一個的指示值(步驟1210),每個候選光源由在色度坐標系中的相應的坐標對(p,q)来描述。設備確定候選光源的指示值的閾值(步驟1220);並且識別出具有不大於閾值的指示值的候選光源的子集(步驟1230)。對於子集中的所有候選光源,設備對相應的坐標對進行平均以獲得在色度坐標系中描述圖像的光源的加權平均坐標對(步驟1240)。更具體地說,該設備可以分別對這些相應的p坐標值和相應的q坐標值進行平均,以確定平均p坐標值(p avg)和平均q坐標值(q avg)。圖像的光源由色度坐標系中的加權平均坐標對(p avg,q avg)來識 別或描述。 In method 1200, the device first starts to calculate an indication value for each of a group of candidate light sources in the image (step 1210), and each candidate light source is obtained by a corresponding coordinate pair ( p, q ) in the chromaticity coordinate system. description. The device determines a threshold value of the indication value of the candidate light source (step 1220); and identifies a subset of the candidate light sources having an indication value not greater than the threshold value (step 1230). For all candidate light sources in the subset, the device averages the corresponding coordinate pairs to obtain a weighted average coordinate pair of the light sources describing the image in the chromaticity coordinate system (step 1240). More specifically, the device may average these corresponding p- coordinate values and corresponding q- coordinate values, respectively, to determine an average p- coordinate value ( p avg ) and an average q- coordinate value ( q avg ). The light source of the image is identified or described by a weighted average coordinate pair ( p avg , q avg ) in the chromaticity coordinate system.

在一些實施例中,如上文中所計算的圖像的光源可以根據用戶的要求或規範(specification)進行調整。用戶可以要求圖像在成像設備(例如,照相機)上再現,這樣所得圖像的白平衡被調整得適合顧客的顏色偏好。在一個實施例中,在色度坐標系中執行色覺適配(chromatic adaption);也就是說,在PQ色度域中執行適配。在PQ色度域中的色覺適配比LMS色彩空間中的計算複雜度簡單許多,LMS色彩空間也稱為人體感光體響應色彩空間(其中“L”代表長波長敏感度,“M”代表中等波長敏感度,“S”代表短波長敏感度,視錐細胞反應)。LMS色彩空間中的色覺適配通常需要多次3x3矩陣轉換。 In some embodiments, the light source of the image as calculated above can be adjusted according to the user's requirements or specifications. The user may require the image to be reproduced on an imaging device (eg, a camera) so that the white balance of the resulting image is adjusted to suit the customer's color preference. In one embodiment, chromatic adaption is performed in a chromaticity coordinate system; that is, adaptation is performed in the PQ chromaticity domain. The color vision adaptation in the PQ chromaticity domain is much simpler than the computational complexity in the LMS color space. The LMS color space is also called the human photoreceptor response color space (where "L" stands for long wavelength sensitivity and "M" stands Medium wavelength sensitivity, "S" stands for short wavelength sensitivity, cone response). Color vision adaptation in the LMS color space usually requires multiple 3x3 matrix conversions.

用戶可以指定目標RGB顏色。例如,用戶可以提供若干內含灰卡(gray card)的原始圖像,以及相應的目標內含灰卡的圖像。灰卡可以是任何百分比灰色或適合作為參考點的任何顏色。根據用戶給出的圖像,可以針對這些圖像中景物的亮度級(luminance level),計算原始圖像中(p origin,q origin)的值和目標圖像中(p adapt,q adapt)的值,其中(p origin,q origin)分別是色覺適配前光源的p坐標值和q坐標值;(p adapt,q adapt)分別是色覺適配後光源的p坐標值和q坐標值。 The user can specify the target RGB color. For example, the user may provide several original images with a gray card, and corresponding targets with gray card images. The gray card can be any percentage gray or any color suitable as a reference point. According to the images given by the user, the values of ( p origin , q origin ) in the original image and ( p adapt , q adapt ) in the target image can be calculated for the brightness levels of the scenes in these images. Values, where ( p origin , q origin ) are the p- coordinate and q- coordinate values of the light source before color vision adaptation; ( p adapt , q adapt ) are the p- coordinate and q- coordinate values of the light source after color vision adaptation .

基於從用戶規範推導出的(p origin,q origin)和(p adapt,q adapt),可以使用以下由等式(18)表示的模型來確定適配度Ap和AqBased on ( p origin , q origin ) and ( p adapt , q adapt ) derived from the user specification, the following models represented by equation (18) can be used to determine the degrees of adaptation A p and A q .

其中p D65q D65分別是標準光源D65的p坐標值和q 坐標值。在可替代的實施例中,可以使用諸如D50、光源E或任何其他優選的光源之類的不同的默認光源的p坐標值和q坐標值來代替p D65q D65。在一個實施例中,用戶規範所要求的和從用戶的規範中導出的適配度Ap可以包括多個Ap值範圍,每個範圍相應於一個亮度級。同樣的方法也適用於適配度AqWhere p D65 and q D65 are the p- coordinate value and the q- coordinate value of the standard light source D65, respectively. In alternative embodiments, the p- coordinate and q- coordinate values of different default light sources such as D50, light source E, or any other preferred light source may be used instead of p D65 and q D65 . In one embodiment, the adaptation degree Ap required by the user specification and derived from the user specification may include multiple ranges of Ap values, each range corresponding to a brightness level. The same method is also applicable to the fitness degree A q .

第13圖是本發明一實施例中的適配要求1310的圖表示意圖。圖表中的橫軸表示亮度級(LA),縱軸是p坐標的適配度Ap。輸入圖像中景物的亮度級(LA)可以通過圖像被拍攝時相機的曝光時間、焦距、光圈大小和信號增益計算出。在本實施例中,圖表通過由x標記的三個垂直堆棧(vertical stack)來指定適配要求1310,其中每個堆棧指示相應的亮度級的Ap值的範圍。Ap值的範圍可以由如上所述的用戶提供的圖像結合等式(18)來生成。儘管在本實施例中適配要求1310為3個相應的亮度級指定了Ap值的範圍,可以理解的是,可選擇的適配要求可以為任何數量的亮度級指定Ap值的範圍。 FIG. 13 is a schematic diagram of an adaptation requirement 1310 in an embodiment of the present invention. The horizontal axis in the graph represents the brightness level (L A ), and the vertical axis is the degree of adaptation A p of the p coordinate. The brightness level (L A ) of the scene in the input image can be calculated from the camera's exposure time, focal length, aperture size, and signal gain when the image is taken. In this embodiment, the chart specifies adaptation requirements 1310 through three vertical stacks marked by x, where each stack indicates the range of A p values for the corresponding brightness level. The range of A p values can be generated by combining user-supplied images as described above with equation (18). Although in this embodiment, the adaptation requirement 1310 specifies the range of Ap values for the three corresponding brightness levels, it can be understood that the optional adaptation requirements can specify the range of Ap values for any number of brightness levels.

在一個實施例中,作為LA的函數的單調遞增(monotonically increasing)Ap曲線1320可由曲線擬合來生成,這樣Ap曲線1320在三個給定的亮度級處通過所有三個Ap範圍。在本實施例中,Ap曲線1320可以以下面的形式表示: In one embodiment, a monotonically increasing Ap curve 1320 as a function of L A can be generated by curve fitting such that the Ap curve 1320 passes through all three Ap ranges at three given brightness levels . In this embodiment, the Ap curve 1320 can be expressed in the following form:

參數x1、x2和x3可以通過已知的曲線擬合方法來生成。類似的,用戶的要求可以包括另一個圖表,該圖表作為LA的函數,為q坐標的適配度Aq指定適配要求。例如,Aq曲線可以表示為: The parameters x 1 , x 2 and x 3 can be generated by known curve fitting methods. Similarly, a user request may include another chart that L A as a function of degree of adaptation is q A q coordinate adaptation requirements specified. For example, the A q curve can be expressed as:

參數x4、x5和x6可以通過已知的曲線擬合方法來生成。在一個可替代的實施例中,等式(19)和(20)可以包括不同數量的參數。 The parameters x 4 , x 5 and x 6 can be generated by known curve fitting methods. In an alternative embodiment, equations (19) and (20) may include different numbers of parameters.

如上文中所述的,可以通過坐標對(p,q)來描述在色度坐標系中的光源,並且可以根據圖像中景物的亮度級(LA)和該亮度級的適配度(Ap)或者適配度(Ap和Aq),來調整該光源。利用適配曲線1320,可以使用等式(18)根據給定的(p origin,q origin)找到圖表中的任何亮度級的適配光源(p adapt,q adapt)。 As described above, the light source in the chromaticity coordinate system can be described by the coordinate pair ( p, q ), and according to the brightness level (L A ) of the scene in the image and the adaptation level ( A ) of the brightness level p ) or the degree of adaptation (A p and A q ) to adjust the light source. Using the adaptation curve 1320, the equation (18) can be used to find an adapted light source ( p adapt , q adapt ) of any brightness level in the graph according to a given ( p origin , q origin ).

在一個實施例中,等式(18)可以用來找到相應於p origin T1或者p origin T2的情況下的適配光源(p adapt,q adapt),其中T1和T2標記了邊界點,超過該邊界點,圖像的顏色就需要調整。對於T1<p origin<T2,Ap=Aq=1;因此p adapt =p origin q adapt =q origin In one embodiment, equation (18) can be used to find the corresponding p origin T 1 or p origin In the case of T 2 ( p adapt , q adapt ), where T 1 and T 2 mark a boundary point, beyond which the color of the image needs to be adjusted. For T 1 < p origin <T 2 , A p = A q = 1; therefore p adapt = p origin and q adapt = q origin .

在另一個實施例中,(18)的模型可以基於q adapt 通常對Aq不敏感的觀察結果來簡化。因此,接下來以等式(21)表示的模型,可以用於在p origin T1或者p origin T2的情況下找到適配光源(p adapt,q adapt): In another embodiment, the model of (18) can be simplified based on the observation that q adapt is generally not sensitive to A q . Therefore, the following model represented by equation (21) can be used in p origin T 1 or p origin In the case of T 2 , find the adaptive light source ( p adapt , q adapt ):

其中,q offset q origin和光源軌跡之間的距離,a1、a2和a3是光源軌跡的係數(參見等式(10))。結合上文中所述的等式(18),諸如D50、光源E或任何其他優選的光源之類的不同默認光源的p坐標值和q坐標值可以用來代替p D65 and q D65。對於T1<porigin<T2,Ap=Aq=1;因此p adapt =p origin q adapt =q origin Where q offset is the distance between q origin and the light source trajectory, and a 1 , a 2 and a 3 are the coefficients of the light source trajectory (see equation (10)). In conjunction with equation (18) described above, the p- coordinate and q- coordinate values of different default light sources such as D50, light source E, or any other preferred light source can be used instead of p D65 and q D65 . For T 1 <p origin <T 2 , A p = A q = 1; therefore p adapt = p origin and q adapt = q origin .

在一些場景中,用戶的規範可以轉換為包括曲線擬合的多個區域的PQ色度域,並且為每個區域生成不同的單調遞增Ap曲線。例如,當用戶的規範轉換為PQ色度域時,可以指定LA=10時,Ap的範圍為[0,0.1];LA=11時,Ap的範圍為[0.5,0.6];LA=40時,Ap的範圍為[0.3,0.4]。在這種情況下,單獨一個單調遞增的曲線不能滿足所有要求的範圍。因此,可以使用多個區域,其中每個區域包括單獨一個單調遞增的曲線能夠滿足的Ap的範圍或者資料點。 In some scenarios, the user's specification can be converted to the PQ chromaticity domain of multiple regions including curve fitting, and a different monotonically increasing Ap curve is generated for each region. For example, when the user's specification PQ convert chrominance domain, you can specify L A = 10, A p is the range [0,0.1]; L A = 11, A p is the range [0.5, 0.6]; When L A = 40, the range of A p is [0.3,0.4]. In this case, a single monotonically increasing curve cannot meet all the required ranges. Therefore, multiple regions can be used, where each region includes a range or data point of Ap that can be satisfied by a single monotonically increasing curve.

例如,區域的邊界可以由p origin定義,例如區域1:p origin<T1;區域2:T1 p origin<T2;...;區域n:Tn-1 p origin<Tn;區域(n+1):p origin TnFor example, the boundary of a region can be defined by p origin , such as region 1: p origin <T 1 ; region 2: T 1 p origin <T 2 ; ...; area n: T n-1 p origin <T n ; area (n + 1): p origin T n .

針對每個區域i的色覺適配模型可以表示為: The color vision adaptation model for each region i can be expressed as:

其中,且其中xi1、xi2和xi3是基於用戶規範通過曲線擬合找到的。結合如上文中所述的等式(18)和(21),諸如D50、光源E或任何其他優選的光源之類的不同默認光源的p坐標值和q坐標值可以用來代替p D65q D65。區域之間的過渡是連續的,這樣一些輕微的偏移不會引起由於適配不同而導致的可見的顏色變化。 among them , And where x i1 , x i2 and x i3 are found by curve fitting based on user specifications. Combining equations (18) and (21) as described above, the p- coordinate and q- coordinate values of different default light sources such as D50, light source E or any other preferred light source can be used instead of p D65 and q D65 . The transitions between regions are continuous so that slight offsets do not cause visible color changes due to different adaptations.

第14A圖是本發明一實施例中的AWB模組1410。AWB模組1410包括耦接於色覺適配模組1450的第11A圖中的MPA計算器1181(或第3圖中的MPA計算器380),色覺適配模組1450進一步耦接於結合上文中描述的第3圖、第5 圖和第7圖中的增益調節單元350,增益調節單元350調整輸入圖像的色彩增益。儘管圖中僅示出了一個MPA計算器,但是在一些實施例中,結合上文中第5圖所述,AWB模組1410可以包括多個MPA計算器380或1181,每一個MAP計算器為輸入圖像的一個區塊計算光源(或平均光源)。色覺適配模組1450為了調整光源的(p,q)值而計算p adaptq adaptFIG. 14A is an AWB module 1410 in an embodiment of the present invention. The AWB module 1410 includes an MPA calculator 1181 (or an MPA calculator 380 in FIG. 3) coupled to the color vision adaptation module 1450 in FIG. 11A, and the color vision adaptation module 1450 is further coupled to the combination The gain adjustment unit 350 described above in FIGS. 3, 5, and 7 adjusts the color gain of the input image. Although only one MPA calculator is shown in the figure, in some embodiments, in combination with Figure 5 above, the AWB module 1410 may include multiple MPA calculators 380 or 1181, and each MAP calculator is an input One block of the image calculates the light source (or average light source). The color vision adaptation module 1450 calculates p adapt and q adapt in order to adjust the ( p, q ) value of the light source.

第14B圖是本發明另一實施例中的AWB模組1420。AWB模組1420包括耦接於色覺適配模組1450的第11B圖中的MTV計算器1182(或第7圖中的MTV計算器780),色覺適配模組1450進一步耦接於增益調節單元350。色覺適配模組1450為了調整光源的(p,q)值而計算p adaptq adaptFIG. 14B is an AWB module 1420 in another embodiment of the present invention. The AWB module 1420 includes an MTV calculator 1182 (or an MTV calculator 780 in FIG. 7) coupled to the color vision adaptation module 1450 in FIG. 11B. The color vision adaptation module 1450 is further coupled to the gain. Adjusting unit 350. The color vision adaptation module 1450 calculates p adapt and q adapt in order to adjust the ( p, q ) value of the light source.

第15圖是本發明一實施例中基於一組亮度級的適配要求而對圖像進行色覺適配的方法1500的流程圖。方法1500可以由諸如第1B圖中的設備150的設備來執行;更具體地,方法1500可以由第14A圖中的AWB模組1410或第14B圖中的AWB模組1420來執行。 FIG. 15 is a flowchart of a method 1500 for performing color vision adaptation on an image based on a set of brightness level adaptation requirements according to an embodiment of the present invention. The method 1500 may be performed by a device such as the device 150 in FIG. 1B; more specifically, the method 1500 may be performed by an AWB module 1410 in FIG. 14A or an AWB module 1420 in FIG. 14B.

在方法1500中,設備首先開始計算圖像的光源(步驟1510),其中光源由在色度坐標系中的坐標對(p,q)來描述。設備識別圖像中景物的亮度級(步驟1520);以及使用至少部分地根據適配要求和圖像中景物的亮度級推導出的適配度,來調整光源的坐標對(p,q),以獲得適配光源(步驟1530)。設備將圖像的顏色適配於適配光源(步驟1540)。 In method 1500, the device first starts to calculate the light source of the image (step 1510), where the light source is described by a coordinate pair ( p, q ) in a chromaticity coordinate system. The device recognizes the brightness level of the scene in the image (step 1520); and adjusts the coordinate pair ( p, q ) of the light source using an adaptation degree derived at least in part based on the adaptation requirements and the brightness level of the scene in the image, To obtain a suitable light source (step 1530). The device adapts the color of the image to the adapted light source (step 1540).

參考第1A圖、第1B圖、第3圖、第5圖、第7圖、第11A圖、第11B圖、第14A圖和第14B圖中的實施例 來描述第6圖、第8圖、第9圖、第12圖和第15圖中的流程圖中的操作。然而,應當理解的是,流程圖中的操作可以被本發明中除了參考第1A圖、第1B圖、第3圖、第5圖、第7圖、第11A圖、第11B圖、第14A圖和第14B圖中所討論的實施例以外的實施例來執行,且第1A圖、第1B圖、第3圖、第5圖、第7圖、第11A圖、第11B圖、第14A圖和第14B圖中所討論的實施例可以執行與參考流程圖所討論的操作不同的操作。雖然流程圖示出了由本發明的某些實施例執行的操作的特定順序,但是應當理解的是,這樣的順序是示例性的(例如,替代實施例可以以不同順序執行操作,組合某些操作,重疊某些操作等)。 Referring to Figs. 1A, 1B, 3, 5, 5, 7, 7, 11A, 11B, 14A, and 14B, the descriptions of Figs. 6 and 8 will be described. The operations in the flowcharts of FIGS. 9, 12 and 15. However, it should be understood that the operations in the flowchart can be referred to in the present invention in addition to FIG. 1A, FIG. 1B, FIG. 3, FIG. 5, FIG. 7, FIG. 11A, FIG. 11B, and FIG. 14A. And other embodiments than those discussed in FIG. 14B, and FIG. 1A, FIG. 1B, FIG. 3, FIG. 5, FIG. 7, FIG. 11A, FIG. 11B, FIG. 14A, and FIG. The embodiment discussed in FIG. 14B may perform operations different from those discussed with reference to the flowchart. Although the flowchart illustrates a particular order of operations performed by certain embodiments of the invention, it should be understood that such an order is exemplary (e.g., alternative embodiments may perform the operations in a different order, combining certain operations , Overlapping certain operations, etc.).

區別於現有技術,本發明通過計算一組候選光源中的每一個候選光源的指示值,其中每一個候選光源都由相應的坐標對(p,q)在色度坐標系中描述;確定候選光源的指示值的閾值;識別具有不大於閾值的指示值的候選光源的子集;以及對於該子集中的所有候選光源,計算該相應的坐標對的加權平均值,獲得用於在該色度坐標系中描述該圖像的該光源的平均坐標對,這樣可以找到最接近圖像的真實光源,降低白平衡對場景內容的敏感度,使得白平衡方法更加穩定。再根據計算出的光源識別圖像的光源的亮度級;使用根據適配要求和圖像中景物的亮度級推導出的一個或多個適配度來至少部分地調整光源的坐標對(p,q)以獲得適配光源;以及調節圖像的顏色使其適合適配光源。這樣可以根據給定的規範有效地執行色覺適配。 Different from the prior art, the present invention calculates an indication value of each candidate light source in a group of candidate light sources, where each candidate light source is described in a chromaticity coordinate system by a corresponding coordinate pair ( p, q ); determining the candidate light source The threshold value of the indication value of; identifying a subset of candidate light sources having an indication value that is not greater than the threshold value; and for all candidate light sources in the subset, calculating a weighted average of the corresponding coordinate pair to obtain a color coordinate for the The average coordinate pair of the light source of the image is described in the system, so that the real light source closest to the image can be found, the sensitivity of the white balance to the content of the scene is reduced, and the white balance method is more stable. Then, the brightness level of the light source of the image is identified according to the calculated light source; one or more adaptation degrees derived from the adaptation requirements and the brightness level of the scene in the image are used to at least partially adjust the coordinate pair of the light source ( p, q ) obtaining a suitable light source; and adjusting the color of the image to fit the light source. This can effectively perform color vision adaptation according to a given specification.

這裡已經描述了各種功能組件或區塊。如所屬領域中具有習知技術者將理解的,功能區塊將優選地通過電路(專用電路或在一個或多個處理器和編碼指令的控制下操作的通用電路)來實現,其通常包括晶體管,晶體管被配置為根據這裡所描述的功能和操作來控制電路的操作。 Various functional components or blocks have been described here. As will be understood by those skilled in the art, functional blocks will preferably be implemented by circuits (dedicated circuits or general purpose circuits that operate under the control of one or more processors and coded instructions), which typically include transistors The transistor is configured to control the operation of the circuit in accordance with the functions and operations described herein.

儘管本發明已經通過若干實施例進行了描述,但是所屬領域中具有習知技術者將認識到,本發明不限於所描述的實施例,並且可以在所附權利要求的精神和範圍內進行修改和變更來實施。因此該描述被認為是說明性的而不是限制性的。 Although the invention has been described in terms of several embodiments, those skilled in the art will recognize that the invention is not limited to the described embodiments and can be modified and modified within the spirit and scope of the appended claims. Change to implement. The description is therefore to be regarded as illustrative instead of restrictive.

Claims (22)

一種確定圖像的光源的方法,包括:計算該圖像的一組候選光源中的每一個的指示值,其中每一個該候選光源由在色度坐標系中的相應的坐標對( p,q)來描述;確定該候選光源的該指示值的閾值;識別具有不大於該閾值的該指示值的該候選光源的子集;以及對於該子集中的所有候選光源,計算該相應的坐標對的加權平均,獲得在該色度坐標系中描述該圖像的該光源的平均坐標對( p avgq avg)。 A method for determining a light source of an image, comprising: calculating an indication value of each of a group of candidate light sources of the image, wherein each of the candidate light sources is represented by a corresponding coordinate pair ( p, q in a chromaticity coordinate system) ) To determine; determine the threshold value of the indication value of the candidate light source; identify a subset of the candidate light source having the indication value not greater than the threshold value; and for all candidate light sources in the subset, calculate the Weighted average to obtain the average coordinate pair ( p avg , q avg ) of the light source describing the image in the chromaticity coordinate system. 如申請專利範圍第1項所述之方法,其中,計算該相應的坐標對的加權平均的步驟進一步包括:分別對相應的 p坐標值和相應的 q坐標值進行平均,以確定平均 p坐標值( p avg)和平均 q坐標值( q avg),其中該平均坐標對( p avgq avg)在該色度坐標系中描述該圖像的該光源。 The method according to item 1 of the scope of patent application, wherein the step of calculating the weighted average of the corresponding coordinate pair further comprises: averaging the corresponding p- coordinate value and the corresponding q- coordinate value, respectively, to determine the average p- coordinate value ( p avg ) and an average q coordinate value ( q avg ), where the average coordinate pair ( p avg , q avg ) describes the light source of the image in the chromaticity coordinate system. 如申請專利範圍第1項所述之方法,其中,該指示值是通過將該圖像投影到垂直於表示候選光源的三色值的向量的投影平面上而產生的投影面積。     The method according to item 1 of the scope of patent application, wherein the indication value is a projection area generated by projecting the image on a projection plane perpendicular to a vector representing a three-color value of the candidate light source.     如申請專利範圍第1項所述之方法,其中,該指示值是相鄰像素之間的三色值的總變差,其中計算該總變差的步驟進一步包括:計算該三色值的線性變換以獲得三個變換值;計算第一縮放因子和第二縮放因子,該第一縮放因子和該 第二縮放因子用於表示該候選光源的兩個色彩比率;通過獲取按該第一縮放因子縮放後的第一變換值與第二變換值之間的差值來構建第一色度圖像;通過獲取按該第二縮放因子縮放後的第三變換值與該第二變換值之間的差值來構建第二色度圖像;以及通過將該第一色度圖像的絕對梯度大小和該第二色度圖像的絕對梯度大小相加來計算該總變差。     The method according to item 1 of the scope of patent application, wherein the indication value is a total variation of three-color values between adjacent pixels, and the step of calculating the total variation further includes: calculating a linearity of the three-color values Transform to obtain three transform values; calculate a first scaling factor and a second scaling factor, the first scaling factor and the second scaling factor being used to represent two color ratios of the candidate light source; Constructing a first chroma image by the difference between the scaled first transformation value and the second transformation value; obtaining the difference between the third transformation value scaled by the second scaling factor and the second transformation value Constructing a second chroma image by the difference; and calculating the total variation by adding the absolute gradient size of the first chroma image and the absolute gradient size of the second chroma image.     如申請專利範圍第1項所述之方法,其中,當該指示值中的最小值由不是邊界候選光源之一的候選光源生成時,該閾值被設置為高於該指示值中的最小值,其中每個該邊界候選光源具有位於該色度坐標系中包括該圖像的所有該候選光源的區間或空間的邊界處的 p坐標值。 The method according to item 1 of the scope of patent application, wherein when the minimum value in the indication value is generated by a candidate light source that is not one of the boundary candidate light sources, the threshold value is set higher than the minimum value in the indication value, Each of the boundary candidate light sources has a p- coordinate value located at a boundary of an interval or space of all the candidate light sources including the image in the chromaticity coordinate system. 如申請專利範圍第1項所述之方法,其中,當該指示值中的最小值由邊界候選光源之一的候選光源來產生時,該閾值被設置為該指示值中的該最小值,其中每個該邊界候選光源具有位於該色度坐標系中包括該圖像的所有該候選光源的區間或空間的邊界處的 p坐標值。 The method according to item 1 of the patent application range, wherein when the minimum value of the indication value is generated by a candidate light source of one of the boundary candidate light sources, the threshold value is set to the minimum value of the indication value, wherein Each of the boundary candidate light sources has a p- coordinate value located at a boundary of an interval or space of all the candidate light sources including the image in the chromaticity coordinate system. 一種對圖像進行色覺適配的方法,包括:計算該圖像的光源,其中該光源由在色度坐標系中的坐標對( p,q)來描述;識別該圖像中景物的亮度級;使用至少部分地根據適配要求和該圖像中景物的該亮度級推導出的一個或多個適配度,來調整該光源的該坐標對( p,q),以獲得適配光源;以及 將該圖像的顏色適配於該適配光源。 A method for color vision adaptation of an image, comprising: calculating a light source of the image, wherein the light source is described by a coordinate pair ( p, q ) in a chromaticity coordinate system; identifying the brightness of a scene in the image Level; adjusting the coordinate pair ( p, q ) of the light source using one or more adaptation degrees derived at least in part based on the adaptation requirements and the brightness level of the scene in the image to obtain an adapted light source ; And adapting the color of the image to the adapted light source. 如申請專利範圍第7項所述之方法,其中,該調整該坐標對的步驟進一步包括:根據用於該亮度級的適配度來縮放該光源的 p坐標值;以及將縮放後的該 p坐標值添加縮放(1-該適配度)的倍數的默認光源的 p坐標值,以獲取該適配光源的適配 p坐標值。 The method according to item 7 of the scope of patent application, wherein the step of adjusting the coordinate pair further comprises: scaling the p- coordinate value of the light source according to the degree of adaptation for the brightness level; and scaling the p The coordinate value is added to the p- coordinate value of the default light source which is a multiple of scaling (1-the adaptation degree) to obtain the adapted p- coordinate value of the adapted light source. 如申請專利範圍第8項所述之方法,其中,通過評估該適配 p坐標值的函數,來計算該適配光源的適配 q坐標值。 The application method of claim 8 patentable scope item, wherein by evaluating the adaptation function of coordinate values p, q is adapted to calculate the coordinate value of the adaptation of the light source. 如申請專利範圍第7項所述之方法,其中,該方法進一步包括:根據用於該亮度級的適配度來縮放該光源的 q坐標值;以及將縮放後的該 q坐標值添加縮放(1-該適配度)的倍數的默認光源的 q坐標值,以獲取該適配光源的適配 q坐標值。 The method according to item 7 of the scope of patent application, wherein the method further comprises: scaling the q- coordinate value of the light source according to the degree of adaptation for the brightness level; and adding scaling to the q- coordinate value after scaling ( 1-the degree of adaptation) of the default q- coordinate value of the light source to obtain the adapted q- coordinate value of the adapted light source. 如申請專利範圍第7項所述之方法,其中,該方法進一步包括:基於該適配要求,計算該 p坐標值的不同區域的不同適配曲線;以及在計算該圖像的該光源之後,根據該光源的該 p坐標值識別該區域之一和該適配曲線之一,以用於計算該適配光源。 The method according to item 7 of the scope of patent application, wherein the method further comprises: calculating different adaptation curves of different regions of the p- coordinate value based on the adaptation requirement; and after calculating the light source of the image, One of the region and one of the adaptation curves are identified according to the p- coordinate value of the light source, for calculating the adapted light source. 一種用於確定圖像的光源的設備,包括:存儲器,用於存儲該圖像;以及圖像處理管道,耦接於該存儲器,用於:計算該圖像的一組候選光源中的每一個的指示值,其中每 一個該候選光源由在色度坐標系中的相應的坐標對( p,q)來描述;確定該候選光源的該指示值的閾值;識別具有不大於該閾值的該指示值的該候選光源的子集;以及對於該子集中的所有候選光源,計算該相應的坐標對的加權平均,獲得在該色度坐標系中描述該圖像的該光源的平均坐標對( p avgq avg)。 An apparatus for determining a light source of an image, comprising: a memory for storing the image; and an image processing pipeline coupled to the memory for: calculating each of a set of candidate light sources for the image , Where each candidate light source is described by a corresponding coordinate pair ( p, q ) in the chromaticity coordinate system; determining the threshold value of the indication value of the candidate light source; identifying the indication having a value not greater than the threshold value A subset of the candidate light source values; and for all candidate light sources in the subset, calculating a weighted average of the corresponding coordinate pair to obtain an average coordinate pair of the light source describing the image in the chromaticity coordinate system ( p avg , q avg ). 如申請專利範圍第12項所述之設備,其中,當計算該相應的坐標對的該加權平均時,該圖像處理管道進一步用於:分別對相應的 p坐標值和相應的 q坐標值進行平均,以確定平均 p坐標值( p avg)和平均 q坐標值( q avg),其中該平均坐標對( p avgq avg)在該色度坐標系中描述該圖像的該光源。 The device according to item 12 of the scope of patent application, wherein, when calculating the weighted average of the corresponding coordinate pair, the image processing pipeline is further used for: respectively performing a corresponding p- coordinate value and a corresponding q- coordinate value Average to determine an average p- coordinate value ( p avg ) and an average q- coordinate value ( q avg ), where the average coordinate pair ( p avg , q avg ) describes the light source of the image in the chromaticity coordinate system. 如申請專利範圍第12項所述之設備,其中,該指示值是通過將該圖像投影到垂直於表示候選光源的三色值的向量的投影平面上而產生的投影面積。     The device according to item 12 of the scope of patent application, wherein the indication value is a projection area generated by projecting the image onto a projection plane perpendicular to a vector representing a three-color value of the candidate light source.     如申請專利範圍第12項所述之設備,其中,該指示值是相鄰像素之間的三色值的總變差,當計算該總變差時,該圖像處理管道進一步用於:計算該三色值的線性變換以獲得三個變換值;計算第一縮放因子和第二縮放因子,該第一縮放因子和該第二縮放因子用於表示該候選光源的兩個色彩比率;通過獲取按該第一縮放因子縮放後的第一變換值與第二變換值之間的差值來構建第一色度圖像; 通過獲取按該第二縮放因子縮放後的第三變換值與該第二變換值之間的差值來構建第二色度圖像;以及通過將該第一色度圖像的絕對梯度大小和該第二色度圖像的絕對梯度大小相加來計算該總變差。     The device according to item 12 of the scope of patent application, wherein the indication value is the total variation of the three-color values between adjacent pixels. When calculating the total variation, the image processing pipeline is further used for: calculating Linear conversion of the three color values to obtain three transform values; calculating a first scaling factor and a second scaling factor, the first scaling factor and the second scaling factor being used to represent two color ratios of the candidate light source; Constructing a first chroma image by a difference between the first transformed value and the second transformed value scaled by the first scaling factor; obtaining a third transformed value scaled by the second scale factor and the first transformed value Constructing a second chroma image by the difference between the two transform values; and calculating the total change by adding the absolute gradient size of the first chroma image and the absolute gradient size of the second chroma image difference.     如申請專利範圍第12項所述之設備,其中,當該指示值中的最小值由不是邊界候選光源之一的候選光源生成時,該閾值被設置為高於該指示值中的該最小值,其中每個該邊界候選光源具有位於該色度坐標系中一個包括該圖像的所有該候選光源的區間或空間的邊界處的 p坐標值。 The device according to item 12 of the scope of patent application, wherein when the minimum value in the indication value is generated by a candidate light source that is not one of the boundary candidate light sources, the threshold value is set higher than the minimum value in the indication value , Wherein each of the boundary candidate light sources has a p- coordinate value located at a boundary of an interval or space of all the candidate light sources including the image in the chromaticity coordinate system. 如申請專利範圍第12項所述之設備,其中,當該指示值中的該最小值由邊界候選光源之一的候選光源產生時,該閾值被設置為該指示值中的該最小值,其中每個該邊界候選光源具有位於該色度坐標系中一個包括該圖像的所有該候選光源的區間或空間的邊界處的 p坐標值。 The device according to item 12 of the scope of patent application, wherein when the minimum value in the indication value is generated by a candidate light source of one of the boundary candidate light sources, the threshold value is set to the minimum value in the indication value, wherein Each of the boundary candidate light sources has a p- coordinate value located at a boundary of an interval or space including all the candidate light sources of the image in the chromaticity coordinate system. 一種對圖像進行色覺適配的設備,包括:存儲器,用於存儲該圖像;以及圖像處理管道,耦接於該存儲器,用於:計算該圖像的光源,其中該光源由在色度坐標系中的坐標對( p,q)來描述;識別該圖像中景物的亮度級;使用至少部分地根據該適配要求和該圖像中景物的該亮度級推導出的一個或多個適配度,來調整該光源的該坐標對( p,q),以獲得適配光源;以及將該圖像的顏色適配於該適配光源。 A device for color vision adaptation of an image includes: a memory for storing the image; and an image processing pipeline coupled to the memory for: calculating a light source of the image, wherein the light source is composed of Describe the coordinate pair ( p, q ) in the chromaticity coordinate system; identify the brightness level of the scene in the image; use one or at least partially derived from the adaptation requirements and the brightness level of the scene in the image Multiple adaptation degrees to adjust the coordinate pair ( p, q ) of the light source to obtain an adapted light source; and adapt the color of the image to the adapted light source. 如申請專利範圍第18項所述之設備,其中,當調整該坐標對時,該圖像處理管道進一步用於:根據用於該亮度級的適配度來縮放該光源的 p坐標值;以及將縮放後的該 p坐標值添加到縮放(1-該適配度)的倍數的默認光源的 p坐標值,以獲取該適配光源的該適配 p坐標值。 The device according to item 18 of the scope of patent application, wherein when adjusting the coordinate pair, the image processing pipeline is further configured to: scale the p- coordinate value of the light source according to the degree of adaptation for the brightness level; and the coordinate values of the p-scaled coordinate values p added to the scaled multiple of the default light source (1 the adaptation degree), adapted to obtain the coordinate value of the p light source adapted. 如申請專利範圍第19項所述之設備,其中,當調整該坐標對時,該圖像處理管道進一步用於:通過評估該適配 p坐標值的函數,來計算該適配光源的適配 q坐標值。 The device according to item 19 of the scope of patent application, wherein when adjusting the coordinate pair, the image processing pipeline is further configured to calculate an adaptation of the adapted light source by evaluating a function of the adapted p coordinate value. q coordinate value. 如申請專利範圍第18項所述之設備,其中,當調整該坐標對時,該圖像處理管道進一步用於:根據用於該亮度級的適配度來縮放該光源的 q坐標值;以及將縮放後的該 q坐標值添加縮放(1-該適配度)的倍數的該默認光源的 q坐標值,以獲取該適配光源的適配 q坐標值。 The device according to item 18 of the scope of patent application, wherein when adjusting the coordinate pair, the image processing pipeline is further configured to: scale the q- coordinate value of the light source according to the adaptability for the brightness level; the default value of the source coordinate q q coordinate value of the added scaled the scaling (l the adaptation of) a multiple of q coordinate value for the adaptation of the adaptation of the light source. 如申請專利範圍第18項所述之設備,其中,當調整該坐標對時,該圖像處理管道進一步用於:基於該適配要求,計算該 p坐標值的不同區域的不同適配曲線;以及在計算該圖像的該光源之後,根據該光源的該 p坐標值識別該區域之一和該適配曲線之一,以用於計算該適配光源。 The device according to item 18 of the scope of patent application, wherein when adjusting the coordinate pair, the image processing pipeline is further used for: calculating different adaptation curves of different regions of the p- coordinate value based on the adaptation requirement; And after the light source of the image is calculated, one of the region and one of the adaptation curves are identified according to the p- coordinate value of the light source for calculating the adapted light source.
TW107104182A 2017-02-06 2018-02-06 Method and apparatus for determining a light source of an image and performing color vision adaptation on the image TWI649724B (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
US15/425,113 US10224004B2 (en) 2017-02-06 2017-02-06 Automatic white balance based on surface reflection decomposition
US15/425,113 2017-02-06
US15/675,221 US20180176420A1 (en) 2016-12-20 2017-08-11 Automatic white balance based on surface reflection decomposition and chromatic adaptation
US15/675,221 2017-08-11

Publications (2)

Publication Number Publication Date
TW201830335A true TW201830335A (en) 2018-08-16
TWI649724B TWI649724B (en) 2019-02-01

Family

ID=63239431

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107104182A TWI649724B (en) 2017-02-06 2018-02-06 Method and apparatus for determining a light source of an image and performing color vision adaptation on the image

Country Status (2)

Country Link
CN (1) CN108462865A (en)
TW (1) TWI649724B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI720628B (en) * 2018-12-26 2021-03-01 大陸商深圳朗田畝半導體科技有限公司 Method and apparatus for enhancing brightness and contrast of video image,storage medium and electronic device

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111670575B (en) * 2019-01-07 2021-09-21 华为技术有限公司 White balance processing method and device for image
TWI766492B (en) * 2020-12-22 2022-06-01 鴻海精密工業股份有限公司 Method and device for determining light source, computer device and storage medium

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007060118A (en) * 2005-08-23 2007-03-08 Casio Comput Co Ltd Projector and projection control method
EP2197248A1 (en) * 2007-09-26 2010-06-16 Toshiba Lighting & Technology Corporation Illuminating apparatus
US7945094B2 (en) * 2008-01-16 2011-05-17 Eastman Kodak Company Method for chromatic adaptation of images
CN101282489B (en) * 2008-04-24 2010-11-10 北京中星微电子有限公司 Light source detection apparatus and method as well as image processing method
CA2726146A1 (en) * 2008-06-25 2009-12-30 Tomtom International B.V. Navigation apparatus and method of detection that a parking facility is sought
US8665296B2 (en) * 2008-10-21 2014-03-04 Zulch Laboratories, Inc. Color generation change using multiple illuminant types
US8483479B2 (en) * 2009-05-11 2013-07-09 Dolby Laboratories Licensing Corporation Light detection, color appearance models, and modifying dynamic range for image display
CN101794565B (en) * 2010-03-31 2013-12-11 青岛海信电器股份有限公司 Image display method, device and system
CN102563545B (en) * 2010-12-17 2015-05-06 杜比实验室特许公司 Quantum dots modulation for display panels
CN102572211B (en) * 2010-12-20 2015-11-25 韩华泰科株式会社 Estimate the method and apparatus of light source
CN102737610B (en) * 2011-03-31 2015-02-11 青岛海信电器股份有限公司 Method and apparatus for adjusting light source brightness, and display device
US9196189B2 (en) * 2011-05-13 2015-11-24 Pixtronix, Inc. Display devices and methods for generating images thereon
JP6045378B2 (en) * 2012-05-10 2016-12-14 キヤノン株式会社 Information processing apparatus, information processing method, and program

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI720628B (en) * 2018-12-26 2021-03-01 大陸商深圳朗田畝半導體科技有限公司 Method and apparatus for enhancing brightness and contrast of video image,storage medium and electronic device
US11205252B2 (en) 2018-12-26 2021-12-21 Shenzhen Lontium Semiconductor Technology Co., Ltd. Method and device for enhancing brightness and contrast of video image

Also Published As

Publication number Publication date
TWI649724B (en) 2019-02-01
CN108462865A (en) 2018-08-28

Similar Documents

Publication Publication Date Title
US10535125B2 (en) Dynamic global tone mapping with integrated 3D color look-up table
US11849224B2 (en) Global tone mapping
Afifi et al. When color constancy goes wrong: Correcting improperly white-balanced images
US10542243B2 (en) Method and system of light source estimation for image processing
US9479750B2 (en) Spectral synthesis for image capture device processing
TW201830337A (en) Method and device for performing automatic white balance on an image
EP2227898B1 (en) Image sensor apparatus and method for scene illuminant estimation
US11277595B2 (en) White balance method for image and terminal device
US20150348245A1 (en) Color correction parameter computation method, color correction parameter computation device, and image output system
US9961236B2 (en) 3D color mapping and tuning in an image processing pipeline
TWI649724B (en) Method and apparatus for determining a light source of an image and performing color vision adaptation on the image
CN109587466B (en) Method and apparatus for color shading correction
Kao et al. Design considerations of color image processing pipeline for digital cameras
CN111491149A (en) Real-time image matting method, device, equipment and storage medium based on high-definition video
US20180176420A1 (en) Automatic white balance based on surface reflection decomposition and chromatic adaptation
US20180176528A1 (en) Light locus generation for automatic white balance
EP3063931A1 (en) Two-dimensional color transformations for wide gamut workflows in digital cameras
US9036030B2 (en) Color calibration of an image capture device in a way that is adaptive to the scene to be captured
Lam et al. Automatic white balancing using luminance component and standard deviation of RGB components [image preprocessing]
CN115426487B (en) Color correction matrix adjustment method, device, electronic equipment and readable storage medium
CN113271450B (en) White balance adjusting method, image processing device and image processing system
Jo et al. Adaptive white point extraction based on dark channel prior for automatic white balance
US10068346B2 (en) Color distance determination
KR20020088645A (en) Illuminant-adaptive color matching apparatus and method there of
Wang et al. A robust embedded vision system feasible white balance algorithm

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees