Color image contrast information calculation method and device
By calculating the chromaticity information of image pixel points in the HSV color space, and using linear decolorization ratio parameters to calculate the luminance information, combined with the color difference information between adjacent pixel points, the problem that the contrast calculation method in the prior art fails to effectively reflect the contrast size relationship between images, and a more accurate expression of color image contrast information is achieved.
Patent Information
- Application Number
- CN202210056501.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-18
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2042-01-18
AI Technical Summary
The existing contrast calculation methods fail to effectively reflect the magnitude relationship between contrast between images, and do not consider the sensory color difference information brought about by the visual characteristics of the human eye.
By calculating the chromaticity information of each pixel point in the image in the HSV color space, and calculating the brightness information based on the linear decolorization ratio parameters, then calculating the color difference information between adjacent pixel points, and finally using the point where the color difference information exceeds the threshold as the difference point, the contrast of the image is calculated.
This method can more effectively reflect the magnitude relationship between contrast between images, retain color contrast information, reduce the impact of adjacent data information that visually cannot detect differences on the final result, and more in line with the human eye's perceptual contrast perception of color images.
Smart Images

Figure CN114511459B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision technology, and in particular to a method and device for calculating color image contrast information. Background Art
[0002] In recent years, image processing technology has been widely used in high-tech fields such as aerospace, medical bioengineering, robot vision, military security, etc., and has become a research hotspot. Researchers have proposed various image processing methods based on different principles and applications. In practical applications, different principles and processing flows will affect the imaging quality of the resulting image, and the quality of the image directly affects the acquisition of information and subjective feelings. Therefore, image quality assessment is a very important research topic in the field of image processing. Among the commonly used image quality assessment values, contrast is one of the most relevant features of visible image visual signals, which can reflect the human eye's perceptual perception of image color differences.
[0003] Although visual research has been developed for many years, there is still no unified and recognized contrast definition method in the field of visual psychology and optics at this stage, and there is no contrast calculation method that can perfectly simulate the human eye's perception of contrast in color images. Therefore, the research on color image contrast calculation methods is still a hot topic.
[0004] In the existing contrast calculation methods, for example, the invention patent application with application number 201810438478.0 discloses a method for enhancing the brightness of an image in a dark light scene, including reading a low-light RGB color image I; extracting the brightness component V of the image I in the HSV color space, and dividing the low-light image I into a dark area and a bright area according to the brightness component V; marking the image according to the brightness component V of the low-light RGB color image I in the HSV color space; obtaining the best enhancement coefficients λ1 and λh for the dark area Ω1 and the bright area Ωh by a specific method according to the identification result; enhancing the low-light RGB color image I according to the best enhancement parameters λ1 and λh, respectively, obtaining corresponding enhanced images Ml and Mh, and fusing them to obtain a fused image M; and performing adaptive illumination compensation on the enhanced image M to obtain the final enhanced image h. While enhancing the brightness and contrast of the dark light area, the contrast of the bright area can be enhanced.
[0005] However, most of the existing contrast calculation methods do not take into account the perceptual color difference information brought by the visual characteristics of the human eye, and cannot effectively reflect the size relationship of the contrast between images. Summary of the invention
[0006] The technical problem to be solved by the present invention is to effectively reflect the magnitude relationship of contrast between images.
[0007] The present invention solves the above technical problems through the following technical means:
[0008] In one aspect, the present invention provides a method for calculating contrast information of a color image, the method comprising the following steps:
[0009] Calculate the chromaticity information of each pixel in the image in the HSV color space;
[0010] Calculating the brightness information of each pixel in the image in the RGB color space based on a linear decolorization ratio parameter, wherein the linear decolorization ratio parameter is used to retain contrast information;
[0011] Calculating color difference information between adjacent pixels based on the chromaticity information and brightness information of each pixel;
[0012] Pixel points whose color difference information exceeds a threshold are taken as difference points, and the contrast of the image is calculated based on the color difference information corresponding to the difference points and the number of the difference points.
[0013] The present invention obtains the hue and saturation information of each pixel of the image in the HSV color space that is more in line with the observation effect of the human eye as the chromaticity information based on the color space conversion, and then uses the linear decolorization ratio parameter that retains the image contrast information to calculate the brightness information of each pixel of the image, and calculates the contrast value of the color image by calculating and counting the number information of points whose color difference information exceeds the threshold and the color difference information between adjacent pixels; the method is less affected by the color uniform or nearly uniform area in the original image, and in the process of obtaining the brightness information, the color contrast information can be better retained, and the influence of the adjacent data information whose difference cannot be perceived by vision on the final result is reduced, which is more conducive to expressing the perceptual contrast information of the color image.
[0014] Furthermore, the chromaticity information of each pixel in the image in the HSV color space is calculated, including:
[0015] Convert the color space of the image from RGB to HSV;
[0016] The H component and the S component of the HSV color space of the image are used as the chromaticity information of each of the pixels.
[0017] Furthermore, the formula for calculating the brightness information of each pixel in the image in the RGB color space based on the linear decolorization ratio parameter is expressed as:
[0018] L=R*l R +G*l G +B*l B
[0019] Among them, R, G, and B are RGB color spaces, respectively. R , lG , l B is a linear decolorization ratio parameter corresponding to the R, G, B color space of the image, and * is a multiplication sign.
[0020] Furthermore, the method further comprises:
[0021] In the range of [0,1], the grayscale conversion ratio parameter is dynamically valued in steps with a set value, and a value combination set of the grayscale conversion ratio parameter is obtained;
[0022] A value combination that retains the most contrast information is selected from the value combination set as the linear decolorization ratio parameter.
[0023] Furthermore, the formula for calculating the color difference information between adjacent pixels based on the chromaticity information and brightness information of each pixel is expressed as:
[0024]
[0025] Among them, H a , H b are the hue information of two adjacent pixels, S a , S b are the saturation information of two adjacent pixels, L a , L b They are the brightness information of two adjacent pixels.
[0026] Furthermore, the calculation formula of the contrast of the image is:
[0027]
[0028] Among them, C 0 is the contrast of the image, is the sum of the color difference information of the difference points exceeding the threshold T, N is the corresponding number of pixels whose color difference information exceeds the threshold T, and T represents the minimum color difference perceptible to the human eye.
[0029] On the other hand, a color image contrast information calculation device is used, the device comprising:
[0030] Chromaticity information calculation module, used to calculate the chromaticity information of each pixel in the image in the HSV color space;
[0031] A brightness information calculation module, used to calculate the brightness information of each pixel in the image in the RGB color space based on a linear decolorization ratio parameter, wherein the linear decolorization ratio parameter is used to retain contrast information;
[0032] A difference information calculation module, used to calculate the color difference information between adjacent pixels according to the chromaticity information and brightness information of each pixel;
[0033] The contrast calculation module is used to take the pixel points whose color difference information exceeds the threshold as difference points, and calculate the contrast of the image based on the color difference information corresponding to the difference points and the number of the difference points.
[0034] Furthermore, the chromaticity information calculation module includes:
[0035] A space conversion unit, used for converting the color space of the image from RGB to HSV;
[0036] The chromaticity information acquisition unit is used to use the H component and the S component of the HSV color space of the image as the chromaticity information of each pixel.
[0037] Furthermore, the device also includes:
[0038] The linear decolorization ratio parameter selection module is used to dynamically change the grayscale conversion ratio parameter in steps with a set value within the range of [0,1] to obtain a value combination set of the grayscale conversion ratio parameter; and select the value combination that retains the most contrast information from the value combination set as the linear decolorization ratio parameter.
[0039] Furthermore, the formula of the brightness information is expressed as:
[0040] L=R*l R +G*l G +B*l B
[0041] Among them, R, G, and B are the channel components of the RGB color space, respectively. R , l G , l B They are the linear decolorization ratio parameters corresponding to the R, G, and B channels respectively, and * is the multiplication sign.
[0042] Furthermore, the formula for the color difference information between adjacent pixels is expressed as:
[0043]
[0044] Among them, H a , H b are the hue information of two adjacent pixels, S a , S b are the saturation information of two adjacent pixels, L a , L b They are the brightness information of two adjacent pixels respectively;
[0045] The calculation formula of the contrast of the image is:
[0046]
[0047] Among them, C 0 is the contrast of the image, is the sum of the color difference information of the difference points exceeding the threshold T, N is the corresponding number of pixels whose color difference information exceeds the threshold T, and T represents the minimum color difference perceptible to the human eye.
[0048] The advantages of the present invention are:
[0049] (1) The present invention obtains the hue and saturation information of each pixel of the image in the HSV color space that is more in line with the observation effect of the human eye as the chromaticity information based on color space conversion, and then uses the linear decolorization ratio parameter that retains the image contrast information to calculate the brightness information of each pixel of the image. By calculating and counting the number information of points whose color difference information exceeds the threshold and the color difference information between adjacent pixels, the contrast value of the color image is calculated; this method is less affected by the color uniform or nearly uniform area in the original image. In the process of obtaining brightness information, the color contrast information can be better retained, and the influence of adjacent data information whose difference cannot be perceived by vision on the final result is reduced, which is more conducive to expressing the perceptual contrast information of the color image.
[0050] (2) The present invention calculates the linear decolorization ratio parameters corresponding to the unique R, G, and B channels of each image while retaining the color contrast information of the original image, so as to better retain the color contrast.
[0051] (3) The contrast information statistics object of the present invention is the adjacent pixels whose Euclidean distance of color difference exceeds a threshold, where the threshold refers to the minimum color difference that can be perceived by the human eye, so as to avoid the adverse factors caused when there are a large number of color blocks in the image.
[0052] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 is a flow chart of a method for calculating color image contrast information in a first embodiment of the present invention;
[0054] Figure 2 Schematic diagram of the contrast statistics of the natural environment image in the present invention;
[0055] Figure 3 It is a schematic diagram of a pure color experimental image in the present invention;
[0056] Figure 4 Schematic diagram of the statistical results of the contrast of pure color experimental images in the present invention;
[0057] Figure 5 4 is a structural diagram of a color image contrast information calculation device in a second embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] like Figure 1 As shown, the first embodiment of the present invention provides a method for calculating color image contrast information, the method comprising the following steps:
[0060] S10, calculating the chromaticity information of each pixel in the image in the HSV color space;
[0061] S20, calculating the brightness information of each pixel in the image in the RGB color space based on a linear decolorization ratio parameter, wherein the linear decolorization ratio parameter is used to retain contrast information;
[0062] S30, calculating color difference information between adjacent pixels according to the chromaticity information and brightness information of each pixel;
[0063] S40: taking pixel points whose color difference information exceeds a threshold as difference points, and calculating the contrast of the image based on the color difference information corresponding to the difference points and the number of the difference points.
[0064] It should be noted that the embodiment of the present invention obtains the hue and saturation information of each pixel of the image in the HSV color space that is more in line with the observation effect of the human eye as the chromaticity information based on the color space conversion, and then uses the linear decolorization ratio parameter that retains the image contrast information to calculate the brightness information of each pixel of the image, and calculates the contrast value of the color image by calculating and counting the number information of points whose color difference information exceeds the threshold and the color difference information between adjacent pixels; this method is less affected by the color uniform or nearly uniform area in the original image, and in the process of obtaining the brightness information, it can better retain the color contrast information, and reduce the influence of the adjacent data information whose difference cannot be perceived by vision on the final result, which is more conducive to expressing the perceptual contrast information of the color image.
[0065] In one embodiment, the step S10 includes the following steps:
[0066] S11, converting the color space of the image from RGB to HSV;
[0067] S12. Using the H component and the S component of the HSV color space of the image as the chromaticity information of each pixel.
[0068] It should be noted that compared with the commonly used RGB color space, the HSV color space is closer to the human eye's perceptual perception of color information, can intuitively express color information, and is convenient for color comparison in image processing applications. The conversion formula from RGB color space to HSV color space is as follows:
[0069]
[0070] Among them, R, G, B represent RGB color space information, and H, S, V represent HSV color space information.
[0071] Specifically, this embodiment selects the H (Hue) component and the S (Saturation) component of the HSV color space as the chromaticity information of each pixel of the image.
[0072] In one embodiment, in step S20, the formula of the brightness information is expressed as:
[0073] L=R*l R +G*l G +B*l B
[0074] Among them, l R , l G , l B They are the linear decolorization ratio parameters corresponding to the R, G, and B channels of the current image respectively, and * is the multiplication sign.
[0075] In one embodiment, the method further comprises:
[0076] In the range of [0,1], the grayscale conversion ratio parameter is dynamically valued in steps with a set value, and a value combination set of the grayscale conversion ratio parameter is obtained;
[0077] A value combination that retains the most contrast information is selected from the value combination set as the linear decolorization ratio parameter.
[0078] It should be noted that the traditional grayscale transformation is g = R * W R +G*W G +B*W B , where the ratio is W R =0.299,W G =0.587,W B=0.114, which meets the application requirements in most scenarios. However, in some application scenarios, the difference between different colors of the original image after conversion to grayscale is too small, and the original color contrast information is lost. R , W G , W B ) combinations are infinite. Considering that a small change in the coefficient has little effect on the result, in the range of [0,1], the grayscale conversion ratio parameter is dynamically valued in steps with a set value to obtain a value combination set of the grayscale conversion ratio parameter, and the value combination that retains the most contrast information is selected from the value combination set as the linear decolorization ratio parameter, which can retain the image contrast information to the greatest extent.
[0079] Specifically, in this embodiment, the value of the grayscale conversion ratio parameter is set from the range of [0,1] with a step of 0.1, and (W R , W G , W B ) of 66 possible value combinations. By exhaustive enumeration, each of the 66 possible value combinations is substituted into the Euclidean distance formula (see formula (3) below) to find the grayscale conversion ratio parameter that retains the most contrast information as the decolorization ratio parameter (l R ,l G ,l B ).
[0080] It should be understood that those skilled in the art may select different values as step values according to actual requirements to obtain different value combination sets, which is not specifically limited in this embodiment.
[0081] This embodiment calculates the grayscale conversion ratio parameters corresponding to the unique R, G, and B channels of each image under the premise of preserving the color contrast information of the original image, aiming to minimize the following energy function to preserve the contrast information:
[0082]
[0083] In function (2), g x and g y is the grayscale value obtained at point x and point y with different R, G, and B channel ratio coefficients, δ x,y Indicates the Euclidean distance between the x and y points in the CIELab color space. x,y It is generally expressed by formula (3):
[0084]
[0085] In formula (3), L, a, and b are the three components of a point in a color image after it is converted from RGB space to CIELab space. L is the brightness factor, and a and b are two color channels. The colors included in a range from dark green (low brightness value) to gray (medium brightness value) to bright pink (high brightness value); and the colors included in b range from bright blue (low brightness value) to gray (medium brightness value) to yellow (high brightness value). The value range of L is 0 to 100, and the value range of a and b is +127 to -128.
[0086] In one embodiment, the formula for the color difference information between adjacent pixels is expressed as:
[0087]
[0088] Among them, H a , H b are the hue information of two adjacent pixels a and b, with a value range of 0° to 360°; S a , S b are the saturation information of two adjacent pixels a and b, with a value range of 0 to 1; L a , L b The brightness information of two adjacent pixels a and b is obtained by using the grayscale conversion ratio parameters of the R, G, and B channels unique to the image, and the value range is 0 to 1.
[0089] It should be noted that in traditional grayscale transformation, the grayscale conversion ratio parameter is a certain value, and there is a situation where the difference between different colors is too small after being converted into a grayscale image, and the original color contrast information is lost. This embodiment selects a corresponding linear decolorization ratio parameter for each image, which can maximize the retention of the original image color contrast information.
[0090] In one embodiment, the calculation formula of the image contrast is:
[0091]
[0092] Among them, C 0 is the contrast of the image, is the sum of the color difference information of the difference points exceeding the threshold T, N is the corresponding number of pixels whose color difference information exceeds the threshold T, and T represents the minimum color difference perceptible to the human eye.
[0093] It should be noted that the purpose of statistical calculation of color image contrast information is to obtain the difference information between different colors in the image. Since the color information of the connected areas of the same color is the same, the color difference in the connected domain is 0. When there are multiple areas of the same color or similar colors in the image, a large amount of repeated data information with very small differences in each area will dilute the color difference information between different color areas, which is not conducive to the expression of color contrast results. The information statistics object of this embodiment is the adjacent pixel points whose Euclidean distance of color difference between adjacent pixel points exceeds the threshold T, where T refers to the minimum color difference that can be perceived by the human eye, so as to avoid the adverse factors caused when there are a large number of color blocks in the image.
[0094] To verify the effectiveness of the method of this embodiment, the method proposed in this embodiment is compared with multiple methods. The laptop used as the experimental equipment is MSI GP62 2QE-215XCN, the CPU is Intel Core i75700HQ, the main frequency is 2.7GHz, 8G memory, and dual graphics cards. The compared images are divided into natural environment images and pure color experimental images. To facilitate the comparative analysis between the methods, the contrast results of each method are normalized:
[0095] (1) Comparative analysis of natural environment image results:
[0096] Several natural environment images with a resolution of 640*480 were selected for processing, and the contrast analysis results of some of the images are as follows: Figure 2 As shown in Figure 2, it can be found that after normalization, the values of the results of each method are all small. This is because the color composition of natural environment images is complex and it is difficult for the theoretical limits of each method to appear. Figure 2 From the numerical values, when there is a serious color cast in the image and the visual effect is blurred, the values calculated by each contrast method are small (such as the third row left image and the fifth row image); and when there is a highlight area in the image, the contrast value is large (such as the fourth row left image); this size relationship is consistent with the contrast size of visual perception. It shows that the method of this embodiment can effectively reflect the contrast size relationship between images.
[0097] (2) Comparative analysis of pure color experimental image results:
[0098] In order to analyze and compare the contrast results of different color difference combinations, this embodiment designs some pure color experimental images, such as Figure 3As shown in (a) to (f), each image consists of 16 pure color square areas of the same size, and (a) to (d) are 8 blue (RGB value (0, 0, 255)) areas and 8 green (RGB value (0, 200, 0)) areas. (a) is the 16 areas interlaced by color difference; (b) is the combination of two areas of the same color, and then the areas of different colors are interlaced by color difference; (c) is the combination of 4 areas of the same color, and then the areas of different colors are interlaced by color difference; (d) is the result of the same color. In (a) to (d), the number and value of pixels that make up the image are the same, and the only difference is the arrangement of the color areas. From the perspective of naive human vision, the contrast perception of the four images should be similar; (e) is 8 regions with RGB values of (255, 0, 255) and 8 regions with RGB values of (0, 255, 0); (f) is 8 regions with RGB values of (255, 0, 0) and 8 regions with RGB values of (0, 255, 255); (g) is a special pure color combination image, which is special in that after grayscale conversion using the traditional grayscale ratio WR = 0.299, WG = 0.587, WB = 0.114, the grayscale value of all pixels is 128. The contrast results of the pure color experimental images are shown in Figure 2. Figure 4 shown.
[0099] from Figure 4 The same method shown for Figure 3 The results of the different pure color experimental image data shown in the figure are analyzed. The GLCM method and the RMS method are compared. Figure 3 The calculation results of (a) to (d) in the figure are different. The results are greatly affected by the position information of the same color area in the original image, and the more the same color area is combined, the smaller the calculated value is. This result contradicts the fact that the contrast perception of the four images should be consistent in human visual observation. The calculation results of the four images of SD, AQOC and Our method are consistent with each other, which is more in line with the objective fact that the experimental images are similar; the four comparison methods are consistent with each other. Figure 3 The calculation results of (e) and (f) are quite different. This is because the brightness information of the four contrast methods is calculated by traditional grayscale transformation ratio. Figure 3 There is a big difference between the colors in (e) and (f) after traditional grayscale processing.
[0100] From the data analysis of different methods for the same image in the figure, Figure 3 After the traditional grayscale conversion is used in (g), the grayscale value of each pixel is 128, and the value difference between pixels is 0. The four comparison methods that directly use the traditional grayscale conversion results as brightness information are compared. Figure 3The calculation results of (g) in are all 0, and the original color contrast information is lost. However, the brightness information calculation method of our method avoids the loss of color contrast information.
[0101] By comparing experimental data, it is verified that the brightness information calculation method of this embodiment avoids the loss of color contrast information, the contrast calculation result is consistent with human visual perception, and can effectively reflect the size relationship of the contrast between images.
[0102] like Figure 5 As shown, the second embodiment of the present invention provides a color image contrast information calculation device, the device comprising:
[0103] The chromaticity information calculation module 10 is used to calculate the chromaticity information of each pixel in the image in the HSV color space;
[0104] A brightness information calculation module 20, configured to calculate the brightness information of each pixel in the image in the RGB color space based on a linear decolorization ratio parameter, wherein the linear decolorization ratio parameter is used to retain contrast information;
[0105] The difference information calculation module 30 is used to calculate the color difference information between adjacent pixels according to the chromaticity information and brightness information of each pixel;
[0106] The contrast calculation module 40 is configured to take the pixel points whose color difference information exceeds a threshold as difference points, and calculate the contrast of the image based on the color difference information corresponding to the difference points and the number of the difference points.
[0107] In one embodiment, the chromaticity information calculation module includes:
[0108] A space conversion unit, used for converting the color space of the image from RGB to HSV;
[0109] The chromaticity information acquisition unit is used to use the H component and the S component of the HSV color space of the image as the chromaticity information of each pixel.
[0110] In one embodiment, the formula for the brightness information is expressed as:
[0111] L=R*l R +G*l G +B*l B
[0112] Among them, R, G, and B are the channel components of the RGB color space, respectively. R , l G , l B They are the linear decolorization ratio parameters corresponding to the R, G, and B channels respectively, and * is the multiplication sign.
[0113] In one embodiment, the device further comprises:
[0114] The linear decolorization ratio parameter selection module is used to dynamically change the grayscale conversion ratio parameter in steps with a set value within the range of [0,1] to obtain a value combination set of the grayscale conversion ratio parameter; and select the value combination that retains the most contrast information from the value combination set as the linear decolorization ratio parameter.
[0115] In one embodiment, the formula for the color difference information between adjacent pixels is expressed as:
[0116]
[0117] Among them, H a , H b are the hue information of two adjacent pixels, S a , S b are the saturation information of two adjacent pixels, L a , L b They are the brightness information of two adjacent pixels respectively;
[0118] The calculation formula of the contrast of the image is:
[0119]
[0120] Among them, C 0 is the contrast of the image, is the sum of the color difference information of the difference points exceeding the threshold T, N is the corresponding number of pixels whose color difference information exceeds the threshold T, and T represents the minimum color difference perceptible to the human eye.
[0121] It should be noted that, based on the color space conversion, the hue and saturation information of each pixel of the image in the HSV color space that is more in line with the human eye observation effect is obtained as the chromaticity information; then the linear decolorization ratio value that retains the image contrast information is calculated to obtain the brightness information of each pixel of the image. Finally, the contrast value of the color image is calculated by calculating and counting the number of points whose difference information exceeds the threshold T and the color difference information between adjacent pixels. Compared with other contrast calculation methods, this scheme is less affected by the uniform or nearly uniform color areas in the original image; in the process of obtaining brightness information, the color contrast information can be better retained; and the influence of adjacent data information whose visual differences cannot be detected on the final result is reduced, which is more conducive to expressing the perceptual contrast information of color images and realizing effective and reasonable expression of color image contrast information.
[0122] It should be noted that other embodiments of the color image contrast information calculation device or implementation methods of the present invention can refer to the above-mentioned method embodiments, which will not be repeated here.
[0123] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0124] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0125] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0126] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0127] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for calculating color image contrast information, characterized in that: The method comprises: Calculating the chromaticity information of each pixel in the image in the HSV color space includes: converting the color space of the image from RGB to HSV; using the H component and the S component of the HSV color space of the image as the chromaticity information of each pixel; Based on the linear decolorization ratio parameter, the brightness information L of each pixel in the image in the RGB color space is calculated. The linear decolorization ratio parameter is used to retain the contrast information. The formula is expressed as: L=R*l R +G*l G +B*l B Among them, R, G, and B are RGB color spaces, respectively. R , l G , l B is a linear decolorization ratio parameter corresponding to the R, G, and B channels of the image, and * is a multiplication sign; within the range of [0,1], the grayscale conversion ratio parameter is dynamically valued in steps with a set value to obtain a value combination set of the grayscale conversion ratio parameter; and the value combination with the most contrast information retained is selected from the value combination set as the linear decolorization ratio parameter; According to the chromaticity information and brightness information of each pixel, the color difference information F(a, b) between adjacent pixels is calculated, and the formula is expressed as: Among them, H a , H b are the hue information of two adjacent pixels, S a , S b are the saturation information of two adjacent pixels, L a , L b They are the brightness information of two adjacent pixels respectively; The pixel points whose color difference information exceeds the threshold are taken as difference points, and the contrast C0 of the image is calculated based on the color difference information corresponding to the difference points and the number of the difference points. The calculation formula of the contrast of the image is: in, is the sum of the color difference information of the difference points exceeding the threshold T, N is the corresponding number of pixels whose color difference information exceeds the threshold T, and T represents the minimum color difference perceptible to the human eye.
2. A color image contrast information calculation device, characterized in that: The device comprises: A chromaticity information calculation module, used to calculate the chromaticity information of each pixel in the image in the HSV color space, the chromaticity information calculation module includes a space conversion unit, used to convert the color space of the image from RGB to HSV; a chromaticity information acquisition unit, used to use the H component and S component of the HSV color space of the image as the chromaticity information of each pixel; The brightness information calculation module is used to calculate the brightness information L of each pixel in the image in the RGB color space based on the linear decolorization ratio parameter, wherein the linear decolorization ratio parameter is used to retain the contrast information. The formula of the brightness information is expressed as: L=R*l R +G*l G +B*l B Among them, R, G, and B are RGB color spaces, respectively. R , l G , l B is a linear decolorization ratio parameter corresponding to the R, G, B color space of the image, and * is a multiplication sign; The difference information calculation module is used to calculate the color difference information F(a, b) between adjacent pixels according to the chromaticity information and brightness information of each pixel. The formula of the color difference information between adjacent pixels is expressed as: Among them, H a , H b are the hue information of two adjacent pixels, S a , S b are the saturation information of two adjacent pixels, L a , L b They are the brightness information of two adjacent pixels respectively; The contrast calculation module is used to take the pixel points whose color difference information exceeds the threshold as difference points, and calculate the contrast C0 of the image based on the color difference information corresponding to the difference points and the number of the difference points. The calculation formula of the contrast of the image is: in, is the sum of the color difference information of the difference points whose color difference information exceeds the threshold T, N is the corresponding number of pixels whose color difference information exceeds the threshold T, and T represents the minimum color difference perceptible to the human eye; The device also includes: a linear decolorization ratio parameter selection module, which is used to dynamically change the grayscale conversion ratio parameter in steps with a set value within the range of [0,1] to obtain a value combination set of the grayscale conversion ratio parameter; and select a value combination that retains the most contrast information from the value combination set as the linear decolorization ratio parameter.
Citation Information
Patent Citations
Brightness enhancement method for an image in dark light scene
CN108830800A
HSV (Hue, Saturation and Value) color space based underwater image enhancing method by combining with Retinex
CN102930512A
Improved HSI space information low-illumination color image enhancement algorithm
CN106504212A