TW202008311A - Image saturation adjusting method and device - Google Patents
Image saturation adjusting method and device Download PDFInfo
- Publication number
- TW202008311A TW202008311A TW108126621A TW108126621A TW202008311A TW 202008311 A TW202008311 A TW 202008311A TW 108126621 A TW108126621 A TW 108126621A TW 108126621 A TW108126621 A TW 108126621A TW 202008311 A TW202008311 A TW 202008311A
- Authority
- TW
- Taiwan
- Prior art keywords
- saturation
- primitive
- image
- max
- value
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/646—Circuits for processing colour signals for image enhancement, e.g. vertical detail restoration, cross-colour elimination, contour correction, chrominance trapping filters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Image Processing (AREA)
- Processing Of Color Television Signals (AREA)
Abstract
Description
本申請要求於2018年08月01日提交中國專利局、申請號為201810867044.2、發明名稱為“一種圖像飽和度調整方法和裝置”的中國專利申請的優先權,其全部內容通過引用結合在本申請中。 This application requires the priority of the Chinese patent application filed on August 01, 2018 in the Chinese Patent Office with the application number 201810867044.2 and the invention titled "An Image Saturation Adjustment Method and Device", the entire contents of which are incorporated herein by reference Applying.
本發明涉及電子資訊技術領域,具體為一種圖像飽和度調整方法和裝置。 The invention relates to the field of electronic information technology, in particular to an image saturation adjustment method and device.
視訊訊號是指電視信號、靜止圖像信號和可視電視圖像信號。視訊訊號在傳輸、接收和處理過程中會造成圖像品質的下降,並且視頻編碼壓縮傳輸也會破壞圖像品質。為了滿足用戶對高清晰、高畫質的視覺要求。需要對在視訊訊號傳輸、接收和處理過程中出現的低品質的圖像,以及視頻編碼壓縮傳輸過程中被破壞的圖像進行處理。 Video signals refer to television signals, still image signals, and visual television image signals. Video signals will cause image quality degradation during transmission, reception and processing, and video encoding compression transmission will also destroy image quality. In order to meet the user's visual requirements for high definition and high image quality. It is necessary to process low-quality images that occur during the transmission, reception, and processing of video signals, and images that are destroyed during the compression and transmission of video encoding.
現有技術中,多採用對圖像的色彩飽和度進行調節,即對圖像的色彩色調、色彩鮮豔度和畫面清晰度的進行調整的方式,提高圖像畫面的顯示效果。但是,在對圖像的色彩飽和度調節過程中,會因為色彩飽和度的調整過度或不足導致圖像中色彩失真問題出現。 In the prior art, the method of adjusting the color saturation of the image, that is, the adjustment of the color hue, color vividness, and picture clarity of the image is mostly used to improve the display effect of the image picture. However, in the process of adjusting the color saturation of the image, the problem of color distortion in the image will occur due to excessive or insufficient adjustment of the color saturation.
有鑑於此,本發明實施例提供了一種圖像飽和度調整方法和裝置,對圖像飽和度進行處理,以解決圖像色彩飽和度的調整過度或不足導致圖像色彩失真問題。 In view of this, embodiments of the present invention provide an image saturation adjustment method and device, which process image saturation to solve the problem of image color distortion caused by excessive or insufficient adjustment of image color saturation.
為實現上述目的,本發明實施例提供如下技術方案:一種圖像飽和度調整方法,包括:將紅綠藍RGB色度空間圖像轉換為亮度色度分量YCbCr色度空間圖像; To achieve the above object, the embodiments of the present invention provide the following technical solution: An image saturation adjustment method, including: converting a red, green, and blue RGB chromaticity space image into a luminance chromaticity component YC b C r chromaticity space image;
基於所述YCbCr色度空間圖像中的每個圖元的色度分量Cb和色度分量Cr計算每個圖元的飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin; The saturation S of each primitive is calculated based on the chroma component C b and the chroma component C r of each primitive in the YC b C r chromaticity space image, and the YC b C r chromaticity space is determined The maximum saturation S max and the minimum saturation S min in the image ;
分別基於每個圖元的修正因數c對每個圖元的飽和度S進行修正,得到修正飽和度後的圖像; Correct the saturation S of each primitive based on the correction factor c of each primitive, respectively, to obtain the image after correction of saturation;
其中,所述修正因數c=k×△Smax,△Smax是飽和度調整變數,△Smax取值為所述最大飽和度Smax和當前圖元的飽和度S的差值,k為常量,k的取值為大於0的正數。 Wherein, the correction factor c=k×△S max , △S max is the saturation adjustment variable, △S max is the difference between the maximum saturation S max and the saturation S of the current primitive, k is Constant, the value of k is a positive number greater than 0.
優選的,所述基於所述亮度色度分量YCbCr色度空間圖像中的色度分量Cb和色度分量Cr計算每個圖元的飽和度S,包括: Preferably, the calculating the saturation S of each primitive based on the chroma component C b and the chroma component C r in the luma-chroma component YC b C r chroma space image includes:
確定所述YCbCr色度空間圖像中每個圖元的色度分量Cb和色度分量Cr; Determine the chrominance component C b and the chrominance component C r of each primitive in the YC b C r chromaticity space image;
根據公式計算每個圖元的飽和度S。 According to the formula Calculate the saturation S of each primitive.
優選的,所述分別基於每個圖元的修正因數c對每個圖元的飽和度S進行修正中,對當前圖元的飽和度S進行修正的過程包括: Preferably, in the process of correcting the saturation S of each primitive based on the correction factor c of each primitive, the process of correcting the saturation S of the current primitive includes:
獲取當前圖像圖元點的飽和度S,計算所述最大飽和度Smax和當前圖元的飽和度S的差值,確定當前圖元的飽和度調整變數△Smax; Obtain the saturation S of the current image primitive point, calculate the difference between the maximum saturation S max and the current primitive saturation S, and determine the saturation adjustment variable △S max of the current primitive;
基於所述當前圖元的飽和度調整變數△Smax和常量k的乘積,得到當前圖元的修正因數c; Adjust the product of the variable ΔS max and the constant k based on the saturation of the current primitive to obtain the correction factor c of the current primitive;
根據公式對當前圖元的飽和度S進行修正; According to the formula Correct the saturation S of the current primitive;
其中,當所述當前圖元的修正因數c大於0時,提高所述當前圖元的飽和度S,當所述當前圖元的修正因數c小於0時,降低所述當前圖元的飽和度S。 Wherein, when the correction factor c of the current picture element is greater than 0, increase the saturation S of the current picture element, and when the correction factor c of the current picture element is less than 0, decrease the saturation degree of the current picture element S.
優選的,所述常量k的取值範圍為大於0小於1的正數。 Preferably, the value range of the constant k is a positive number greater than 0 and less than 1.
優選的,所述常量k的取值為控制因數k1與控制因數k2的乘積; Preferably, the value of the constant k is the product of the control factor k1 and the control factor k2;
所述控制因數k1的設定過程包括: The setting process of the control factor k1 includes:
將所述最小飽和度Smin至最大飽和度Smax構成的飽和度區間按照N等分進行劃分,得到N個飽和度區間,N為大於等於5的正整數; Divide the saturation interval formed from the minimum saturation S min to the maximum saturation S max according to N equal divisions to obtain N saturation intervals, where N is a positive integer greater than or equal to 5;
設定第一飽和度區間對應的控制因數k1的取值為M,所述M的取值為大於0小於1的正數; Set the value of the control factor k1 corresponding to the first saturation interval to M, and the value of M is a positive number greater than 0 and less than 1;
設定第二飽和度區間至第N飽和度區間對應的控制因數k1在M值的基礎上以預設值m遞增,所述預設值m的取值為大於0小於1的正數; Set the control factor k1 corresponding to the second saturation interval to the Nth saturation interval to increase on the basis of the M value by a preset value m, and the value of the preset value m is a positive number greater than 0 and less than 1;
所述控制因數k2的設定過程包括:獲取所述YCbCr色度空間圖像中的每個圖元的亮度分量Y; The setting process of the control factor k2 includes: obtaining the luminance component Y of each primitive in the YC b C r chromaticity space image;
基於每個圖元的亮度分量Y對[20,220]的強度範圍按照N等分進行劃分,得到N個亮度區間,所述N個亮度區間對應的控制因數K2的取值由對應亮度分量Y所在區間確定。 The intensity range of [20,220] is divided into N equal parts based on the luminance component Y of each primitive to obtain N luminance intervals, and the value of the control factor K2 corresponding to the N luminance intervals is determined by the interval where the corresponding luminance component Y is located determine.
本發明第二方面公開了一種圖像飽和度調整裝置,所述裝置包括: A second aspect of the present invention discloses an image saturation adjustment device. The device includes:
轉換單元,用於將紅綠藍RGB色度空間圖像轉換為亮度色度分量YCbCr色度空間圖像; The conversion unit is used to convert the red, green and blue RGB chromaticity space image into the luminance chrominance component YC b C r chromaticity space image;
計算單元,用於基於所述YCbCr色度空間圖像中的每個圖元的色度分量Cb和色度分量Cr計算每個圖元的飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin; A calculation unit for calculating the saturation S of each primitive based on the chroma component C b and the chroma component C r of each primitive in the YC b C r chromaticity space image, to determine the YC b The maximum saturation S max and the minimum saturation S min in the image of Cr color space;
修正單元,用於分別基於每個圖元的修正因數c對每個圖元的飽和度進行修正,得到修正飽和度後的圖像; The correction unit is used to correct the saturation of each primitive based on the correction factor c of each primitive, respectively, to obtain an image after the correction of saturation;
其中,所述修正因數c=k×△Smax,△Smax是飽和度調整變數,△Smax取值為所述最大飽和度Smax和當前圖元的飽和度S的差值,k為常量,k的取值為大於0的正數。 Wherein, the correction factor c=k×△S max , △S max is the saturation adjustment variable, △S max is the difference between the maximum saturation S max and the saturation S of the current primitive, k is Constant, the value of k is a positive number greater than 0.
優選的,所述計算單元,包括:確定模組,用於確定所述YCbCr色度空間圖像中每個圖元的色度分量Cb和色度分量Cr; Preferably, the calculation unit includes: a determination module for determining a chroma component C b and a chroma component C r of each primitive in the YC b C r chromaticity space image;
第一計算模組,用於根據公式計算每個圖元的飽和度S。 The first calculation module, used according to the formula Calculate the saturation S of each primitive.
優選的,所述修正模組,包括 Preferably, the correction module includes
第二計算模組,用於獲取當前圖元的飽和度S,計算所述最大飽和度Smax和當前圖元的飽和度S的差值,確定當前圖元的飽和度調整變數△Smax; The second calculation module is used to obtain the saturation S of the current primitive, calculate the difference between the maximum saturation S max and the saturation S of the current primitive, and determine the saturation adjustment variable △S max of the current primitive;
第三計算模組,用於基於所述當前圖元的飽和度調整變數△Smax和常量k的乘積,得到當前圖元的修正因數c; The third calculation module is used to adjust the product of the variable ΔS max and the constant k based on the saturation of the current primitive to obtain the correction factor c of the current primitive;
修正模組,用於根據公式對當前圖元的飽和度S進行修正;其中,當所述當前圖元的修正因數c大於0時,提高所述當前圖元的飽和度S,當所述當前圖元的修正因數c小於0時,降低所述當前圖元的飽和度S。 Modification module for formula Modify the saturation S of the current picture element; wherein, when the correction factor c of the current picture element is greater than 0, increase the saturation S of the current picture element, when the correction factor c of the current picture element is less than 0 , The saturation S of the current picture element is reduced.
優選的,還包括:第一設定單元;所述設定單元,用於設定常量k的取值範圍為大於0小於1的正數。 Preferably, the method further includes: a first setting unit; the setting unit is configured to set a constant k to be a positive number greater than 0 and less than 1.
優選的,還包括:第二設定單元,用於設定常量k的取值為控制因數k1與控制因數k2的乘積; Preferably, the method further includes: a second setting unit, configured to set the value of the constant k as the product of the control factor k1 and the control factor k2;
所述設定單元包括:控制因數k1設定模組和控制因數k2設定模組; The setting unit includes: a control factor k1 setting module and a control factor k2 setting module;
所述控制因數k1設定模組,用於將所述最小飽和度Smin至最大飽和度Smax構成的飽和度區間按照N等分進行劃分,得到N個飽和度區間,N為大於等於5的正整數;設定第一飽和度區間對應的控制因數k1的取值為M,所述M的取值為大於0小於1的正數;設定第二飽和度區間至第N飽和度區間對應的控制因數k1以預設值m遞增,所述預設值m的取值為大於0小於1的正數; The control factor k1 setting module is used to divide the saturation interval formed from the minimum saturation S min to the maximum saturation S max according to N equal parts to obtain N saturation intervals, where N is equal to or greater than 5. Positive integer; set the value of the control factor k1 corresponding to the first saturation interval to M, and the value of M is a positive number greater than 0 and less than 1; set the control factor corresponding to the second saturation interval to the Nth saturation interval k1 is incremented by a preset value m, and the value of the preset value m is a positive number greater than 0 and less than 1;
所述控制因數k2設定模組,用於獲取所述YCbCr色度空間圖像中的每個圖元的亮度分量Y;基於每個圖元的亮度分量Y對[20,220]的亮度按照N等分進行劃分,得到N個亮度區間,所述N個區間對應的控制因數K2的取值由對應當前的亮度分量Y確定。 The control factor k2 setting module is used to obtain the luminance component Y of each primitive in the YC b C r chromaticity space image; based on the luminance component Y of each primitive, the luminance of [20,220] N equal divisions are performed to obtain N brightness intervals, and the value of the control factor K2 corresponding to the N intervals is determined by the current brightness component Y.
本發明實施例通過上述公開的圖像飽和度調整方法和裝置,包括基於所述YCbCr色度空間圖像中的圖元點的色度分量Cb和色度分量Cr計算圖元點的飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin,通過修正因數c對的飽和度進行修正,在修正過程中引入對飽和 度S調整的調整因數k,最後得到修正飽和度後的圖像。通過上述方法從而解決了對圖像色彩飽和度調節過程中,色彩飽和度調整過度或不足導致的圖像色彩失真。 The embodiment of the present invention adopts the above-disclosed image saturation adjustment method and device, which include calculating a primitive based on the chroma component C b and the chroma component C r of the primitive point in the YC b C r chromaticity space image The saturation S of the point, determine the maximum saturation S max and the minimum saturation S min in the YC b C r chromaticity space image, correct the saturation by the correction factor c, and introduce the saturation during the correction process The adjustment factor k adjusted by the degree S finally obtains the image after correcting the saturation. Through the above method, the color distortion of the image caused by excessive or insufficient adjustment of the color saturation in the process of adjusting the color saturation of the image is solved.
YCbCr‧‧‧色度空間圖像 YC b C r ‧‧‧ color space image
c‧‧‧修正因數 c‧‧‧ correction factor
k‧‧‧調整因數(常量) k‧‧‧Adjustment factor (constant)
k1、k2‧‧‧控制因數 k1, k2‧‧‧Control factor
M‧‧‧值 M‧‧‧ value
m‧‧‧預設值 m‧‧‧Default
401‧‧‧轉換單元 401‧‧‧Conversion unit
402‧‧‧計算單元 402‧‧‧Calculation unit
403‧‧‧修正單元 403‧‧‧ correction unit
404‧‧‧確定模組 404‧‧‧ Confirm module
S201、S202、S203、S301、S302、S303‧‧‧步驟 S201, S202, S203, S301, S302, S303
Cb、Cr‧‧‧色度分量 C b, C r ‧‧‧ chroma component
S‧‧‧飽和度 S‧‧‧Saturation
Smax‧‧‧最大飽和度 S max ‧‧‧ maximum saturation
Smin‧‧‧最小飽和度 S min ‧‧‧Minimum saturation
△Smax‧‧‧飽和度調整變數 △S max ‧‧‧Saturation adjustment variable
Y‧‧‧亮度分量 Y‧‧‧Brightness component
405‧‧‧第一計算模組 405‧‧‧The first computing module
406‧‧‧第二計算模組 406‧‧‧Second computing module
407‧‧‧第三計算模組 407‧‧‧ Third Computing Module
408‧‧‧修正模組 408‧‧‧ Modification module
為了更清楚地說明本發明實施例或現有技術中的技術方案,下面將對實施例或現有技術描述中所需要使用的附圖作簡單地介紹,顯而易見地,下面描述中的附圖僅僅是本發明的實施例,對於本領域普通技術人員來講,在不付出創造性勞動的前提下,還可以根據提供的附圖獲得其他的附圖。 In order to more clearly explain the embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only For the embodiment of the invention, for those of ordinary skill in the art, without paying any creative labor, other drawings may be obtained according to the provided drawings.
第1圖為本發明實施例一提供的UV、CbCr與色相環的座標對應關係圖; FIG. 1 is a diagram of the correspondence between the coordinates of UV, C b C r and the hue circle provided in Embodiment 1 of the present invention;
第2圖為本發明實施例一提供的一種圖像飽和度調整方法流程圖; FIG. 2 is a flowchart of an image saturation adjustment method according to Embodiment 1 of the present invention;
第3圖為本發明實施例二提供的另一種圖像飽和度調整方法流程圖; FIG. 3 is a flowchart of another image saturation adjustment method according to Embodiment 2 of the present invention;
第4圖為本發明實施例三提供的一種圖像飽和度調整裝置示意圖。 FIG. 4 is a schematic diagram of an image saturation adjustment device according to Embodiment 3 of the present invention.
下面將結合本發明實施例中的附圖,對本發明實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。 The technical solutions in the embodiments of the present invention will be described clearly and completely in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.
由背景技術中可知在現有技術中,多採用對圖像的色彩飽和度進行調節,即對圖像的色彩色調、色彩鮮豔度和畫面清晰度的進行調整的方式,提高圖像畫面的顯示效果。但是,在對圖像的色彩飽和度調節過程中,會因為色彩飽和度的調整過度或不足導致圖像中色彩失真問題出現。由此,本發明實施例公開了一種圖像飽和度調整方法,通過所述YCbCr色度空間圖像中的每個圖元的色度分量Cb和色度分量Cr計算每個圖元的飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin,由於每個圖元的修正因數c對每個圖元的飽和度S進行修正,從而得到修正飽和度S後的圖像。 It can be known from the background art that in the prior art, the method of adjusting the color saturation of the image, that is, the method of adjusting the color hue, color vividness and screen clarity of the image is mostly used to improve the display effect of the image screen . However, in the process of adjusting the color saturation of the image, the problem of color distortion in the image will occur due to excessive or insufficient adjustment of the color saturation. Thus, an embodiment of the present invention discloses an image saturation adjustment method, each of which is calculated from the chrominance component C b and the chrominance component C r of each primitive in the YC b C r chromaticity space image The saturation S of the primitives determines the maximum saturation S max and the minimum saturation S min in the YC b C r chromaticity space image, due to the correction factor c of each primitive for the saturation of each primitive S is corrected to obtain an image with the corrected saturation S.
為了更清楚的描述本發明所公開的影像處理過程中涉及到的顏色屬性,如第1圖所示,以CbCr色度信號為軸建立直角坐標系。例如:第 1圖和表1表示色度分量U(Cb)V(Cr)與色相環的關係,常用相角來表示不同顏色。 In order to more clearly describe the color attributes involved in the image processing process disclosed in the present invention, as shown in FIG. 1, a rectangular coordinate system is established with the CbCr chrominance signal as the axis. For example: Figure 1 and Table 1 show the relationship between the chroma component U(Cb)V(Cr) and the hue circle, and the phase angle is often used to represent different colors.
實施例一 Example one
如第2圖所示,為本發明實施例提供一種圖像飽和度調整方法的流程示意圖,包括以下步驟: As shown in FIG. 2, it is a schematic flowchart of an image saturation adjustment method according to an embodiment of the present invention, including the following steps:
步驟S201:將紅綠藍(Red、Green、Blue,RGB)色度空間圖像轉換為亮度色度分量YCbCr色度空間圖像。 Step S201: Convert a red, green, and blue (Red, Green, Blue, RGB) chromaticity space image into a luminance chrominance component YC b C r chromaticity space image.
RGB色度空間是工業界中的一種顏色標準,RGB被稱為3基色,它是通過紅R、綠G和藍B三個顏色通道數值變換的疊加來實現各種各樣的顏色。 The RGB chromaticity space is a color standard in the industrial world. RGB is called 3 primary colors. It realizes various colors by superimposing the numerical transformation of the three color channels of red R, green G, and blue B.
亮度色度分量YCbCr色度空間圖像經由RGB色度空間圖像轉換而來,其中,Y是指亮度分量,Cb指藍色色度分量,而Cr指紅色色度分量是色彩空間的一種,通常會用於影片中的影像連續處理,或是數位攝影系統中。 The luminance chrominance component YC b C r chrominance space image is converted from the RGB chrominance space image, where Y refers to the luminance component, C b refers to the blue chrominance component, and Cr refers to the red chrominance component is color A type of space, usually used for continuous processing of images in movies, or in digital photography systems.
步驟S202:基於所述YCbCr色度空間圖像中的每個圖元的色度分量Cb和色度分量Cr計算每個圖元的飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin。 Step S202: Calculate the saturation S of each primitive based on the chroma component C b and the chroma component C r of each primitive in the YC b C r chromaticity space image, and determine the YC b C r The maximum saturation S max and the minimum saturation S min in the color space image.
需要說明的是,YCbCr色度空間單幀圖像中包括多個圖元點。 It should be noted that the YC b C r chromaticity space single-frame image includes multiple primitive points.
在執行步驟S102時,將RGB色度空間圖像轉換為亮度色度分量YCbCr色度空間圖像包括以下步驟: When step S102 is performed, converting the RGB chromaticity space image to the luminance chrominance component YC b C r chromaticity space image includes the following steps:
首先,確定所述YCbCr色度空間圖像中每個圖元的色度分量Cb和色度分量Cr。 First, the chrominance component C b and the chrominance component C r of each primitive in the YC b C r chromaticity space image are determined.
在具體實現過程中,所述YCbCr色度空間中的色度分量Cb和Cr是經由RGB色度空間中的R、G、B分量轉換得到的,具體轉換過程為: In a specific implementation process, the chrominance components C b and C r in the YC b C r chromaticity space are obtained through conversion of R, G, and B components in the RGB chromaticity space, and the specific conversion process is:
Cb=0.439R+0.368G+0.071B C b =0.439R+0.368G+0.071B
Cr=0.148R+0.291G+0.439B。 C r =0.148R+0.291G+0.439B.
其次,根據公式(1)計算每個圖元的飽和度S。 Secondly, the saturation S of each primitive is calculated according to formula (1).
公式(1)具體為:
需要說明的是,S表示飽和度,S值越大表明色彩越飽和,S值越小色彩飽和度越低。 It should be noted that S indicates saturation, and a larger S value indicates a more saturated color, and a smaller S value indicates a lower color saturation.
在具體實現過程中,根據公式(1)來計算每個圖元的飽和度S,然後比較計算得到的構成YCbCr色度空間圖像的每個圖元的飽和度S,確定最大飽度Smax和最小飽和度Smin。 In the specific implementation process, calculate the saturation S of each primitive according to formula (1), and then compare the calculated saturation S of each primitive constituting the YC b C r chromaticity space image to determine the maximum saturation Degree S max and minimum saturation S min .
需要說明的是,以每個圖元的色度分量Cb和色度分量Cr為引數,根據Cb和Cr定義域,可以得出因變數S的的範圍,即[Smin,Smax]值。 It should be noted that, taking the chrominance component C b and the chrominance component C r of each primitive as arguments, according to the definition domain of C b and C r , the range of the dependent variable S can be obtained, namely [S min , S max ] value.
步驟S203:分別基於每個圖元的修正因數c對每個圖元的飽和度S進行修正,得到修正飽和度後的圖像。 Step S203: Correct the saturation S of each primitive based on the correction factor c of each primitive, respectively, to obtain an image after the saturation is corrected.
其中,每個圖元的修正因數c由公式(2)確定。 Among them, the correction factor c of each picture element is determined by formula (2).
c=k×△Smax (2) c=k×△S max (2)
其中,△Smax是飽和度調整變數,△Smax取值為所述最大飽和度Smax和當前圖元的飽和度S的差值,k為常量,k的取值為大於0的正數。 Where ΔS max is a saturation adjustment variable, ΔS max is the difference between the maximum saturation S max and the saturation S of the current primitive, k is a constant, and k is a positive number greater than 0.
由上述公式(2)可知,修正因數c是通過常量k與飽和度變數△Smax乘積確定,其中k的取值為大於0且小於1的正數,△Smax是飽和度調整變數,而△Smax取值為所述最大飽和度Smax和當前的飽和度S的差值。 As can be seen from the above formula (2), the correction factor c is determined by the product of the constant k and the saturation variable △S max , where k takes a positive value greater than 0 and less than 1, △S max is the saturation adjustment variable, and △ S max value is the difference between the maximum saturation S max and S is the saturation current.
在執行步驟S203過程中,需要分別基於每個圖元的修正因數c對每個圖元的飽和度S進行修正,從而得到修正飽和度後的圖像圖元。 During the execution of step S203, it is necessary to correct the saturation S of each primitive based on the correction factor c of each primitive, so as to obtain the image primitive after the saturation is corrected.
在計算當前圖元的飽和度S所對應的修正因數c之後,基於計算得到的修正因數c,對圖元的飽和度S進行修正。 After calculating the correction factor c corresponding to the saturation S of the current primitive, the saturation S of the primitive is corrected based on the calculated correction factor c.
具體的修正方式為:當修正因數c大於0時,提高當前圖元的飽和度S,當修正因數c小於0時,降低當前圖元的飽和度S。本發明實施例通過上述公開的影像處理方法,基於所述YCbCr色度空間圖像中的色度分量Cb和色度分量Cr計算飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin。通過修正因數c對圖像圖元的飽和度S進行修正,得到修正飽和度後的圖像,以及通過設定k的取值範圍,從而解決了對圖像色彩飽和度調節過程中,色彩飽和度調整過度或不足導致的圖像色彩失真。 The specific correction method is: when the correction factor c is greater than 0, the saturation S of the current picture element is increased, and when the correction factor c is less than 0, the saturation S of the current picture element is reduced. The embodiment of the present invention calculates the saturation S based on the chroma component C b and the chroma component C r in the YC b C r chromaticity space image through the image processing method disclosed above to determine the YC b C r color The maximum saturation S max and the minimum saturation S min in the spatial image. Correct the saturation S of the image primitive by the correction factor c to obtain the corrected saturation image, and set the value range of k to solve the problem of color saturation during the adjustment of the image color saturation Image color distortion caused by excessive or insufficient adjustment.
基於上述申請實施例公開的圖像飽和度調整方法,其中執行如圖2所示步驟S203時,以一幀圖像圖元的飽和度S的修正進行說明,對當前幀圖像圖元的飽和度S進行修正的具體過程如第3圖所示,包括: Based on the image saturation adjustment method disclosed in the embodiment of the above application, when step S203 shown in FIG. 2 is executed, the correction of the saturation S of the image primitive of one frame is used to explain the saturation of the image primitive of the current frame The specific process of correcting degree S is shown in Figure 3, including:
步驟S301:獲取當前圖像圖元的飽和度S,計算所述圖元最大飽和度Smax和當前圖像圖元的飽和度S的差值,確定當前圖元的飽和度調整變數△Smax。 Step S301: Obtain the saturation S of the current image primitive, calculate the difference between the maximum saturation Smax of the primitive and the saturation S of the current image primitive, and determine the saturation adjustment variable △S max of the current primitive .
步驟S302:基於所述當前圖元的飽和度調整變數△Smax和常量k的乘積,得到當前圖元的修正因數c。 Step S302: Adjust the product of the variable ΔS max and the constant k based on the saturation of the current picture element to obtain the correction factor c of the current picture element.
步驟S303:根據公式(3)對當前圖元的飽和度S進行修正。公式(3)具體為:
在執行步驟S301的過程中,若最大飽和度Smax大於當前圖元的飽和度S,則兩者的差值為正值,根據公式(2)可知,得到的當前圖元的修正因數c大於0時,此時,提高所述圖像圖元的飽和度S。 In the process of executing step S301, if the maximum saturation S max is greater than the saturation S of the current picture element, the difference between the two is a positive value, and according to formula (2), the correction factor c of the current picture element obtained is greater than At 0, at this time, the saturation S of the image primitive is increased.
最小飽和度Smin小於當前圖元的飽和度S,則兩者差值為負值,根據公式(2)可知,得到的當前圖元的修正因數c小於0時,此時降低所述當前圖像圖元的飽和度S。 If the minimum saturation S min is less than the saturation S of the current picture element, the difference between the two is a negative value. According to formula (2), when the obtained correction factor c of the current picture element is less than 0, the current picture is reduced Like the saturation S of the picture element.
需要說明的是,在公式(2)中常量k定義為任意實數。優選的,若0<k<1,則基於公式(2)中的記載,通過常量k與△Smax乘積,可以線性調整飽和度的變化,從而控制飽和度的增強值、降低值,同時避免了過飽和、欠飽和現象的發生。 It should be noted that the constant k is defined as any real number in formula (2). Preferably, if 0<k<1, based on the description in formula (2), the product of the constant k and ΔS max can be used to linearly adjust the change in saturation, so as to control the increase and decrease of saturation, while avoiding Oversaturated and undersaturated phenomena occurred.
通過上述步驟對圖像飽和度S進行處理時,在提高圖像飽和度S或者在降低圖像飽和度S時,能夠避免過飽和與欠飽和問題出現。 When the image saturation S is processed through the above steps, when the image saturation S is increased or when the image saturation S is decreased, the problems of oversaturation and undersaturation can be avoided.
可選的,為了提供更好的人眼主觀感受。本發明實施例進一步提出利用亮度分量Y對飽和度S進行控制。具體為,在YCbCr色度空間中,利用亮度分量Y,對修正因數c進行控制。 Optionally, in order to provide a better subjective feeling for the human eye. The embodiment of the present invention further proposes to control the saturation S by using the luminance component Y. Specifically, in the YC b C r chromaticity space, the correction factor c is controlled using the luminance component Y.
需要說明的是亮度分量Y由RGB色度空間的R、G、B分量轉換得到的,具體轉換過程為: It should be noted that the luminance component Y is obtained by converting the R, G, and B components of the RGB color space. The specific conversion process is:
Y=0.257R+0.504G+0.098B。 Y=0.257R+0.504G+0.098B.
基於公式(2)中記載的常量k,其取值為控制因數k1與控制因數k2的乘積。控制因數k1與控制因數k2通過亮度分量Y進行設定,下面對控制因數k1與控制因數k2的設定過程進行詳細說明。控制因數k1的設定過程包括: Based on the constant k described in formula (2), its value is the product of the control factor k1 and the control factor k2. The control factor k1 and the control factor k2 are set by the luminance component Y. The setting process of the control factor k1 and the control factor k2 will be described in detail below. The setting process of the control factor k1 includes:
首先,將所述最小飽和度Smin至最大飽和度Smax構成的飽和度區間按照N等分進行劃分,得到N個飽和度區間,N為大於等於5的正整數。 First, divide the saturation interval formed from the minimum saturation S min to the maximum saturation S max according to N equal divisions to obtain N saturation intervals, where N is a positive integer greater than or equal to 5.
其次,設定第一飽和度區間對應的控制因數k1的取值為M,所述M的取值為大於0小於1的正數。 Secondly, the value of the control factor k1 corresponding to the first saturation interval is set to M, and the value of M is a positive number greater than 0 and less than 1.
然後,設定第二飽和度區間至第N飽和度區間對應的控制因數k1在M值的基礎上以預設值m遞增,所述預設值m的取值為大於0小於1的正數。 Then, the control factor k1 corresponding to the second saturation interval to the Nth saturation interval is set to increase on the basis of the M value by a preset value m, and the value of the preset value m is a positive number greater than 0 and less than 1.
基於上述控制因數k1的設定過程這裡進行舉例說明。 The setting process based on the above-mentioned control factor k1 will be exemplified here.
例如,在對[Smin,Smax]區間進行N等分進行劃分,取N等於5,通過劃分後得到5個飽和度區間,通過設定第一飽和區間對應的控制因數k1的取值為M,設M為0.04,得到第一飽和區間後設定第二飽和度區間,設預設值m為0.02,則第二飽和度區間k1為0.06。 For example, when dividing the [S min , S max ] interval into N equal parts, take N equal to 5, and obtain 5 saturation intervals by dividing, by setting the value of the control factor k1 corresponding to the first saturation interval as M , Set M to 0.04, set the second saturation interval after obtaining the first saturation interval, and set the preset value m to 0.02, then the second saturation interval k1 is 0.06.
控制因數k2的設定過程包括: The setting process of the control factor k2 includes:
首先,獲取所述YCbCr色度空間圖像中的每個圖元的亮度分量Y。 First, the luminance component Y of each primitive in the YC b C r chromaticity space image is acquired.
然後,基於每個圖元的亮度分量Y對[20,220]的強度範圍按照N等分進行劃分,得到N個亮度區間,所述N個亮度區間對應的控制因數K2的取值由對應亮度分量Y所在區間確定。 Then, the intensity range of [20,220] is divided into N equal divisions based on the luminance component Y of each primitive to obtain N luminance intervals, and the value of the control factor K2 corresponding to the N luminance intervals is determined by the corresponding luminance component Y The interval is determined.
需要說明的是,RGB色彩強度範圍為[0,255],而亮度分量Y是屬於RGB色彩強度範圍內。本發明實施例中亮度分量Y對RGB色彩強度的優選範圍為[20,220],但不局限於RGB色彩強度範圍。 It should be noted that the RGB color intensity range is [0,255], and the luminance component Y belongs to the RGB color intensity range. The preferred range of the luminance component Y to the RGB color intensity in the embodiment of the present invention is [20,220], but it is not limited to the RGB color intensity range.
基於上述控制因數k2的設定過程,這裡進行舉例說明。 Based on the above setting process of the control factor k2, an example will be described here.
例如,K2的設定為,對亮度分量Y在[20,220]區間內分N等分,設N的值為5,得到5個區間,因此5個區間內Y對應的控制因數K2的取值為0.2、1.8、2.4、1.0、0.2。 For example, the setting of K2 is that the luminance component Y is divided into N equal parts in the [20,220] interval, and the value of N is 5 to obtain 5 intervals, so the control factor K2 corresponding to Y in 5 intervals is 0.2 , 1.8, 2.4, 1.0, 0.2.
最後基於上述步驟,最終可以得出飽和度調整公式(4)。 Finally, based on the above steps, the saturation adjustment formula (4) can be finally obtained.
本發明實施例通過上述公開的圖像飽和度調整方法,基於所述YCbCr色度空間圖像中的圖元點的色度分量Cb和色度分量Cr計算圖元點的飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin,通過修正因數c對的飽和度進行修正,在修正過程中引入對飽和度S調整的調整因數k,最後得到修正飽和度後的圖像。通過本發明公開的圖像飽和度調整方法,解決了現有技術中圖像在低亮度和低對比度部分不能採樣過強的飽和度調整方法,從而解決了對圖像色彩飽和度調節過程中色彩飽和度調整過度或不足導致的圖像色彩失真。 The embodiment of the present invention calculates the saturation of the primitive point based on the chroma component C b and the chroma component C r of the primitive point in the YC b C r chromaticity space image through the above disclosed image saturation adjustment method Degree S, determine the maximum saturation S max and the minimum saturation S min in the YC b C r chromaticity space image, correct the saturation by the correction factor c, and introduce the adjustment of the saturation S during the correction process Adjustment factor k, and finally get the image after saturation correction. The image saturation adjustment method disclosed in the present invention solves the saturation adjustment method in the prior art where the image cannot be oversampled in the low brightness and low contrast parts, thereby solving the color saturation in the process of adjusting the image color saturation Image color distortion caused by excessive or insufficient adjustment.
實施例二 Example 2
基於上述本發明實施例公開的圖像飽和度調整方法,本發明實施例還對應公開了一種圖像飽和度調整裝置,如第4圖所示,該圖像飽和度調整裝置包括:轉換單元401、計算單元402和修正單元403。 Based on the image saturation adjustment method disclosed in the above embodiments of the present invention, an embodiment of the present invention also correspondingly discloses an image saturation adjustment device. As shown in FIG. 4, the image saturation adjustment device includes: a
轉換單元401,用於將紅綠藍RGB色度空間圖像轉換為亮度色度分量YCbCr色度空間圖像。 The
計算單元402,用於基於所述YCbCr色度空間圖像中的每個圖元的色度分量Cb和色度分量Cr計算每個圖元的飽和度S,確定所述YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin。 The calculating
計算單元402包括: The
確定模組404,用於確定所述YCbCr色度空間圖像中每個圖元的色度分量Cb和色度分量Cr。 The determining
第一計算模組405,用於根據公式計算每個圖元的飽和度S。 The
修正單元403,用於分別基於每個圖元的修正因數c對每個圖元的飽和度進行修正,得到修正飽和度後的圖像;其中,所述修正因數c=k×△Smax,△Smax是飽和度調整變數,△Smax取值為所述最大飽和度Smax和當前圖元的飽和度S的差值,k為常量,k的取值為大於0的正數。 The
可選的,所述修正單元403包括: Optionally, the
第二計算模組406,用於獲取當前圖元的飽和度S,計算所述最大飽和度Smax和當前圖元的飽和度S的差值,確定當前圖元的飽和度調整變數△Smax。 The
第三計算模組407,用於基於所述當前圖元的飽和度調整變數△Smax和常量k的乘積,得到當前圖元的修正因數c。 The
修正模組408,用於根據公式對當前圖元的飽和度S進行修正;其中,當所述當前圖元的修正因數c大於0時,提高所述當前圖元的飽和度S,當所述當前圖元的修正因數小於0時,降低所述當前圖元的飽和度S。
可選的,本發明還可以包括第一設定單元,用於設定常量k的取值範圍為大於0小於1的正數。 Optionally, the present invention may further include a first setting unit, which is used to set the value range of the constant k to be a positive number greater than 0 and less than 1.
可選的,本發明還可以包括第二設定單元,用於設定常量k的取值為控制因數k1與控制因數k2的乘積。 Optionally, the present invention may further include a second setting unit, configured to set the value of the constant k as the product of the control factor k1 and the control factor k2.
設定單元包括:控制因數k1設定模組和控制因數k2設定模組。控制因數k1設定模組,用於將所述最小飽和度Smin至最大飽和度Smax構成的飽和度區間按照N等分進行劃分,得到N個飽和度區間,N為大於等於5的正整數;設定第一飽和度區間對應的控制因數k1的取值為M,所述M的取值為大於0小於1的正數;設定第二飽和度區間至第N飽和度區間對應的控制因數k1以預設值m遞增,所述預設值m的取值為大於0小於1的正數。 The setting unit includes: a control factor k1 setting module and a control factor k2 setting module. The control factor k1 setting module is used to divide the saturation interval formed from the minimum saturation S min to the maximum saturation S max according to N equal divisions to obtain N saturation intervals, where N is a positive integer greater than or equal to 5. Set the value of the control factor k1 corresponding to the first saturation interval to M, and the value of M is a positive number greater than 0 and less than 1; set the control factor k1 corresponding to the second saturation interval to the Nth saturation interval to The preset value m increases, and the value of the preset value m is a positive number greater than 0 and less than 1.
控制因數k2設定模組,用於獲取所述YCbCr色度空間圖像中的每個圖元的亮度分量Y;基於每個圖元的亮度分量Y對定義區間[20,220]按照N等分進行劃分,得到N個子區間,所述N區間對應的控制因數K2的取值由對應當前亮度分量Y確定。 The control factor k2 setting module is used to obtain the luminance component Y of each primitive in the YC b C r chromaticity space image; based on the luminance component Y of each primitive, a defined interval [20, 220] according to N etc. Divide into points to obtain N sub-intervals. The value of the control factor K2 corresponding to the N interval is determined by the corresponding current luminance component Y.
以上本發明實施例公開的一種圖像飽和度調整裝置中的轉換單元401,計算單元402,以及修正單元403的具體執行過程以及執行原理可參見本發明上述實施例公開的影像處理方法中與所述轉換單元401,計算單元402,以及修正單元403相對應部分,這裡不再進行贅述。 For the specific execution process and execution principle of the
本發明實施例通過上述公開的圖像飽和度調整裝置,計算模組基於轉換模組的YCbCr色度空間圖像中的每個圖元的色度分量Cb和色度分量Cr計算每個圖元的飽和度S,通過計算模組確定YCbCr色度空間圖像中的最大飽和度Smax和最小飽和度Smin,修正模組通過每個圖元的修正因數c對每個圖元的飽和度進行修正,最後得到修正飽和度後的圖像。通過上述裝置從而解決了對圖像色彩飽和度調節過程中,色彩飽和度調整過度或不足導致的圖像色彩失真。 In the embodiment of the present invention, through the image saturation adjustment device disclosed above, the calculation module is based on the chroma component C b and the chroma component C r of each primitive in the YC b C r chromaticity space image of the conversion module Calculate the saturation S of each picture element, determine the maximum saturation S max and the minimum saturation S min in the YC b C r chromaticity space image through the calculation module, and the correction module passes the correction factor c of each picture element Correct the saturation of each primitive, and finally get the corrected image. The above device solves the image color distortion caused by excessive or insufficient adjustment of the color saturation during the adjustment of the image color saturation.
對所公開的實施例的上述說明,使本領域專業技術人員能夠實現或使用本發明。對這些實施例的多種修改對本領域的專業技術人員來說將是顯而易見的,本文中所定義的一般原理可以在不脫離本發明的精神或範圍的情況下,在其它實施例中實現。因此,本發明將不會被限制于本文所示的這些實施例,而是要符合與本文所公開的原理和新穎特點相一致的最寬的範圍。 The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown in this document, but should conform to the widest scope consistent with the principles and novel features disclosed in this document.
S201、S202、S203‧‧‧步驟 S201, S202, S203‧‧‧ steps
Claims (10)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810867044.2A CN109348202B (en) | 2018-08-01 | 2018-08-01 | Image saturation adjusting method and device |
CN201810867044.2 | 2018-08-01 |
Publications (2)
Publication Number | Publication Date |
---|---|
TW202008311A true TW202008311A (en) | 2020-02-16 |
TWI697873B TWI697873B (en) | 2020-07-01 |
Family
ID=65291474
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW108126621A TWI697873B (en) | 2018-08-01 | 2019-07-26 | Image saturation adjusting method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109348202B (en) |
TW (1) | TWI697873B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115330607B (en) * | 2022-07-11 | 2024-03-01 | 内蒙古工业大学 | Saturation enhancement method for color image |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
BE1007590A3 (en) * | 1993-10-01 | 1995-08-16 | Philips Electronics Nv | Video signal processing circuit. |
TW248629B (en) * | 1993-12-30 | 1995-06-01 | Winbond Electronics Corp | Color space conversion method |
TW508940B (en) * | 2000-03-28 | 2002-11-01 | Omnivision Tech Inc | Method and apparatus for color image date processing and compression |
CN101083775A (en) * | 2006-05-29 | 2007-12-05 | 帆宣系统科技股份有限公司 | Method and apparatus for adjusting image saturation |
CN101123733B (en) * | 2007-04-13 | 2010-05-26 | 四川长虹电器股份有限公司 | Chroma signal processing method |
US9049410B2 (en) * | 2009-12-23 | 2015-06-02 | Samsung Display Co., Ltd. | Color correction to compensate for displays' luminance and chrominance transfer characteristics |
US9332239B2 (en) * | 2012-05-31 | 2016-05-03 | Apple Inc. | Systems and methods for RGB image processing |
-
2018
- 2018-08-01 CN CN201810867044.2A patent/CN109348202B/en active Active
-
2019
- 2019-07-26 TW TW108126621A patent/TWI697873B/en active
Also Published As
Publication number | Publication date |
---|---|
TWI697873B (en) | 2020-07-01 |
CN109348202B (en) | 2021-01-08 |
CN109348202A (en) | 2019-02-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100453038B1 (en) | An apparatus and method for saturation correction in color image | |
TWI511559B (en) | Image processing method | |
US10129511B2 (en) | Image processing apparatus, image projection apparatus, and image processing method | |
TWI519151B (en) | Image processing method and image processing apparatus | |
US8064693B2 (en) | Methods of and apparatus for adjusting colour saturation in an input image | |
JP2006325201A (en) | Detection, correction fading and processing in hue, saturation and luminance directions | |
CN105898252A (en) | Television color adjustment method and device | |
CN107592517B (en) | Skin color processing method and device | |
US20060082686A1 (en) | Method and device for independent color management | |
TWI697873B (en) | Image saturation adjusting method and device | |
JP2006229925A (en) | Dynamic image saturation enhancement apparatus | |
JP6031327B2 (en) | Projection system, projector and control method | |
CN109792474B (en) | Method for determining a chroma mapping function | |
US10970822B2 (en) | Image processing method and electronic device thereof | |
WO2023241339A1 (en) | Color cast correction method and apparatus, device, storage medium and program product | |
WO2018040599A1 (en) | Method and device for processing video frame, and computer-readable storage medium | |
CN105208362B (en) | Image colour cast auto-correction method based on gray balance principle | |
US7633555B2 (en) | Method and device for automatic color correction | |
JP2008219289A (en) | Video correction device, video display device, imaging apparatus and video correction program | |
TWI531246B (en) | Color adjustment method and its system | |
TWI544451B (en) | Image processing method | |
EP1895781B1 (en) | Method of and apparatus for adjusting colour saturation | |
CN113132562A (en) | Lens shadow correction method and device and electronic equipment | |
US8416323B2 (en) | Noise reduction method and noise reduction apparatus | |
KR20160025876A (en) | Method and apparatus for intensificating contrast in image |