WO2020000262A1 - Light source estimating method, image processing method and related products - Google Patents

Light source estimating method, image processing method and related products Download PDF

Info

Publication number
WO2020000262A1
WO2020000262A1 PCT/CN2018/093144 CN2018093144W WO2020000262A1 WO 2020000262 A1 WO2020000262 A1 WO 2020000262A1 CN 2018093144 W CN2018093144 W CN 2018093144W WO 2020000262 A1 WO2020000262 A1 WO 2020000262A1
Authority
WO
WIPO (PCT)
Prior art keywords
color
cluster
clusters
degree
image
Prior art date
Application number
PCT/CN2018/093144
Other languages
French (fr)
Chinese (zh)
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
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201880095117.9A priority Critical patent/CN112313946A/en
Priority to PCT/CN2018/093144 priority patent/WO2020000262A1/en
Publication of WO2020000262A1 publication Critical patent/WO2020000262A1/en

Links

Images

Classifications

    • 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

Definitions

  • the present application relates to the field of image processing, and in particular, to a light source estimation method, an image processing method, and related products.
  • Daylight is a natural light source. Except for the natural light source such as daylight, artificial light sources can be generated by different lamps, and the color temperature of daylight and light sources of different lamps are different.
  • Color temperature is a physical quantity that evaluates the color of a light source. It is defined as heating a black body (absolute black radiator, which is similar to a closed carbon block that does not reflect incident light) to a certain temperature, and it will emit light. Black body temperature changes. When the color of the light emitted by a light source is the same as the color of the black body, the temperature of the black body is the color temperature of the light source.
  • the color temperature of the light source can be classified into high color temperature, medium color temperature, and low color temperature from high to low.
  • the color of high color temperature light sources is light blue, and the color of low color temperature light sources is light yellow.
  • AVB correction technology can calculate the color temperature of the light source in the shooting environment. This corrects the color cast of the image, and strives to make the white objects in the original scene appear white in the image.
  • the traditional AWB correction technology cannot determine whether there is a mixed color temperature in the environment, so usually only one light source color temperature can be estimated as the color deviation of the corrected image in accordance with. For example, if the color temperature of the light source calculated by the AWB correction technology is closer to the high color temperature in the environment, the low color temperature area in the corrected image will be yellowish, and if the calculated light source color temperature is closer to the low color temperature, the high color temperature area in the image There is a bluish problem.
  • the human eye is not sensitive to the difference in the color of the light source in the mixed color temperature light source scene (the brain will think of the light source as close to white), in the mixed color temperature scene, the light blue and yellow light source colors in the image may trigger the user Feel the color is wrong. Therefore, how to estimate the number of light sources with different color temperatures in the environment has become an urgent need.
  • the embodiments of the present application provide a light source estimation method, an image processing method, and related products.
  • an embodiment of the present application provides a method for estimating a light source, which may include:
  • m sub-blocks may be all the same size, partially the same, or different from each other, and the shape of the sub-blocks may be square, rectangular, or other shapes), where m is an integer greater than 1.
  • the information group includes brightness information and color information.
  • the image may be an original image or another image captured by a camera.
  • the color brightness three-dimensional space includes two color dimensions and one brightness dimension.
  • each of the k layers corresponds to a brightness interval (continuous brightness interval), where P is an integer greater than 1, and k is a positive integer.
  • a second blending degree of the number of clusters P corresponding to the image is determined based on the first blending degree of the number of clusters P corresponding to each of the k layers. It can be understood that when k is equal to 1, it means that m color brightness samples are divided into the same layer, then only the first blending degree of the number of clusters P corresponding to the only layer is obtained. At this time, the The first blending degree of the number of clusters P corresponding to this layer is the second blending degree of the number of clusters P corresponding to the image.
  • the blending degree between the two color luminance sample clusters can indicate the closeness of the connection between the two color luminance sample clusters.
  • the greater the degree of blending between the two clusters the higher the degree of closeness between the color brightness samples of the two clusters; the smaller the degree of blending between the two clusters, the color brightness samples of the two clusters The tighter the connection is.
  • the number of color brightness samples included in different layers of the k layers may be all the same, partly the same, or different from each other.
  • the heights of the brightness intervals corresponding to different layers in the k layers may be all the same, partially the same, or different from each other.
  • the second blending degree of the corresponding clustering number P of the image when the second blending degree of the corresponding clustering number P of the image is less than or equal to the blending degree threshold, it may be estimated that there are differences in the shooting environments corresponding to the images.
  • the number of color temperature light sources is not P (in this case, there may be a monochrome temperature light source or a mixed color temperature light source in the shooting environment corresponding to the image).
  • This light source estimation method obtains the color brightness by mapping the color brightness information group of the image segmented sub-blocks to the color brightness three-dimensional space. Multiple color brightness sample points in three-dimensional space, and perform multiple layer clustering processing on multiple color brightness sample points, and then calculate the blending degree of the entire image by calculating the blending degree of the color brightness sample point clustering of each layer, and based on this It is estimated that there are multiple light sources with different color temperatures in the shooting environment corresponding to the image, which lays a foundation for image correction based on the situation that includes multiple light sources with different color temperatures.
  • determining the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers may include: The first blending degree corresponding to the number of clusters P of each layer is summed or weighted to obtain a second blending degree corresponding to the number of clusters P of the image.
  • the number of clusters corresponding to each layer may be determined based on the height of the brightness interval of each layer. For example, the higher the weighted summation weight of a layer with a relatively higher brightness interval, the greater the correspondingly smaller height of the brightness interval. Layer, the corresponding weighted summation weight can be smaller.
  • the weighted summation weight of the first blending degree corresponding to the number of clusters P of each layer can be determined based on the number of color brightness samples of each layer. For example, the layer with a relatively large number of color brightness samples has a corresponding weighted summation weight The larger the layer with a relatively small number of color luminance samples, the smaller the corresponding weighted summation weight can be.
  • the weighted summation weight of each layer can also be determined based on other parameters.
  • calculating the first blending degree of the number of clusters P corresponding to the i-th layer in the k-layer may include: calculating each of the P-groups of the i-th layer A third degree of fusion between the two clusters; summing or weighting the third degree of fusion between each two clusters in the P clusters to obtain the number of clusters P corresponding to the i-th layer First degree of blending.
  • the i-th layer is any one of the k layers.
  • calculating the first blending degree of the number of clusters P corresponding to the i-th layer in the k layers may include: calculating between two clusters of the i-th layer A third degree of integration; wherein the first degree of integration of the number of clusters P corresponding to the i-th layer is equal to the third degree of integration between the two clusters.
  • the i-th layer is any one of the k layers.
  • calculating the third blending degree between the cluster gi and the cluster gj may include inserting a continuous array of measurement cells between the center point of the cluster gi and the center point of the cluster gj, the continuous array
  • the number of measurement cells is T.
  • the statistics include the number of measurement cells Q of the color brightness samples in the clusters gi and gj.
  • a third blending degree between the cluster gi and the cluster gj is determined as Q / T, where the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0.
  • the cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
  • the length of a single measurement cell may be Dist_D65_D50.
  • the width of a single measurement cell can be Dist_D65_D50 / 32.
  • the length and width of the measurement cell are also designed to other values, and the specific values can be set based on the needs of the scene.
  • the length direction of the continuously arranged measurement cells may be perpendicular to a line connecting the center point of the cluster gi and the center point of the cluster gj.
  • the length direction of the continuously arranged measurement cells may not be perpendicular to the line connecting the center point of the cluster gi and the center point of the cluster gj (the angle between the length direction and the line connecting the center points)
  • the range may be, for example, 60 ° to 90 °).
  • the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of any cluster is equal to the any cluster
  • the average value of the first color dimension coordinates of all color brightness samples in the cluster, and the second color dimension coordinate of the center point of the any cluster is equal to the average of the second color dimension coordinates of all color brightness samples in the any cluster value.
  • the first color dimension coordinate of the center point of the cluster gi is equal to the average value of the first color dimension coordinates of all color brightness samples in the cluster gi
  • the second color dimension coordinate of the center point of the cluster gi is equal to the cluster.
  • P 2, ... Y light sources with different color temperatures in the shooting environment
  • P Y light sources with different color temperatures exist in the shooting environment.
  • the Y is an integer greater than 2 and less than or equal to the X.
  • a first blending degree of the number of clusters P1 corresponding to each layer in the k layers calculates a first blending degree of the number of clusters P1 corresponding to each layer in the k layers; and determine a number of clusters P1 corresponding to the image based on the first blending degree of the number of clusters P1 corresponding to each layer in the k layers
  • the second blending degree of the image comparing the second blending degree of the corresponding clustering number P1 of the image with the blending degree threshold of the clustering number P1.
  • a first blending degree of the number of clusters P2 corresponding to each of the k layers is calculated; and a number of clusters P2 corresponding to the image is determined based on the first blending degree of the number of clusters P2 corresponding to each of the k layers.
  • the second blending degree of the image comparing the second blending degree of the corresponding number of clusters P2 of the image with the blending degree threshold of the number of clusters P2.
  • the second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1, and the second degree of fusion of the corresponding number of clusters P2 of the image is less than or equal to the threshold of the degree of fusion of the number of clusters P2 In this case, it can be estimated that there are P1 light sources with different color temperatures in the shooting environment of the image.
  • the second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1 and the second degree of fusion of the corresponding number of clusters P2 of the image is greater than the threshold of the degree of fusion of the number of clusters P2
  • the second blending degree of the corresponding number of clusters P1 of the image is greater than the threshold of the blending degree of the number of clusters P1, and the second corresponding number of clusters of the image P2
  • the blending degree is greater than the blending degree threshold of the number of clusters P2
  • the second blending degree of the corresponding clustering number P2 of the image and the blending degree threshold of the clustering number P2 are different (this difference can be expressed as (the The second degree of fusion corresponding to the number of clusters P2 of the image-the degree of fusion threshold of the number of clusters P2) / the threshold of the degree of fusion) is greater than the second degree of fusion of the corresponding number of clusters P1 and the threshold of the degree of fusion of the number of clusters P1 It is estimated that the shooting environment corresponding to the image includes P2 light sources with different color temperatures.
  • an embodiment of the present application provides another method for estimating a light source, which may include:
  • Step S1 Divide the image into m sub-blocks, where m is an integer greater than 1.
  • Step S2 Obtain m color brightness information groups of the m sub-blocks, where each color brightness information group corresponds to one sub-block, and the color brightness information group includes brightness information and color information.
  • Step S3 Map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, each color brightness sample point corresponding to one color brightness information group
  • the color brightness three-dimensional space includes two color dimensions and one brightness dimension.
  • Step S4 divide the m color brightness samples into k layers along the brightness dimension
  • Step S5 Assign a value that has not been selected from the set of candidate numbers of light sources with different color temperatures to P.
  • Step S6 Divide each of the k layers into P color brightness sample point clusters, and calculate a first blending degree of the number of clusters P corresponding to each of the k layers.
  • Each of the k layers corresponds to a brightness interval, where P is an integer greater than 1, and k is a positive integer.
  • Step S7 Determine a second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers.
  • Step S8 Compare the second blending degree of the corresponding clustering number P of the image with the blending degree threshold. In a case where the second blending degree of the corresponding grouping number P of the image is greater than the blending degree threshold, it is estimated that there are at least P light sources with different color temperatures in the shooting environment corresponding to the image. Return to step S5.
  • an embodiment of the present application further provides an image processing method, including:
  • the light source estimation method according to any one of the first aspect or the second aspect is performed.
  • the image is corrected according to P light sources with different color temperatures, wherein the correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
  • an embodiment of the present application further provides a light source estimation device.
  • the light source estimation device may include a segmentation unit, an acquisition unit, a mapping unit, a calculation unit, a determination unit, a comparison unit, and an estimation unit.
  • the segmentation unit is configured to segment an image into m sub-blocks, where m is an integer greater than 1.
  • the obtaining unit is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information.
  • a mapping unit configured to map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where each color brightness sample is associated with a color
  • the brightness information group corresponds, and the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
  • a calculation unit configured to calculate all the m color luminance sample points into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups.
  • the first blending degree of the number of clusters P corresponding to each of the k layers is described.
  • Each of the k layers corresponds to a brightness interval (continuous brightness interval).
  • P is an integer greater than 1
  • k is a positive integer.
  • the determining unit is configured to determine a second blending degree of the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers.
  • the comparison unit is configured to compare the second blending degree of the corresponding grouping number P of the image with the blending degree threshold.
  • an estimation unit is configured to, when the second blending degree corresponding to the corresponding number of clusters P of the image is greater than the blending degree threshold, estimate that at least P different color temperatures exist in the shooting environment corresponding to the image. light source.
  • the estimation unit may be further configured to estimate light sources with different color temperatures in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is less than the blending degree threshold. The number is not P.
  • the determining unit is specifically configured to perform summing or weighted summing processing on a first blending degree of the number of clusters P corresponding to each of the k layers to obtain a second blend of the corresponding number of clusters P of the image degree.
  • the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation unit is specifically configured to calculate the first a third blending degree between every two clusters in the P clusters of the i-layer; summing or weighted summing the third blending degree between every two clusters in the P clusters to obtain the first
  • the first blending degree of the grouping number P corresponding to the i-layer, and the i-th layer is any one of the k-layers.
  • the calculation unit is specifically configured to:
  • a continuous array of measurement cells is inserted between the center point of the cluster gi and the center point of the cluster gj, and the number of the continuous array measurement cells is T.
  • the cluster gi and the cluster gj are any two of the P clusters in the i-th layer.
  • the statistics include the number of measurement cells Q of the color brightness sample points in the cluster gi and the cluster gj; it is determined that the third blending degree between the cluster gi and the cluster gj is Q / T, where T and all Said Q is an integer, said T is greater than 0 and said Q is greater than or equal to 0.
  • a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj.
  • the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of any cluster is equal to the any cluster The average value of the first color dimension coordinates of all color brightness samples in the cluster, and the second color dimension coordinate of the center point of the any cluster is equal to the average of the second color dimension coordinates of all color brightness samples in the any cluster value.
  • the calculation unit, the determination unit, the comparison unit, and the estimation unit may perform the calculation, the determination, the comparison, and In the estimation, X is an integer greater than two.
  • Y is an integer greater than 2 and less than or equal to X.
  • an embodiment of the present application further provides a light source estimation device.
  • the light source estimation device may include a segmentation circuit, an acquisition circuit, a mapping circuit, a calculation circuit, a determination circuit, a comparison circuit, and an estimation circuit.
  • a segmentation circuit is used to segment an image into m sub-blocks, where m is an integer greater than 1.
  • the obtaining circuit is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information.
  • a mapping circuit configured to map the m color luminance information groups to a color luminance three-dimensional space to obtain m color luminance samples located in the color luminance three-dimensional space, where each color luminance sample is associated with a color
  • the brightness information group corresponds, and the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
  • a calculation circuit configured to calculate all the m color luminance sample points divided into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups.
  • the first blending degree of the number of clusters P corresponding to each of the k layers is described.
  • Each of the k layers corresponds to a brightness interval (continuous brightness interval), where P is an integer greater than 1, and k is a positive integer.
  • a determining circuit is configured to determine a second blending degree of the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers.
  • the comparison circuit is configured to compare the second blending degree and the blending degree threshold of the corresponding grouping number P of the image.
  • An estimation circuit is configured to estimate that at least P light sources with different color temperatures exist in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is greater than the blending degree threshold.
  • the determining circuit is specifically configured to perform summing or weighted summing processing on a first blending degree of the number of clusters P corresponding to each of the k layers to obtain a second blend of the corresponding number of clusters P of the image degree.
  • the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation circuit is specifically configured to calculate the first a third blending degree between every two clusters in the P clusters of the i-layer; summing or weighted summing the third blending degree between every two clusters in the P clusters to obtain the first
  • the first blending degree of the grouping number P corresponding to the i-layer, and the i-th layer is any one of the k-layers.
  • the calculation circuit when the P is equal to 2; in terms of calculating a first blending degree of the number of clusters P corresponding to the ith layer in the k layer, the calculation circuit may be specifically configured to: The third degree of integration between the two subgroups of the i-th layer is described, wherein the first degree of integration of the number of subgroups P corresponding to the i-th layer is equal to the third degree of integration between the two subgroups.
  • the i-th layer is any one of the k layers.
  • the calculation circuit is specifically configured to:
  • a continuous array of measurement cells is inserted between the center point of the cluster gi and the center point of the cluster gj, and the number of the continuously arrayed measurement cells is T; where the cluster gi and the cluster gj are the i-th Any two of the P groupings of the layer;
  • the statistics include the number of measurement cells Q of the color brightness sample points in the cluster gi and the cluster gj; it is determined that the third blending degree between the cluster gi and the cluster gj is Q / T, where T and all Said Q is an integer, said T is greater than 0 and said Q is greater than or equal to 0.
  • a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj.
  • the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of any cluster is equal to the any cluster The average value of the first color dimension coordinates of all color brightness samples in the cluster, and the second color dimension coordinate of the center point of the any cluster is equal to the average of the second color dimension coordinates of all color brightness samples in the any cluster value.
  • the calculation unit, the determination unit, the comparison unit, and the estimation unit may perform the calculation, the determination, the comparison, and In the estimation, X is an integer greater than two.
  • Y is an integer greater than 2 and less than or equal to X.
  • an embodiment of the present application further provides an image processing apparatus, including:
  • the light source estimation device is any one of the light source estimation devices provided in the fifth aspect or the fourth aspect.
  • the correction device is configured to correct the image according to P light sources with different color temperatures, and the correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
  • the correction device may be, for example, an image signal processor (ISP).
  • the ISP may include at least one of the following correction circuits: an automatic white balance correction circuit, a color correction circuit, and a saturation correction circuit. , Or contrast correction circuit.
  • an embodiment of the present application further provides a light source estimation device.
  • the light source estimation device includes a processor and a memory coupled to each other.
  • the memory stores a computer program.
  • the processor is configured to call the memory.
  • a computer program stored in the computer to execute any one of the light source estimation methods provided in the first aspect or the second aspect.
  • an embodiment of the present application further provides an image processing apparatus.
  • the light source estimation apparatus includes a processor and a memory coupled to each other.
  • the memory stores a computer program.
  • the processor is configured to call the memory.
  • a stored computer program to execute any one of the image processing methods provided by the third aspect.
  • an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, wherein the computer program is executed by related hardware to complete the first aspect or the second aspect Any of the light source estimation methods provided.
  • an embodiment of the present application further provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, and the computer program is executed by related hardware to complete any one of the images provided by the third aspect. Approach.
  • an embodiment of the present application further provides a computer program product, and when the computer program product runs on a computer, the computer is caused to execute any one of the light source estimation methods provided in the first aspect or the second aspect.
  • an embodiment of the present application further provides a computer program product, and when the computer program product runs on a computer, the computer is caused to execute any one of the image processing methods provided in the third aspect.
  • FIG. 1A is a schematic diagram of a device system architecture according to an example of the present application.
  • FIG. 1B is a schematic structural diagram of an image processing component provided as an example in an embodiment of the present application.
  • FIG. 1C is a color temperature level division method of a standard light source provided by way of example in the embodiment of the present application.
  • FIG. 2 is a schematic diagram of mapping a color information group to a two-dimensional color coordinate plane according to an example of the present application.
  • 3A and 3B are schematic diagrams of sub-speed division of several images provided by way of example in the embodiment of the present application.
  • FIG. 4 is a schematic diagram of the distribution of color brightness samples in a mixed color temperature light source scene provided by way of example in the embodiment of the present application.
  • FIG. 5 is a schematic diagram of the distribution of color brightness samples in a monochrome temperature light source scene provided by way of example in the embodiment of the present application.
  • FIG. 6 is a schematic flowchart of a light source estimation method according to an embodiment of the present application.
  • FIG. 7 is a schematic diagram of color brightness sample points layered along the brightness dimension according to an embodiment of the present application.
  • FIG. 8 is a schematic diagram of clustering of color brightness samples according to an embodiment of the present application.
  • FIG. 9 is a schematic diagram of inserting a continuously arranged measurement cell between the center points of two color brightness sample point clusters according to an embodiment of the present application.
  • FIG. 10 is a schematic flowchart of an image processing method according to an embodiment of the present application.
  • FIG. 11A is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application.
  • FIG. 11B is a schematic structural diagram of another image processing apparatus according to an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a light source estimation device according to an embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of another light source estimation device according to an embodiment of the present application.
  • FIG. 14 is a schematic diagram of another light source estimation device according to an embodiment of the present application.
  • FIG. 15 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application.
  • FIG. 16 is a schematic structural diagram of another image processing apparatus according to an embodiment of the present application.
  • FIG. 1A is a schematic diagram of a system architecture provided by the present application.
  • the system 100 includes a camera 110, an image processing unit 120, and a memory 130.
  • the camera 110 is configured to capture an image (original image).
  • the image processing unit 120 is configured to perform some related processing on the image obtained by the camera 110 (for example, perform automatic white balance correction, color correction, saturation correction, and / or contrast correction on the image obtained by the camera 110).
  • the memory 130 is used to store some program code or data related to image processing.
  • the image processing component 120 may be composed of one or more processors; or, the image processing component 120 may include both one or more processors or some hardware circuits; or the image processing component 120 may not include processing Controller, but includes some hardware circuits.
  • the image processing section 120 includes, for example, an image signal processor 121, a light source estimation device 122, and the like.
  • the light source estimation device 122 can be used to estimate the existence of a light source in the image shooting environment (for example, it can be estimated whether a monochrome temperature light source or a mixed color temperature light source exists in the image shooting environment).
  • the estimation result of the existence of the light source in the image shooting environment output by the light source estimation device 122 can be performed by the image signal processor 121 for related image processing (for example, automatic white balance correction, color correction, saturation of the image). (Such as degree correction and / or contrast correction).
  • the camera 110, the image signal processor 121, the light source estimation device 122, and the like are physically set independently as an example.
  • some components may be physically integrated as a whole.
  • the light source estimation device 122 may be integrated into the image signal processor 121, and the light source estimation device 122 may also be integrated into the camera 110.
  • the image signal processor may have the function of the light source estimation device described in the above example, and the image signal processor integrated with the light source estimation device It can still be called an image signal processor.
  • the camera can also have the function of the light source estimation device described in the above example, and the camera integrated with the light source estimation device can still be called Camera, and so on in other cases.
  • the standard light source generally refers to a light source whose color temperature is a standard color temperature.
  • the color temperature level of a standard light source can be divided into three levels: high color temperature, medium color temperature, and low color temperature. High color temperature, medium color temperature, and low color temperature can be divided into several sub-levels.
  • FIG. 1C illustrates a color temperature level division method of a standard light source by way of example. In the example shown in FIG. 1C, the color temperature is divided into 10 sub-levels. , CWF, TL84 and U30 are classified as medium color temperature, and A and H are classified as low color temperature. Among them, the color of high color temperature light sources is light blue, and the color of low color temperature light sources is light yellow.
  • the image is cut into n ⁇ m subblocks, and all pixels of each subblock are added to obtain the color average value (R, G, B) of this subblock. Based on this color average value, this can be obtained.
  • the color information group (R / G, B / G) of the sub-block, or (R, G, B) can be converted to (Y, Cb, Cr) or (Y, U, V) color space, then the color information Groups can also be expressed as (Cb, Cr) or (U, V).
  • the color information group of each sub-block is mapped on a two-dimensional color coordinate plane (for example, as shown in FIG. 2), and then a color sample point located in the two-dimensional color coordinate plane is formed, and each color sample point corresponds to one color information. group.
  • block (block) and subblock (subblock) is a relative concept. Dividing a block (image block) can get the subblock of this block. If you continue to divide the subblock, you can get this The sub-block of the sub-block, that is, the block is composed of the sub-blocks, and the sub-blocks are obtained by segmenting the blocks. Of course, both blocks and sub-blocks can be called blocks (image blocks).
  • small dots represent color sample points of a color information group of a sub-block
  • nine large dots represent calibration points of nine standard light sources.
  • the color samples within the range enclosed by the dotted line can be regarded as close enough to the nine light sources.
  • These color samples can be regarded as valid color samples.
  • the effective color samples can be used as the basis for subsequent calculations. Outside the range enclosed by the dotted line
  • the color samples can be regarded as invalid color samples, and the invalid color samples can not be used as the basis for subsequent calculations.
  • all color samples can also be regarded as valid color samples.
  • the main goal of the above AWB correction method is to calculate the color temperature of the light source. Therefore, all color samples within the circled range of the dashed line can be added and the average Avg (R / G, B / G) can be calculated; according to the calibration point of the standard light source (Such as the calibration points of the nine standard light sources in Figure 2) and the relative positional relationship with Avg (R / G, B / G) to estimate the color temperature of the only light source existing in the image shooting environment; based on the average Avg (R / G, B / G) and the estimated color temperature of the only light source in the image shooting environment is converted to obtain the gain values of the three RGB channels, namely (R-gain, G-gain, B-gain); Gain, G-gain, B-gain) is multiplied by (R, G, B) of each pixel in the image to correct the color temperature deviation of the sole light source, which results in AWB correction.
  • the above AWB correction method can estimate the color temperature of the only light source in the image shooting environment (for example, the color temperature of this unique light source can be specifically output 5000K), and when there are multiple light sources in the shooting environment and the color temperature of each light source is different, such as at the same time There are light sources with high, medium, and low color temperatures.
  • the above AWB correction method cannot effectively determine whether there are multiple light sources with different color temperatures in the image shooting environment, so the color temperature of the only light source can usually be estimated as the basis for correcting the color cast of the image.
  • the only light source can be called a single light source.
  • multiple different color temperatures can be called mixed color temperatures.
  • Multiple different color temperature light sources can be called mixed color temperature light sources.
  • the embodiments of the present application further provide some light source estimation methods. These light source estimation methods strive to estimate whether there are multiple light sources with different color temperatures in the image shooting environment.
  • the inventors of the present application have found through extensive research that when there are multiple light sources with different color temperatures in the image shooting environment, the physical characteristics of light sources projected by different color temperatures are usually different from the physical characteristics of a single light source projection. Therefore, the physical characteristics of the light source projection can be analyzed to determine whether there are multiple light sources with different color temperatures in the image shooting environment, and this idea is helpful to overcome the misjudgement of the color temperature of the light source caused by the color of the object itself.
  • some solutions in the embodiments of the present application use color information and brightness information of an image to estimate whether there are two or more light sources with different color temperatures in an image shooting environment.
  • the color and brightness information of an image can be obtained, for example, by dividing the image into m sub-blocks, where m is an integer greater than 1.
  • Acquire m color luminance information groups of the m sub-blocks Each color luminance information group corresponds to one sub-block (that is, a one-to-one correspondence between the m sub-blocks and m color luminance information groups), and the color luminance information group includes luminance information and color information.
  • the image may be an original image obtained by a camera or other images.
  • the color information and brightness information of the image include m color brightness information groups of m sub-blocks of the image.
  • m may be equal to 2, 3, 4, 8, 12, 16, 32, 64, 128, 256, or other values.
  • the sizes of the m sub-blocks may be all the same, partially the same, or different from each other.
  • the shape of the sub-blocks can be square, rectangular, or other shapes.
  • the image is divided into m sub-blocks of the same size, and in the example shown in FIG. 3B, the image is divided into m sub-blocks of different sizes.
  • the sub-block segmentation method of the image is not limited to the method illustrated in FIGS. 3A and 3B.
  • the color information may be expressed in the following form: (R / G, B / G) or (Cb, Cr) or (U, V), and the brightness information may be expressed as BV (bright value). Therefore, the color luminance information group of the sub-block can be expressed as (R / G, B / G, BV) or (Cb, Cr, BV) or (U, V, BV), for example.
  • the m color brightness information groups may be mapped to a color brightness three-dimensional space to obtain m color brightness sample points located in the color brightness three-dimensional space.
  • Each color brightness sample point corresponds to one color brightness information group (that is, one-to-one correspondence between m color brightness sample points and m color brightness information groups in a color brightness three-dimensional space), and the color brightness three-dimensional space Includes two color dimensions and one brightness dimension. Further, by performing clustering processing on m color brightness sample points located in the color brightness three-dimensional space, multiple color brightness sample point groups can be obtained. Alternatively, the m color brightness samples located in the three-dimensional color brightness space are first layered along the brightness dimension, and then the color brightness samples of each layer are grouped, and multiple color brightness samples can be obtained for each layer. Point group.
  • the inventors of the present application analyzed the distribution characteristics of relevant color brightness sample points and found that in the mixed color temperature scene, there is a strong degree of blending between the color brightness sample groups; in the monochrome temperature scene, , There is a weaker blending degree between the color brightness sample clusters.
  • the blending degree between the two color luminance sample clusters can indicate the closeness of the connection between the two color luminance sample clusters. Among them, the greater the degree of blending between the two clusters, the higher the degree of closeness between the color brightness samples of the two clusters; the smaller the degree of blending between the two clusters, the color brightness samples of the two clusters The tighter the connection is.
  • some examples through two experimental examples are some examples through two experimental examples.
  • the right image in FIG. 4 is a captured image.
  • Daylight with a high color temperature in the shooting environment is illuminated through the window and A light with a low color temperature, that is, there is a mixed color temperature in the shooting environment.
  • the left figure in FIG. 4 shows the distribution of the color brightness samples of each sub-block of the image in the three-dimensional space of color brightness.
  • the horizontal plane of the three-dimensional space of color brightness has two color dimensions and one brightness dimension in the vertical direction. .
  • the 9 points above the left are the marked points of the standard light source, and the points below the left are the color brightness samples of the subblocks on the right.
  • the color brightness samples are divided into two groups (Group1, Group2), Group1 belongs to a high color temperature, and Group2 belongs to a low color temperature.
  • Group1 belongs to a high color temperature
  • Group2 belongs to a low color temperature.
  • This blending characteristic is mainly caused by light sources with high and low color temperatures being projected on the same object (such as the floor, etc.), and the two light sources will have a fusion effect in color and brightness.
  • the right image of Figure 5 is the captured image.
  • the shooting environment there is only a single high color temperature daylight light source, and no other artificial light source, that is, there is no mixed color temperature in the shooting environment.
  • the color brightness samples of this wood texture wall are distributed in the low color temperature region.
  • the left figure in Figure 5 shows the color brightness samples of each sub-block in the color brightness.
  • the 9 points on the upper left are labeled points of the standard light source, and the points on the lower left are sample points of the color brightness of each sub-block on the right.
  • Group1 belongs to a high color temperature
  • Group2 belongs to a low color temperature.
  • FIG. 6 is a schematic flowchart of a light source estimation method according to an embodiment of the present application.
  • a light source estimation method may be implemented in the system architecture shown in FIG. 1A or FIG. 1B.
  • the light source estimation method may be mainly performed by the image processing unit 120, and specifically, for example, by the light source estimation device in the image processing unit 120.
  • the methods can specifically include:
  • the image may be an original image or another image captured by a camera.
  • Each color luminance information group corresponds to one sub-block (that is, a one-to-one correspondence between the m sub-blocks and m color luminance information groups), and the color luminance information group includes luminance information and color information.
  • each color brightness sample point corresponds to a color brightness information group, that is, there is a one-to-one correspondence between m color brightness sample points and m color brightness information groups in a color brightness three-dimensional space.
  • the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
  • m 128, it means that the image is cut into 128 sub-blocks, and then the color brightness information groups of 128 sub-blocks can be obtained, and a total of 128 color brightness information groups are mapped to the 128 color brightness information groups. In the three-dimensional space of brightness, a total of 128 color brightness samples can be obtained. Each color brightness sample corresponds to a color brightness information group, and each color brightness information group corresponds to a sub-block.
  • the m color brightness sample points are divided into k layers along the brightness dimension, and each of the k layers is divided into P color brightness sample groupings.
  • any one of the following clustering algorithms can be used: k-means algorithm, hierarchical clustering algorithm, and density-based clustering algorithms.
  • Clustering density based clustering, DBSCAN
  • DBSCAN density based clustering
  • clustering density based clustering
  • other clustering algorithms may be used for clustering the color and brightness samples, which is not specifically limited in this embodiment.
  • k when k is equal to 1, it means that m color luminance samples are divided into the same layer, so the action of layering is not actually performed.
  • Each of the k layers corresponds to a brightness interval.
  • P is an integer greater than 1.
  • K is a positive integer.
  • P may be equal to 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 20, or 35 or other values.
  • k may be equal to 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, or other values.
  • the number of color brightness samples included in different layers of the k layers may be all the same, partly the same, or different from each other.
  • the heights of the brightness intervals corresponding to different layers in the k layers may be all the same, partially the same, or different from each other.
  • the color brightness sample points are divided into k layers along the brightness dimension, and each layer is distributed from dark to light, and the number of color brightness sample points of each layer are S1, S2, ..., Sk, respectively.
  • the number of color brightness samples in different layers may be all the same, some of them may be the same or different from each other.
  • the number of color brightness samples of brighter layers may be more or less, and for example, the number of color brightness samples of each layer is equal.
  • the blending degree threshold here is a blending degree threshold corresponding to the number of clusters P, that is, when the value of the number of clusters P is different, the blending threshold may also be different.
  • the blending degree threshold may not correspond to the number of clusters P, that is, when the value of the number of clusters P is different, the blending threshold may not change.
  • the blending threshold may be an empirical value or obtained based on experimental data, which is not limited in this application.
  • the second blending degree of the corresponding number of clusters P of the image is greater than the blending degree threshold, it is estimated that there are P light sources with different color temperatures in the shooting environment of the image, that is, a suitable number of light sources is obtained. P.
  • the second blending degree of the corresponding grouping number P of the image is less than or the blending degree threshold, it may be estimated that there are no P color temperatures in the shooting environment corresponding to the image Different light sources.
  • the present application may further combine other technical means to estimate whether there is only a single light source or multiple light sources with different color temperatures in the shooting environment corresponding to the image.
  • the blending degree between the two color luminance sample clusters can indicate the closeness of the connection between the two color luminance sample clusters.
  • the greater the degree of blending between the two clusters the higher the degree of closeness between the color brightness samples of the two clusters; the smaller the degree of blending between the two clusters, the color brightness samples of the two clusters The tighter the connection is.
  • This light source estimation method obtains the color brightness by mapping the color brightness information group of the image segmented sub-blocks to the color brightness three-dimensional space. Multiple color brightness sample points in three-dimensional space, and perform multiple layer clustering processing on multiple color brightness sample points, and then calculate the blending degree of the entire image by calculating the blending degree of the color brightness sample point clustering of each layer, and based on this It is estimated that there are multiple light sources with different color temperatures in the shooting environment corresponding to the image. Then, this lays the foundation for image correction based on the situation that includes multiple light sources with different color temperatures. For example, it makes it possible to perform targeted image correction when multiple light sources with different color temperatures are included, which in turn helps to improve the rationality of image correction.
  • P 2, ... Y light sources with different color temperatures in the shooting environment
  • P 2, ... Y
  • each value of P is determined as the final number of light sources. Therefore, each value of P is actually a hypothetical light source number, and this value is applied to the light source estimation method to determine whether the hypothetical value is appropriate.
  • the first blending degree of P1 determines the second blending degree of the number of clusters P1 corresponding to the image; comparing the second blending degree of the corresponding number of clusters P1 of the image with the blending degree threshold of the number of clusters P1.
  • the second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1, and the second degree of fusion of the corresponding number of clusters P2 of the image is less than or equal to the threshold of the degree of fusion of the number of clusters P2 In this case, it can be estimated that there are P1 light sources with different color temperatures in the shooting environment of the image.
  • the second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1 and the second degree of fusion of the corresponding number of clusters P2 of the image is greater than the threshold of the degree of fusion of the number of clusters P2
  • the second blending degree of the corresponding number of clusters P1 in the image is greater than the threshold of the blending degree of the number of clusters P1, and the second blending degree of the corresponding number of clusters P2 of the image is greater than
  • the blending degree threshold of the number of clusters P2 when the second blending degree of the corresponding clustering number P2 of the image is different from the blending degree threshold of the clustering number P2 (this difference can be expressed as (the image's The second degree of fusion corresponding to the number of clusters P2-the threshold of the degree of fusion of the number of clusters P2) / the threshold of the degree of fusion) is greater than the difference between the second degree of fusion of the corresponding number of clusters P1 and the threshold of the degree of fusion of the number of clusters P1 It is estimated that the shooting environment corresponding to the image includes P2 light sources with different color temperatures. That is, the number of clusters corresponding to the second blending degree that exceeds the corresponding blending degree
  • determining the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers may include: The first blending degree corresponding to the number of clusters P of each layer is summed or weighted to obtain a second blending degree corresponding to the number of clusters P of the image.
  • the weighted summation weight of the first blending degree of the number P can be determined based on the height of the brightness interval of each layer. For example, the higher the weighted summation weight of a layer with a relatively higher brightness interval, the greater the height of the brightness interval. The relatively smaller the layer, the smaller the corresponding weighted summation weight can be.
  • the weighted summation weight of the first blending degree corresponding to the number of clusters P of each layer may be determined based on the number of color brightness samples of each layer. For example, the layer with a relatively large number of color brightness samples has a corresponding weighted calculation. The larger the sum weight, the smaller the number of color brightness samples, and the smaller the corresponding weighted sum weight.
  • the weighted summation weight of each layer can also be determined based on other parameters.
  • calculating the first blending degree of the number of clusters P corresponding to each of the k layers may include: calculating the P-th clusters of the i-th layer The third degree of integration between each two subgroups. The third blending degree between each two clusters in the P clusters is summed or weighted to obtain a first blending degree of the number of clusters P corresponding to the i-th layer.
  • the i-th layer is any one of the k layers.
  • calculating the first blending degree of the number of clusters P corresponding to the i-th layer in the k-layer may include: calculating two of the i-th layer The third degree of integration between the clusters; wherein the first degree of integration of the number of clusters P corresponding to the i-th layer is equal to the third degree of integration between the two clusters.
  • the i-th layer is any one of the k layers.
  • calculating the third degree of blending between the cluster gi and the cluster gj may include inserting a continuous array of measurement cells between the center point of the cluster gi and the center point of the cluster gj, the continuous The number of arranged measurement cells is T.
  • the statistics include the number of measurement cells Q of the color brightness samples in the clusters gi and gj. It is determined that the third blending degree between the cluster gi and the cluster gj is Q / T.
  • the T and the Q are integers.
  • the T is greater than 0 and the Q is greater than or equal to 0.
  • the cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
  • the third blending degree between two pairs of subgroups can also be calculated in the same color plane.
  • calculating the third degree of fusion between cluster gi and cluster gj includes: projecting cluster gi and cluster gj to the same color plane (that is, the brightness of the color brightness sample points in cluster gi and cluster gj take the same value).
  • Continuously arranged measurement cells are inserted between the center point of the cluster gi and the center point of the cluster gj that are projected onto the same color plane.
  • the number of the continuously arranged measurement cells is T.
  • the statistics include the number of measurement cells Q of the color brightness samples in the clusters gi and gj.
  • the third blending degree between the cluster gi and the cluster gj is Q / T. among them.
  • the T is greater than 0 and the Q is greater than or equal to 0, and T and Q are integers.
  • the cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
  • the distance between the color brightness sample point in the cluster gi and the center point of the group gi is less than or equal to the distance between this color brightness sample point and the center point of the group gj.
  • the length of a single measurement cell may be equal to, for example, Dist_D65_D50, Dist_D75_D65, or Dist_D55_D50 or other experience values.
  • Dist_D75_D65 represents the distance between the calibration points of the standard light sources D75 and D65 in the color plane
  • Dist_D65_D50 represents the distance between the calibration points of the standard light source D65 and D50 in the color plane
  • Dist_D55_D50 represents the color plane, the standard The distance between the calibration points of the light sources D55 and D50; in other cases and so on.
  • the width of a single measurement cell is equal to length ⁇ 1/32, length ⁇ 1/20, length ⁇ 1/16, length ⁇ 1/19, or other experience values, such as the width of a single measurement cell Dist_D65_D50 / 32, Dist_D75_D65 / 32 , And so on in other cases.
  • the third blending degree between two pairs of subgroups can be calculated and calculated in the three-dimensional space of color brightness, and the third blending degree between two pairs of subgroups can also be calculated in the same color plane.
  • the two clusters are projected onto the same color plane to obtain all the samples of the two clusters located on the same color plane).
  • a single measurement cell is a three-dimensional measurement cell having a length, a width, and a height, and in this case, a single measurement cell The height may be greater than or equal to the layer height of the layer where the two clusters are located.
  • a single measurement cell is a measurement cell with a length and a width but not a high plane.
  • the single measurement cell For the length and width, please refer to the above examples.
  • the center points of the two clusters that are projected onto the same color plane are C1 and C2 respectively.
  • the points in the figure represent the color brightness samples of the two clusters.
  • the box indicates the measurement cell.
  • the number above the measurement cell indicates the number of color brightness samples that fall into the measurement cell. For example, when the number above the measurement cell is 1, it indicates the color that falls into the measurement cell in two subgroups.
  • the number of brightness samples is 1, when the number above the measurement cell is 0, it means that the number of color brightness samples that fall into the measurement cell in the two clusters is 0, and when the number above the measurement cell is 3, it means two The number of color brightness samples that fall into the measurement cell in the cluster is 3, and so on in other cases.
  • the measurement cells inserted into the measurement cells of C1 and C2 may fall into the color brightness samples, that is, some or all of the measurement cells inserted into the measurement cells of C1 and C2 include the color brightness samples. If the number of measured measurement cells including color brightness samples is Q and the total number of measurement cells inserted into C1 and C2 is T, then the third degree of integration between the two clusters can be calculated as Q / T (also expressed as (Q / T) ⁇ 100%).
  • the length direction of the continuously arranged measurement cells may be perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj (for example, as shown in FIG. 9).
  • the length direction of the continuously arranged measurement cells may not be perpendicular to the line connecting the center point of the cluster gi and the center point of the cluster gj.
  • the included angle range between the longitudinal direction and the line connecting the center point may be, for example, 60 ° to 90 °.
  • the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of the cluster gi is equal to that in the cluster gi The average value of the first color dimension coordinates of all the color brightness sample points, and the second color dimension coordinate of the center point of the cluster gi is equal to the average value of the second color dimension coordinates of all the color brightness sample points in the cluster gi.
  • the color brightness sample points in the color brightness three-dimensional space are divided into k layers along the brightness dimension.
  • the number of color brightness samples for each layer is S1, S2 ... Sk. Please refer to FIG. 7.
  • the horizontal plane (color plane) in FIG. 7 is two color dimensions, and the vertical direction is one brightness dimension.
  • the four planes perpendicular to the brightness dimension divide the color brightness three-dimensional space into five layers, so that multiple color brightness samples are distributed in these five layers.
  • the layer division rules have been described in the previous embodiments, and will not be repeated here.
  • the color brightness samples in each layer are grouped.
  • the plane in FIG. 8 is a color plane formed by two color dimensions.
  • FIG. 8 specifically shows a result of dividing a plurality of color luminance samples included in a layer into two clusters, and the center points of each cluster are respectively C1 and C2.
  • the clustering algorithm can refer to the introduction of the previous embodiment.
  • the two clusters may not be included in the calculation of the image blending degree. .
  • the distance between the center points of two clusters is greater than Cent_Dist_min and is included in the calculation as an example.
  • the distance between the calibration points of the standard light sources D65 and D50 on the color planes (R / G and B / G planes) is Dist_D65_D50.
  • the above minimum distance threshold Cent_Dist_min Dist_D65_D50 ⁇ 70% can be set, and This is used as a criterion to select whether this layer is included in the calculation of image blending.
  • the two clusters may be included in the calculation of the image fusion degree. In this case, it can be considered as the smallest.
  • the distance threshold Cent_Dist_min 0.
  • successively arranged measurement cells are inserted between C1 and C2.
  • a plurality of measurement cells arranged consecutively are inserted between C1 and C2
  • the length of a single measurement cell may be Dist_D65_D50.
  • the width of a single measurement cell can be Dist_D65_D50 / 32.
  • the length and width of a single measurement cell actually used may also be other suitable values, which are not limited in this application. Assuming that the number of consecutively arranged measurement cells is T (in the example shown in FIG.
  • T represents the total number of measurement cells inserted between C1 and C2)
  • P is greater than 2
  • the degree of blending between the two subgroups of each layer can be calculated according to the above example.
  • a certain layer is divided into (g1, g2, g3, g4) four groups.
  • L (g1, g2) represents the blending degree between g1 and g2, and so on.
  • the blending degree of each layer is summed (or weighted summation) to obtain the blending degree of the entire image. Specifically, after multiplying the blending degree of each layer by the corresponding weighted value, the summation of the image's blending degree Total_Con P (P represents how many groups each layer is divided into), if the blending degree of the image exceeds the blending threshold Th P ( The blending threshold Th P corresponds to the number of clusters P), and it can be estimated that there are P light sources of different color temperatures in the image shooting environment.
  • Total_Con 2 and Total_Con 3 are larger than the corresponding blending threshold and Total_Con 4 is smaller than the corresponding blending threshold Th 4 , it can be estimated that there are three different color temperature light sources in the image shooting environment.
  • Total_Con 2 is larger than the corresponding blending threshold Th 2
  • Total_Con 3 and Total_Con 4 are smaller than the corresponding blending threshold, it can be estimated that there are two different color temperature light sources in the image shooting environment.
  • Total_Con 2 is larger than the corresponding blending threshold Th 2 , Total_Con 3 and Total_Con 4 are smaller than the corresponding blending threshold, it can be estimated that there are two different color temperature light sources in the image shooting environment. If Total_Con 4 is less than the corresponding blending degree threshold Th 4 , Total_Con 2 and Total_Con 3 are greater than the corresponding blending degree threshold, then the image blending degree that exceeds the corresponding blending degree threshold the most (that is, the difference between the image blending degree and the blending degree threshold is the largest ), The number of clusters is determined as the number of light sources with different color temperatures.
  • the image may be correlated and corrected according to P light sources with different color temperatures.
  • FIG. 10 is a schematic flowchart of an image processing method according to an embodiment of the present application.
  • An image processing method may be implemented in the system architecture shown in FIG. 1A or FIG. 1B.
  • the image processing method may be mainly performed by the image processing unit 120.
  • steps related to light source estimation in the image processing method may be performed by The light source estimation device 121 in the image processing component 120 is mainly executed, and the steps related to the correction in the image processing method may be mainly performed by the image signal processor 122 in the image processing component 120.
  • the method may specifically include:
  • the light source estimation method may be any one of the light source estimation methods provided in the foregoing embodiments.
  • the image is corrected according to the P light sources with different color temperatures.
  • the image is corrected according to the monochrome temperature light source.
  • the correction may include at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
  • the correction may be performed by an image signal processor (ISP).
  • the light source estimation method can be performed by a light source estimation device.
  • a structural diagram of a specific image processing apparatus may be shown in FIG. 11A.
  • the color shift of the light source is corrected by the AWB correction circuit.
  • white objects will appear as white as possible, but other colors may not be accurate.
  • a color correction (CC) circuit corrects each color to the correct color through color correction.
  • the saturation correction circuit can further use the color enhancement (CE) mechanism to specify a specific color in the image, and increase or decrease its saturation to complete the saturation correction, thereby improving the color style of the image.
  • CE color enhancement
  • a contrast correction circuit (such as Gamma) is used to correct the contrast of the image brightness.
  • the order of the circuits in the ISP in FIG. 11A can be adjusted and changed. For example, it can also be adjusted to the order shown in the example in FIG. 11A to obtain the structure in FIG. 11B. Of course, it can also be adjusted to other orders according to needs.
  • This application does not go into details.
  • the light source estimation device After estimating the number of light sources, the light source estimation device transmits information with the number to the ISP, so that the ISP performs the correction using the information, and the execution order of different types of corrections can be adjusted and changed. For specific correction methods, refer to other existing literatures, which are not described in this application.
  • the captured image may appear light blue (caused by a high color temperature light source) and light yellow (caused by a low color temperature light source).
  • the color of the light source will be more intense on the image. Because the brain recognizes that the light source is white. People are not sensitive to the color of the light source. For images taken under a multi-color temperature light source environment, the excessively strong color of the light source will be considered by the user to be the wrong color, especially a light blue with a high color temperature.
  • the AWB is adjusted so that the correction of the light source is biased to a high color temperature to reduce the color cast of light blue, reduce the color intensity of CC and CE, reduce the color of the light source, and reduce the contrast of Gamma , To reduce the brightness difference between high and low color temperature light sources, so that photos taken under a multi-color temperature light source environment, is conducive to closer to the scene seen by the human eye.
  • an embodiment of the present application further provides a light source estimation device 1200.
  • the light source estimation device 1200 may include:
  • the segmentation unit 1210 is configured to segment an image into m sub-blocks, where m is an integer greater than 1.
  • the obtaining unit 1220 is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information.
  • a mapping unit 1230 is configured to map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where each color brightness sample is associated with one The color brightness information group corresponds, and the color brightness three-dimensional space includes two color dimensions and one brightness dimension.
  • a calculation unit 1240 is configured to calculate when the m color luminance samples are divided into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups.
  • Each of the k layers corresponds to a brightness interval (continuous brightness interval).
  • P is an integer greater than 1
  • k is a positive integer.
  • a determining unit 1250 is configured to determine a second blending degree of the grouping number P corresponding to the image based on a first blending degree of the grouping number P corresponding to each of the k layers.
  • the comparing unit 1260 is configured to compare the second blending degree of the corresponding grouping number P of the image with the blending degree threshold.
  • the estimation unit 1270 is configured to estimate that at least P different color temperatures exist in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is greater than the blending degree threshold.
  • Light source In addition, the estimation unit 1270 may be further configured to, when the second blending degree of the corresponding clustering number P of the image is less than the blending degree threshold, estimate the different color temperatures in the shooting environment corresponding to the image.
  • the number of light sources is not P.
  • the determining unit 1250 is specifically configured to perform summing or weighted summing processing on a first blending degree P corresponding to the number of clusters P of each of the k layers to obtain a second blending degree corresponding to the number of clusters P of the image .
  • the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation unit 1240 is specifically configured to calculate the i-th A third blending degree between every two clusters in the P subgroups of the layer; summing or weighting the third blending degree between each two clusters in the P clusters to obtain the i-th
  • the first blending degree of the grouping number P corresponding to the layer, and the i-th layer is any one of the k layers.
  • the calculation unit 1240 is specifically configured to: insert between the center point of the cluster gi and the center point of the cluster gj
  • the number of consecutively arranged measurement cells is T.
  • the cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
  • the calculation unit 1240 may count the number of measurement cells Q including the color brightness sample points in the cluster gi and the cluster gj, and determine that the third blending degree between the cluster gi and the cluster gj is Q / T, wherein the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0.
  • a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj.
  • the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, and a first color dimension coordinate of a center point of any cluster is equal to all The average value of the first color dimension coordinates of the color brightness sample points, and the second color dimension coordinate of the center point of the any group is equal to the average value of the second color dimension coordinates of all the color brightness sample points in the any group.
  • the calculation unit, the determination unit, the comparison unit, and the estimation unit may perform the calculation, the determination, the comparison, and
  • X is an integer greater than two.
  • all units in FIG. 12 may be specifically implemented by software codes (specifically, may be implemented by software codes executed by a processor); or some units in FIG. 12 may be specifically implemented by software codes, and another part of the units may be implemented by hardware circuits. ; Or all units in FIG. 12 may be specifically implemented by hardware circuits. In the example shown in FIG. 13, all units in FIG. 12 are implemented by hardware circuits as an example.
  • an embodiment of the present application further provides a light source estimation device 1300.
  • the light source estimation device 1300 may be implemented by a hardware circuit, and may include a segmentation circuit 1310, an acquisition circuit 1320, a mapping circuit 1330, and a calculation.
  • any circuit may include multiple transistors, logic gates, or basic circuit logic units.
  • a segmentation circuit 1310 is configured to segment an image into m sub-blocks, where m is an integer greater than 1.
  • the obtaining circuit 1320 is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information.
  • a mapping circuit 1330 is configured to map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, and each color brightness sample is associated with one color brightness.
  • the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
  • a calculation circuit 1340 is configured to calculate when the m color luminance samples are divided into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups.
  • Each of the k layers corresponds to a brightness interval (continuous brightness interval).
  • P is an integer greater than 1
  • k is a positive integer.
  • a determining circuit 1350 is configured to determine a second blending degree of the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers.
  • the comparison circuit 1360 is configured to compare the second blending degree and the blending degree threshold of the corresponding grouping number P of the image.
  • an estimation circuit 1370 is configured to estimate that at least P different color temperatures exist in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is greater than the blending degree threshold.
  • the estimation circuit 1370 may be further configured to estimate a difference in a shooting environment corresponding to the image in a case where the second blending degree of the corresponding clustering number P of the image is smaller than the blending degree threshold.
  • the number of light sources of color temperature is not P.
  • the determining circuit 1350 is specifically configured to perform summing or weighted summing processing on the first blending degree P of the number of clusters P corresponding to each of the k layers to obtain the second blending degree of the corresponding number of clusters P of the image .
  • the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation circuit 1340 is specifically configured to calculate the i-th A third blending degree between every two clusters in the P subgroups of the layer; summing or weighting the third blending degree between each two clusters in the P clusters to obtain the i-th
  • the first blending degree of the grouping number P corresponding to the layer, and the i-th layer is any one of the k layers.
  • the calculation circuit 1340 is specifically configured to: insert a continuous between a center point of cluster gi and a center point of cluster gj
  • the number of the arranged measurement cells is T.
  • the cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
  • the calculation circuit 1340 is configured to count the number of measurement cells Q including color brightness samples in the cluster gi and the cluster gj, and determine that the third degree of integration between the cluster gi and the cluster gj is Q / T, wherein the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0.
  • a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj.
  • the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension
  • a first color dimension coordinate of a center point of any cluster is equal to all
  • the second color dimension coordinate of the center point of the any group is equal to the average value of the second color dimension coordinates of all the color brightness sample points in the any group.
  • the calculation circuit, the determination circuit, the comparison circuit, and the estimation circuit may perform the calculation, the determination, the comparison, and In the estimation, X is an integer greater than two.
  • an embodiment of the present application further provides a light source estimation device 1400.
  • the light source estimation device 1400 includes a processor 1410 and a memory 1420 that are coupled to each other.
  • a computer program is stored in the memory 1410.
  • the processor 1410 is configured to call a computer program stored in the memory 1420 to execute any one of the light source estimation methods provided in the embodiments of the present invention. For details, refer to the previous embodiments.
  • the processor 1410 may include a central processing unit (CPU) or other processors, such as a digital signal processor (DSP), a microprocessor, a microcontroller, or a neural network calculator.
  • the components of the light source estimation device are coupled together, for example, through a bus system.
  • the bus system may include a data bus, a power bus, a control bus, and a status signal bus.
  • the various buses are marked as the bus system 1430 in the figure.
  • the light source estimation method disclosed in the foregoing embodiment of the present application may be applied to the processor 1410, or implemented by the processor 1410.
  • the processor 1410 may be an integrated circuit chip, and has processing capabilities of image signals.
  • each step of the above-mentioned light source estimation method may be completed by an integrated logic circuit of hardware in the processor 1410 or an instruction in the form of software. That is, the processor 1410 may include, in addition to a computing unit executing software instructions, other hardware accelerators, such as an application-specific integrated circuit, an off-the-shelf programmable gate array or other programmable logic device, a discrete gate or transistor logic device, and a discrete Hardware components.
  • the processor 1410 may implement or execute various light source estimation methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The steps of the light source estimation method disclosed in the embodiments of the present application can be directly implemented as hardware, software, or a combination of hardware and software modules.
  • the software module may be located in a random storage, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, and the like, which are mature storage media in the art.
  • the storage medium is located in the memory 1420.
  • the processor 1410 can read information in the memory 1420 and complete the steps of the foregoing method in combination with its hardware.
  • the processor 1410 may be used, for example, to divide an image into m sub-blocks, where m is an integer greater than 1, and obtain m color luminance information groups of the m sub-blocks, each color luminance information group and one sub-block
  • the color brightness information group includes brightness information and color information
  • the m color brightness information groups are mapped to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where Each color brightness sample corresponds to a color brightness information group, and the color brightness three-dimensional space includes two color dimensions and a brightness dimension
  • the m color brightness samples are divided into k layers along the brightness dimension
  • the first blending degree of the number of clusters P corresponding to each of the k layers is calculated;
  • Each layer corresponds to a brightness interval, the P is an integer greater than 1, and the k is a positive integer; the number of clusters corresponding to the image is determined based on the first
  • an embodiment of the present application further provides an image processing apparatus 1500.
  • the image processing apparatus 1500 includes a processor 1510 and a memory 1520 coupled to each other.
  • a computer program is stored in the memory 1520.
  • the processor 1510 is configured to call a computer program stored in the memory 1520 to execute any image processing method provided by an embodiment of the present invention. In addition to light source estimation, this method also performs the previously mentioned correction operations.
  • an embodiment of the present application further provides an image processing device 1600.
  • the image processing device 1600 includes a light source estimation device 1610 and a correction device 1620 coupled to each other.
  • the light source estimation device 1610 may be, for example, the light source estimation device 1200 or 1300 or 1400.
  • the correction device 1620 is configured to correct the image according to P light sources with different color temperatures.
  • the correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
  • the correction device may be, for example, an image signal processor (ISP).
  • the ISP may include at least one of the following correction circuits: an automatic white balance correction circuit 1621, a color correction circuit 1622, a saturation correction circuit 1623, or a contrast correction. Circuit 1624.
  • the automatic white balance correction circuit 1621 may be used to perform automatic white balance correction on an image according to P light sources with different color temperatures.
  • the color correction circuit 1622 can be used to perform color correction on an image according to P light sources with different color temperatures.
  • the saturation correction circuit 1623 can be used to perform saturation correction on an image according to P light sources with different color temperatures.
  • the contrast correction circuit 1624 can be used to perform contrast correction on an image according to P light sources with different color temperatures.
  • An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, wherein the computer program is executed by related hardware to complete the execution of any one of the light sources provided by the embodiments of the present invention. Estimate method.
  • an embodiment of the present application further provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program, and the computer program is executed by related hardware to complete execution of any image provided by the embodiment of the present invention. Approach.
  • An embodiment of the present application further provides a computer program product, wherein when the computer program product runs on a computer, the computer is caused to execute any one of the light source estimation methods provided by the embodiments of the present invention.
  • an embodiment of the present application further provides a computer program product, and when the computer program product runs on a computer, the computer is caused to execute any one of the image processing methods provided by the embodiments of the present invention.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the above units is only a logical function division.
  • multiple units or components may be combined or integrated.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be electrical or other forms.
  • the functional units in the embodiments of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.
  • the above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
  • the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, where the computer software product is stored in a
  • the computer-readable storage medium includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, and specifically a processor in the computer device) to perform all of the foregoing methods of the embodiments of the present application. Or some steps.
  • the foregoing storage medium may include: various programs that can store programs such as a U disk, a mobile hard disk, a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
  • programs such as a U disk, a mobile hard disk, a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
  • the medium of the code may include: various programs that can store programs such as a U disk, a mobile hard disk, a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Color Television Image Signal Generators (AREA)
  • Image Processing (AREA)
  • Spectrometry And Color Measurement (AREA)

Abstract

A light source estimating method, an image processing method and related products. The light source estimating method maps a color brightness information group of a sub-block of image segmentation into a color brightness three-dimensional space to obtain a plurality of color brightness sample points in the color brightness three-dimensional space, performs hierarchical cluster processing on the plurality of color brightness sample points, and calculates the blending degree of the color brightness sample point cluster of each layer to calculate the blending degree of the entire image, and estimates whether a plurality of light sources of different color temperatures exists in the photographing environment of the image based on the blending degree. Since the light source estimating method can estimate whether a plurality of light sources of different color temperatures exists in the photographing environment of the image to some extent, this provides a basis for performing corresponding image correction based on the case that a plurality of light sources of different color temperatures is comprised, so that it is possible to perform targeted image correction in the case that a plurality of light sources of different color temperatures is comprised, thereby facilitating improving the targeted characteristic and rationality of image correction.

Description

光源估测方法、图像处理方法和相关产品Light source estimation method, image processing method and related products 技术领域Technical field
本申请涉及了图像处理领域,具体涉及了光源估测方法、图像处理方法和相关产品。The present application relates to the field of image processing, and in particular, to a light source estimation method, an image processing method, and related products.
背景技术Background technique
日光为自然界光源。除日光这种自然界光源,人工光源可由不同的灯具所产生,日光与不同灯具的光源所表现的色温各有差异。色温是评估光源颜色的一个物理量,其定义为将一个黑体(绝对黑色辐射体,其类似于不会反射入射光的封闭碳块)加热到一定温度后其会发光,其发光的颜色会随着黑体温度的高低而改变。当某个光源所发射光的颜色与黑体发射光的颜色相同之时,此时黑体的温度即是此光源的色温。Daylight is a natural light source. Except for the natural light source such as daylight, artificial light sources can be generated by different lamps, and the color temperature of daylight and light sources of different lamps are different. Color temperature is a physical quantity that evaluates the color of a light source. It is defined as heating a black body (absolute black radiator, which is similar to a closed carbon block that does not reflect incident light) to a certain temperature, and it will emit light. Black body temperature changes. When the color of the light emitted by a light source is the same as the color of the black body, the temperature of the black body is the color temperature of the light source.
光源的色温由高到低可以有高色温、中色温和低色温等分类。高色温光源的色彩偏向淡蓝色,低色温光源色彩偏向淡黄色。在数字相机拍摄时,未经处理的原始图像存在整体偏色(偏蓝色、偏黄色或偏绿色)问题。偏差的颜色受场景中光源颜色(色温)的影响,要消除此整体偏色一般通过自动白平衡(auto white balance,AWB)校正技术实现,AWB校正技术可计算出拍摄环境下的光源色温,据此校正图像色偏,力求使得原本场景中白色物件在图像中呈现白色。The color temperature of the light source can be classified into high color temperature, medium color temperature, and low color temperature from high to low. The color of high color temperature light sources is light blue, and the color of low color temperature light sources is light yellow. When shooting with a digital camera, the unprocessed original image suffers from overall color cast (blue, yellow, or green). The color of the deviation is affected by the color (color temperature) of the light source in the scene. To eliminate this overall color cast, it is generally achieved by automatic white balance (AWB) correction technology. AWB correction technology can calculate the color temperature of the light source in the shooting environment. This corrects the color cast of the image, and strives to make the white objects in the original scene appear white in the image.
当拍摄环境中存在多个光源且各光源色温皆不同,例如同时存在高中低色温,传统AWB校正技术无法判断环境中是否存在混合色温,所以通常只能估算出一个光源色温作为校正图像色偏的依据。例如若AWB校正技术计算出的光源色温较接近环境中的高色温,则修正后图像中的低色温区域会偏黄色,反之若计算出的光源色温较接近低色温,则图像中的高色温区域有偏蓝的问题。由于人眼对于混合色温光源场景下的光源颜色差异并不敏锐(大脑会将光源想成接近白色),因此在混合色温场景下,图像出现淡蓝色与淡黄色的光源颜色就可能引发使用者感觉颜色出错。因此,如何估测环境中不同色温的光源的数量就成为一个迫切需求。When there are multiple light sources in the shooting environment and the color temperature of each light source is different, such as high, medium, and low color temperatures at the same time, the traditional AWB correction technology cannot determine whether there is a mixed color temperature in the environment, so usually only one light source color temperature can be estimated as the color deviation of the corrected image in accordance with. For example, if the color temperature of the light source calculated by the AWB correction technology is closer to the high color temperature in the environment, the low color temperature area in the corrected image will be yellowish, and if the calculated light source color temperature is closer to the low color temperature, the high color temperature area in the image There is a bluish problem. Because the human eye is not sensitive to the difference in the color of the light source in the mixed color temperature light source scene (the brain will think of the light source as close to white), in the mixed color temperature scene, the light blue and yellow light source colors in the image may trigger the user Feel the color is wrong. Therefore, how to estimate the number of light sources with different color temperatures in the environment has become an urgent need.
发明内容Summary of the invention
本申请实施例提供光源估测方法、图像处理方法和相关产品。The embodiments of the present application provide a light source estimation method, an image processing method, and related products.
第一方面,本申请实施例提供一种光源估测方法可包括:In a first aspect, an embodiment of the present application provides a method for estimating a light source, which may include:
将图像切分为m个子块(m个子块的尺寸可全部相同、部分相同或互不相同,子块的形状可为正方形、长方形或其它形状),所述m为大于1的整数。获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应(即所述m个子块与m个色彩亮度信息组之间一一对应),所述色彩亮度信息组包括亮度信息和色彩信息。其中,所述图像可是摄像头拍摄得到的原始图像或其它图像。Divide the image into m sub-blocks (m sub-blocks may be all the same size, partially the same, or different from each other, and the shape of the sub-blocks may be square, rectangular, or other shapes), where m is an integer greater than 1. Acquiring m color luminance information groups of the m sub-blocks, each color luminance information group corresponding to one sub-block (that is, one-to-one correspondence between the m sub-blocks and m color luminance information groups), the color luminance The information group includes brightness information and color information. The image may be an original image or another image captured by a camera.
将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,其中,每个色彩亮度样点与一个色彩亮度信息组对应(即色彩亮度三维空间中的m个色彩亮度样点与m个色彩亮度信息组之间一一对应),所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。Map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where each color brightness sample corresponds to one color brightness information group ( That is, there is a one-to-one correspondence between m color brightness sample points and m color brightness information groups in a color brightness three-dimensional space. The color brightness three-dimensional space includes two color dimensions and one brightness dimension.
在所述m个色彩亮度样点被沿所述亮度维度划分为k层(可以理解,在k等于1的情况下表示m个色彩亮度样点被划分到了同一层,那么分层这个动作也就并不实际执行),且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度。其中,所述k层中的每层对应一亮度区间(连续亮度区间),所述P为大于1的整数,所述k为正整数。When the m color brightness sample points are divided into k layers along the brightness dimension (it can be understood that when k is equal to 1, it means that m color brightness sample points are divided into the same layer, then the action of layering is also (Not actually performed), and in the case where each of the k layers is divided into P color luminance sample clusters, a first blending degree of the number of clusters P corresponding to each of the k layers is calculated. Each of the k layers corresponds to a brightness interval (continuous brightness interval), where P is an integer greater than 1, and k is a positive integer.
基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度。可以理解,在k等于1的情况下表示m个色彩亮度样点被划分到了同一层,那么此时只得到唯一一层对应的分群数P的第一交融度,此时,则可直接将唯一这层对应的分群数P的第一交融度作为所述图像对应的分群数P的第二交融度。A second blending degree of the number of clusters P corresponding to the image is determined based on the first blending degree of the number of clusters P corresponding to each of the k layers. It can be understood that when k is equal to 1, it means that m color brightness samples are divided into the same layer, then only the first blending degree of the number of clusters P corresponding to the only layer is obtained. At this time, the The first blending degree of the number of clusters P corresponding to this layer is the second blending degree of the number of clusters P corresponding to the image.
比较所述图像的对应的分群数P的第二交融度与交融度阈值。在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中至少存在P个色温不同的光源。Compare the second blending degree of the corresponding number of clusters P of the image with the blending degree threshold. In a case where the second blending degree of the corresponding grouping number P of the image is greater than the blending degree threshold, it is estimated that there are at least P light sources with different color temperatures in the shooting environment corresponding to the image.
其中,两个色彩亮度样点分群之间的交融度,可表征两个分群的色彩亮度样点之间的联系的紧密程度。其中,两个分群之间交融度越大,表示两个分群的色彩亮度样点之间的联系的紧密程度越高;两个分群之间交融度越小,表示两个分群的色彩亮度样点之间的联系的紧密程度越低。The blending degree between the two color luminance sample clusters can indicate the closeness of the connection between the two color luminance sample clusters. Among them, the greater the degree of blending between the two clusters, the higher the degree of closeness between the color brightness samples of the two clusters; the smaller the degree of blending between the two clusters, the color brightness samples of the two clusters The tighter the connection is.
其中,当k大于1时,所述k层中的不同层包括的色彩亮度样点的数量可全相同,部分相同或互不相同。When k is greater than 1, the number of color brightness samples included in different layers of the k layers may be all the same, partly the same, or different from each other.
其中,当k大于1时,所述k层中的不同层对应的亮度区间的高度可全相同、部分相同或互不相同。When k is greater than 1, the heights of the brightness intervals corresponding to different layers in the k layers may be all the same, partially the same, or different from each other.
此外,在一些可能的实施方式中,在所述图像的对应的分群数P的第二交融度小于或等于所述交融度阈值的情况下,可估测所述图像所对应拍摄环境中存在不同色温的光源的数量不为P个(在这种情况下,图像所对应拍摄环境中可能存在单色温光源,也可能还是存在混合色温光源)。In addition, in some possible implementation manners, when the second blending degree of the corresponding clustering number P of the image is less than or equal to the blending degree threshold, it may be estimated that there are differences in the shooting environments corresponding to the images. The number of color temperature light sources is not P (in this case, there may be a monochrome temperature light source or a mixed color temperature light source in the shooting environment corresponding to the image).
可以看出,本申请实施例给出了一种有效的光源估测方法,这种光源估测方法通过将图像切分的子块的色彩亮度信息组映射到色彩亮度三维空间,得到位于色彩亮度三维空间中的多个色彩亮度样点,并对多个色彩亮度样点进行分层分群处理,进而通过计算各层的色彩亮度样点分群的交融度来计算整个图像的交融度,并据此估测所述图像所对应拍摄环境中存在多个色温不同光源的情况,这为基于包括多个色温不同光源的情况进行图像校正奠定了基础。It can be seen that the embodiment of the present application provides an effective light source estimation method. This light source estimation method obtains the color brightness by mapping the color brightness information group of the image segmented sub-blocks to the color brightness three-dimensional space. Multiple color brightness sample points in three-dimensional space, and perform multiple layer clustering processing on multiple color brightness sample points, and then calculate the blending degree of the entire image by calculating the blending degree of the color brightness sample point clustering of each layer, and based on this It is estimated that there are multiple light sources with different color temperatures in the shooting environment corresponding to the image, which lays a foundation for image correction based on the situation that includes multiple light sources with different color temperatures.
在一些可能的实施方式中,基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度可包括:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理,以得到所述图像的对应的分群数P的第二交融度。In some possible implementation manners, determining the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers may include: The first blending degree corresponding to the number of clusters P of each layer is summed or weighted to obtain a second blending degree corresponding to the number of clusters P of the image.
其中,当对所述k层中的每层对应的分群数P的第一交融度加权求和处理以得到所述图像的对应的分群数P的第二交融度,那么每层对应的分群数P的第一交融度的加权求和权重可基于各层的亮度区间高度来确定,例如亮度区间高度相对越高的层,其对应的加权求和权重可越大,亮度区间高度相对越小的层,其对应的加权求和权重可越小。或者每层对应 的分群数P的第一交融度的加权求和权重可基于各层的色彩亮度样点数量确定,例如色彩亮度样点数量相对越多的层,其对应的加权求和权重可以越大,色彩亮度样点数量相对越少的层,其对应的加权求和权重可越小。当然,也可以基于其它参数来确定各层的加权求和权重。Wherein, when the first blending degree P corresponding to the number of clusters P in each of the k layers is weighted and summed to obtain the second blending degree corresponding to the number of clusters P in the image, then the number of clusters corresponding to each layer The weighted summation weight of the first blending degree of P may be determined based on the height of the brightness interval of each layer. For example, the higher the weighted summation weight of a layer with a relatively higher brightness interval, the greater the correspondingly smaller height of the brightness interval. Layer, the corresponding weighted summation weight can be smaller. Or the weighted summation weight of the first blending degree corresponding to the number of clusters P of each layer can be determined based on the number of color brightness samples of each layer. For example, the layer with a relatively large number of color brightness samples has a corresponding weighted summation weight The larger the layer with a relatively small number of color luminance samples, the smaller the corresponding weighted summation weight can be. Of course, the weighted summation weight of each layer can also be determined based on other parameters.
在一些可能的实施方式中,当所述P大于2;计算所述k层中的第i层对应的分群数P的第一交融度可包括:计算所述第i层的P个分群中每两个分群之间的第三交融度;将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理,以得到所述第i层对应的分群数P的第一交融度。所述第i层为所述k层中的任意一层。In some possible implementation manners, when the P is greater than 2, calculating the first blending degree of the number of clusters P corresponding to the i-th layer in the k-layer may include: calculating each of the P-groups of the i-th layer A third degree of fusion between the two clusters; summing or weighting the third degree of fusion between each two clusters in the P clusters to obtain the number of clusters P corresponding to the i-th layer First degree of blending. The i-th layer is any one of the k layers.
在一些可能的实施方式中,当所述P等于2;计算所述k层中的第i层对应的分群数P的第一交融度可包括:计算所述第i层的两个分群之间的第三交融度;其中,所述第i层对应的分群数P的第一交融度等于所述两个分群之间的第三交融度。所述第i层为所述k层中的任意一层。In some possible implementation manners, when the P is equal to 2; calculating the first blending degree of the number of clusters P corresponding to the i-th layer in the k layers may include: calculating between two clusters of the i-th layer A third degree of integration; wherein the first degree of integration of the number of clusters P corresponding to the i-th layer is equal to the third degree of integration between the two clusters. The i-th layer is any one of the k layers.
在一些可能的实施方式中,计算分群gi和分群gj之间的第三交融度可包括:在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格,所述连续排列的量度单元格数量为T。统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q。确定所述分群gi和所述分群gj之间的第三交融度为Q/T,其中,所述T和所述Q为整数,所述T大于0且所述Q大于或等于0。其中,所述分群gi和所述分群gj为所述第i层的所述P个分群中任意两个分群。In some possible implementation manners, calculating the third blending degree between the cluster gi and the cluster gj may include inserting a continuous array of measurement cells between the center point of the cluster gi and the center point of the cluster gj, the continuous array The number of measurement cells is T. The statistics include the number of measurement cells Q of the color brightness samples in the clusters gi and gj. A third blending degree between the cluster gi and the cluster gj is determined as Q / T, where the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0. The cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
在一些可能的实施方式中,单个量度单元格的长可为Dist_D65_D50。单个量度单元格的宽可为Dist_D65_D50/32。当然,量度单元格的长和宽也设计为其它值,具体取值可基于场景需要来设定。In some possible implementations, the length of a single measurement cell may be Dist_D65_D50. The width of a single measurement cell can be Dist_D65_D50 / 32. Of course, the length and width of the measurement cell are also designed to other values, and the specific values can be set based on the needs of the scene.
在一些可能的实施方式中,所述连续排列的量度单元格的长度方向,可以与所述分群gi的中心点和所述分群gj的中心点的连线垂直。当然,所述连续排列的量度单元格的长度方向,也可与所述分群gi的中心点和所述分群gj的中心点的连线不垂直(长度方向与中心点连线之间的夹角范围例如可为60°至90°)。In some possible implementation manners, the length direction of the continuously arranged measurement cells may be perpendicular to a line connecting the center point of the cluster gi and the center point of the cluster gj. Of course, the length direction of the continuously arranged measurement cells may not be perpendicular to the line connecting the center point of the cluster gi and the center point of the cluster gj (the angle between the length direction and the line connecting the center points) The range may be, for example, 60 ° to 90 °).
在一些可能的实施方式中,所述色彩亮度三维空间包括的两个色彩维度为第一色彩维度和第二色彩维度,其中,任一分群的中心点的第一色彩维度坐标等于该任一分群中所有色彩亮度样点的第一色彩维度坐标的平均值,所述该任一分群的中心点的第二色彩维度坐标等于该任一分群中所有色彩亮度样点的第二色彩维度坐标的平均值。具体例如,所述分群gi的中心点的第一色彩维度坐标等于分群gi中所有色彩亮度样点的第一色彩维度坐标的平均值,所述分群gi的中心点的第二色彩维度坐标等于分群gi中所有色彩亮度样点的第二色彩维度坐标的平均值。In some possible implementation manners, the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of any cluster is equal to the any cluster The average value of the first color dimension coordinates of all color brightness samples in the cluster, and the second color dimension coordinate of the center point of the any cluster is equal to the average of the second color dimension coordinates of all color brightness samples in the any cluster value. Specifically, for example, the first color dimension coordinate of the center point of the cluster gi is equal to the average value of the first color dimension coordinates of all color brightness samples in the cluster gi, and the second color dimension coordinate of the center point of the cluster gi is equal to the cluster. The average value of the second color dimension coordinates of all color brightness samples in gi.
在一些可能的实施方式中,由于P为大于1的整数,那么可分别针对P=2,…X执行所述计算、确定、比较和估测,X为大于2的整数。在分别估测到所述拍摄环境中存在P=2,…Y个色温不同的光源的情况下,可确定所述拍摄环境中存在P=Y个色温不同的光源。所述Y为大于2且小于等于所述X的整数。In some possible implementations, since P is an integer greater than 1, the calculation, determination, comparison, and estimation may be performed for P = 2,... X, respectively, where X is an integer greater than 2. When it is estimated that there are P = 2, ... Y light sources with different color temperatures in the shooting environment, it can be determined that P = Y light sources with different color temperatures exist in the shooting environment. The Y is an integer greater than 2 and less than or equal to the X.
举例来说,分别设定P=P1和P=P2;For example, set P = P1 and P = P2 respectively;
那么,计算所述k层中的每层对应的分群数P1的第一交融度;基于所述k层中的每层对应的分群数P1的第一交融度确定所述图像对应的分群数P1的第二交融度;比较所述图像的对应分群数P1的第二交融度与分群数P1的交融度阈值。并且,计算所述k层中的每层对应的分群数P2的第一交融度;基于所述k层中的每层对应的分群数P2的第一交融度确定所述图像对应的分群数P2的第二交融度;比较所述图像的对应的分群数P2的第二交融度与分群数P2的交融度阈值。Then, calculate a first blending degree of the number of clusters P1 corresponding to each layer in the k layers; and determine a number of clusters P1 corresponding to the image based on the first blending degree of the number of clusters P1 corresponding to each layer in the k layers The second blending degree of the image; comparing the second blending degree of the corresponding clustering number P1 of the image with the blending degree threshold of the clustering number P1. In addition, a first blending degree of the number of clusters P2 corresponding to each of the k layers is calculated; and a number of clusters P2 corresponding to the image is determined based on the first blending degree of the number of clusters P2 corresponding to each of the k layers. The second blending degree of the image; comparing the second blending degree of the corresponding number of clusters P2 of the image with the blending degree threshold of the number of clusters P2.
在所述图像的对应的分群数P1的第二交融度大于分群数P1的交融度阈值,且所述图像的对应的分群数P2的第二交融度小于或等于分群数P2的交融度阈值的情况下,则可估测所述图像的拍摄环境中存在P1个色温不同的光源。The second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1, and the second degree of fusion of the corresponding number of clusters P2 of the image is less than or equal to the threshold of the degree of fusion of the number of clusters P2 In this case, it can be estimated that there are P1 light sources with different color temperatures in the shooting environment of the image.
此外,在所述图像的对应的分群数P1的第二交融度大于分群数P1的交融度阈值,且所述图像的对应的分群数P2的第二交融度大于分群数P2的交融度阈值的情况下,当所述P2大于所述P1(例如P2=P1+1),可估测所述图像的拍摄环境中存在P2个色温不同的光源。In addition, the second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1 and the second degree of fusion of the corresponding number of clusters P2 of the image is greater than the threshold of the degree of fusion of the number of clusters P2 In the case, when the P2 is larger than the P1 (for example, P2 = P1 + 1), it can be estimated that there are P2 light sources with different color temperatures in the shooting environment of the image.
或者在另一种可选的实现方式i中,在所述图像的对应的分群数P1的第二交融度大于分群数P1的交融度阈值,并且所述图像的对应的分群数P2的第二交融度大于分群数P2的交融度阈值的情况下,当所述图像的对应分群数P2的第二交融度与分群数P2的交融度阈值之间的差异性(这差异性可以表现为(所述图像的对应分群数P2的第二交融度-分群数P2的交融度阈值)/交融度阈值),大于所述图像的对应分群数P1的第二交融度与分群数P1的交融度阈值之间的差异性,估测所述图像所对应拍摄环境中包括P2个色温不同的光源。Or in another optional implementation manner i, the second blending degree of the corresponding number of clusters P1 of the image is greater than the threshold of the blending degree of the number of clusters P1, and the second corresponding number of clusters of the image P2 When the blending degree is greater than the blending degree threshold of the number of clusters P2, when the second blending degree of the corresponding clustering number P2 of the image and the blending degree threshold of the clustering number P2 are different (this difference can be expressed as (the The second degree of fusion corresponding to the number of clusters P2 of the image-the degree of fusion threshold of the number of clusters P2) / the threshold of the degree of fusion) is greater than the second degree of fusion of the corresponding number of clusters P1 and the threshold of the degree of fusion of the number of clusters P1 It is estimated that the shooting environment corresponding to the image includes P2 light sources with different color temperatures.
第二方面,本申请实施例提供另一种光源估测方法,可包括:In a second aspect, an embodiment of the present application provides another method for estimating a light source, which may include:
步骤S1:将图像切分为m个子块,所述m为大于1的整数。Step S1: Divide the image into m sub-blocks, where m is an integer greater than 1.
步骤S2:获取所述m个子块的m个色彩亮度信息组,其中,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息。Step S2: Obtain m color brightness information groups of the m sub-blocks, where each color brightness information group corresponds to one sub-block, and the color brightness information group includes brightness information and color information.
步骤S3:将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。Step S3: Map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, each color brightness sample point corresponding to one color brightness information group The color brightness three-dimensional space includes two color dimensions and one brightness dimension.
步骤S4:将所述m个色彩亮度样点沿所述亮度维度划分为k层;Step S4: divide the m color brightness samples into k layers along the brightness dimension;
步骤S5:从色温不同光源的备选数量集合中还未被选择的一个数量赋值给P。Step S5: Assign a value that has not been selected from the set of candidate numbers of light sources with different color temperatures to P.
步骤S6:将所述k层中的每层划分为P个色彩亮度样点分群,计算所述k层中的每层对应的分群数P的第一交融度。所述k层中的每层对应一亮度区间,所述P为大于1的整数,所述k为正整数。Step S6: Divide each of the k layers into P color brightness sample point clusters, and calculate a first blending degree of the number of clusters P corresponding to each of the k layers. Each of the k layers corresponds to a brightness interval, where P is an integer greater than 1, and k is a positive integer.
步骤S7:基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度。Step S7: Determine a second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers.
步骤S8:比较所述图像的对应的分群数P的第二交融度与交融度阈值。在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中至少存在P个色温不同的光源。返回步骤步骤S5。Step S8: Compare the second blending degree of the corresponding clustering number P of the image with the blending degree threshold. In a case where the second blending degree of the corresponding grouping number P of the image is greater than the blending degree threshold, it is estimated that there are at least P light sources with different color temperatures in the shooting environment corresponding to the image. Return to step S5.
其中,备选数量集合中例如包括2,…X等X-1个备选数量,由于每次都将备选数量集合中还未被选择的一个数量赋值给P,那么经过X-1次流程执行后(即步骤S5-步骤S8被循环执 行X-1次之后),备选数量集合的每个备选数量都将轮流的被赋值给P,即P=2,…X,即相当于分别针对P=2,…X执行计算、确定、比较和估测等步骤。Among them, the candidate quantity set includes, for example, X-1 candidate quantities such as 2, ... X. Since each time a quantity that has not been selected in the candidate quantity set is assigned to P, then the process is performed X-1 times. After execution (that is, steps S5 to S8 are executed cyclically X-1 times), each candidate quantity of the candidate quantity set will be assigned to P in turn, that is, P = 2, ... X, which is equivalent to respectively The steps of calculation, determination, comparison and estimation are performed for P = 2, ... X.
第三方面,本申请实施例还提供一种图像处理方法,包括:In a third aspect, an embodiment of the present application further provides an image processing method, including:
执行如第一方面或第二方面的任意一种光源估测方法。依据P个色温不同的光源对所述图像进行校正,其中,所述校正包括如下校正中的至少一种:自动白平衡校正、色彩校正、饱和度校正、或对比度校正。The light source estimation method according to any one of the first aspect or the second aspect is performed. The image is corrected according to P light sources with different color temperatures, wherein the correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
第四方面,本申请实施例还提供了一种光源估测装置,光源估测装置可以包括:切分单元、获取单元、映射单元、计算单元、确定单元、比较单元和估测单元。In a fourth aspect, an embodiment of the present application further provides a light source estimation device. The light source estimation device may include a segmentation unit, an acquisition unit, a mapping unit, a calculation unit, a determination unit, a comparison unit, and an estimation unit.
其中,切分单元,用于将图像切分为m个子块,所述m为大于1的整数。The segmentation unit is configured to segment an image into m sub-blocks, where m is an integer greater than 1.
获取单元,用于获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息。The obtaining unit is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information.
映射单元,用于将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,其中,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。A mapping unit, configured to map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where each color brightness sample is associated with a color The brightness information group corresponds, and the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
计算单元,用于在所述m个色彩亮度样点被沿所述亮度维度划分为k层,且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度。其中,所述k层中的每层对应一亮度区间(连续亮度区间)。其中,所述P为大于1的整数,所述k为正整数。A calculation unit, configured to calculate all the m color luminance sample points into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups. The first blending degree of the number of clusters P corresponding to each of the k layers is described. Each of the k layers corresponds to a brightness interval (continuous brightness interval). Wherein, P is an integer greater than 1, and k is a positive integer.
确定单元,用于基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度。The determining unit is configured to determine a second blending degree of the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers.
比较单元,用于比较所述图像的对应的分群数P的第二交融度与交融度阈值。The comparison unit is configured to compare the second blending degree of the corresponding grouping number P of the image with the blending degree threshold.
其中,估测单元,用于在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中至少存在P个色温不同的光源。Wherein, an estimation unit is configured to, when the second blending degree corresponding to the corresponding number of clusters P of the image is greater than the blending degree threshold, estimate that at least P different color temperatures exist in the shooting environment corresponding to the image. light source.
此外,估测单元还可用于,在所述图像的对应的分群数P的第二交融度小于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中存在的色温不同的光源的数量不为P个。In addition, the estimation unit may be further configured to estimate light sources with different color temperatures in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is less than the blending degree threshold. The number is not P.
在一些可能实施方式中,所述k大于1,在基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度的方面,所述确定单元具体用于:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理以得到所述图像的对应的分群数P的第二交融度。In some possible implementation manners, where k is greater than 1, in determining an aspect of the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers, The determining unit is specifically configured to perform summing or weighted summing processing on a first blending degree of the number of clusters P corresponding to each of the k layers to obtain a second blend of the corresponding number of clusters P of the image degree.
在一些可能的实施方式中,所述P大于2;在计算所述k层中的第i层对应的分群数P的第一交融度的方面,所述计算单元具体用于:计算所述第i层的P个分群中每两个分群之间的第三交融度;将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理以得到所述第i层对应的分群数P的第一交融度,所述第i层为所述k层中的任意一层。In some possible implementation manners, the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation unit is specifically configured to calculate the first a third blending degree between every two clusters in the P clusters of the i-layer; summing or weighted summing the third blending degree between every two clusters in the P clusters to obtain the first The first blending degree of the grouping number P corresponding to the i-layer, and the i-th layer is any one of the k-layers.
在一些可能的实施方式中,在计算分群gi和分群gj之间的第三交融度的方面,所述计算单元具体用于:In some possible implementation manners, in terms of calculating a third blending degree between the cluster gi and the cluster gj, the calculation unit is specifically configured to:
在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格,所述连续排列的量度单元格数量为T。其中,所述分群gi和所述分群gj为所述第i层的所述P个分群中任意 两个分群。A continuous array of measurement cells is inserted between the center point of the cluster gi and the center point of the cluster gj, and the number of the continuous array measurement cells is T. Wherein, the cluster gi and the cluster gj are any two of the P clusters in the i-th layer.
统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q;确定所述分群gi和所述分群gj之间的第三交融度为Q/T,其中,所述T和所述Q为整数,所述T大于0且所述Q大于或等于0。The statistics include the number of measurement cells Q of the color brightness sample points in the cluster gi and the cluster gj; it is determined that the third blending degree between the cluster gi and the cluster gj is Q / T, where T and all Said Q is an integer, said T is greater than 0 and said Q is greater than or equal to 0.
在一些可能的实施方式中,所述连续排列的量度单元格的长度方向,与所述分群gi的中心点和所述分群gj的中心点的连线垂直。In some possible implementation manners, a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj.
在一些可能的实施方式中,所述色彩亮度三维空间包括的两个色彩维度为第一色彩维度和第二色彩维度,其中,任一分群的中心点的第一色彩维度坐标等于该任一分群中所有色彩亮度样点的第一色彩维度坐标的平均值,所述该任一分群的中心点的第二色彩维度坐标等于该任一分群中所有色彩亮度样点的第二色彩维度坐标的平均值。In some possible implementation manners, the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of any cluster is equal to the any cluster The average value of the first color dimension coordinates of all color brightness samples in the cluster, and the second color dimension coordinate of the center point of the any cluster is equal to the average of the second color dimension coordinates of all color brightness samples in the any cluster value.
在一些可能的实施方式中,所述计算单元、所述确定单元、所述比较单元和所述估测单元可以分别针对P=2,…X执行所述计算、所述确定、所述比较和所述估测,X为大于2的整数。In some possible implementation manners, the calculation unit, the determination unit, the comparison unit, and the estimation unit may perform the calculation, the determination, the comparison, and In the estimation, X is an integer greater than two.
所述估测单元进一步用于,在分别估测到所述拍摄环境中存在P=2,…Y个色温不同的光源的情况下,确定所述拍摄环境中存在P=Y个色温不同的光源,所述Y为大于2且小于等于所述X的整数。The estimation unit is further configured to determine, when it is estimated that P = 2, ... Y light sources with different color temperatures exist in the shooting environment, determine that P = Y light sources with different color temperatures exist in the shooting environment. , Wherein Y is an integer greater than 2 and less than or equal to X.
第五方面,本申请实施例还提供了一种光源估测装置,光源估测装置可以包括:切分电路、获取电路、映射电路、计算电路、确定电路、比较电路和估测电路。In a fifth aspect, an embodiment of the present application further provides a light source estimation device. The light source estimation device may include a segmentation circuit, an acquisition circuit, a mapping circuit, a calculation circuit, a determination circuit, a comparison circuit, and an estimation circuit.
切分电路,用于将图像切分为m个子块,所述m为大于1的整数。A segmentation circuit is used to segment an image into m sub-blocks, where m is an integer greater than 1.
获取电路,用于获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息。The obtaining circuit is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information.
映射电路,用于将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,其中,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。A mapping circuit, configured to map the m color luminance information groups to a color luminance three-dimensional space to obtain m color luminance samples located in the color luminance three-dimensional space, where each color luminance sample is associated with a color The brightness information group corresponds, and the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
计算电路,用于在所述m个色彩亮度样点被沿所述亮度维度划分为k层,且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度。其中,所述k层中的每层对应一亮度区间(连续亮度区间),其中,所述P为大于1的整数,所述k为正整数。A calculation circuit, configured to calculate all the m color luminance sample points divided into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups. The first blending degree of the number of clusters P corresponding to each of the k layers is described. Each of the k layers corresponds to a brightness interval (continuous brightness interval), where P is an integer greater than 1, and k is a positive integer.
确定电路,用于基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度。A determining circuit is configured to determine a second blending degree of the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers.
比较电路,用于比较所述图像的对应的分群数P的第二交融度与交融度阈值。The comparison circuit is configured to compare the second blending degree and the blending degree threshold of the corresponding grouping number P of the image.
估测电路,用于在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中至少存在P个色温不同的光源。An estimation circuit is configured to estimate that at least P light sources with different color temperatures exist in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is greater than the blending degree threshold.
在一些可能实施方式中,所述k大于1,在基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度的方面,所述确定电路具体用于:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理以得到所述图像的对应的分群数P的第二交融度。In some possible implementation manners, where k is greater than 1, in determining an aspect of the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers, The determining circuit is specifically configured to perform summing or weighted summing processing on a first blending degree of the number of clusters P corresponding to each of the k layers to obtain a second blend of the corresponding number of clusters P of the image degree.
在一些可能的实施方式中,所述P大于2;在计算所述k层中的第i层对应的分群数P的第一交融度的方面,所述计算电路具体用于:计算所述第i层的P个分群中每两个分群之间的第三交融度;将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理以得到所述第i层对应的分群数P的第一交融度,所述第i层为所述k层中的任意一层。In some possible implementation manners, the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation circuit is specifically configured to calculate the first a third blending degree between every two clusters in the P clusters of the i-layer; summing or weighted summing the third blending degree between every two clusters in the P clusters to obtain the first The first blending degree of the grouping number P corresponding to the i-layer, and the i-th layer is any one of the k-layers.
在一些可能的实施方式中,当所述P等于2;在计算所述k层中的第i层对应的分群数P的第一交融度的方面:所述计算电路可具体用于:计算所述第i层的两个分群之间的第三交融度;其中,所述第i层对应的分群数P的第一交融度等于所述两个分群之间的第三交融度。所述第i层为所述k层中的任意一层。In some possible implementation manners, when the P is equal to 2; in terms of calculating a first blending degree of the number of clusters P corresponding to the ith layer in the k layer, the calculation circuit may be specifically configured to: The third degree of integration between the two subgroups of the i-th layer is described, wherein the first degree of integration of the number of subgroups P corresponding to the i-th layer is equal to the third degree of integration between the two subgroups. The i-th layer is any one of the k layers.
在一些可能的实施方式中,在计算分群gi和分群gj之间的第三交融度的方面,所述计算电路具体用于:In some possible implementation manners, in terms of calculating a third degree of fusion between the cluster gi and the cluster gj, the calculation circuit is specifically configured to:
在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格,所述连续排列的量度单元格数量为T;其中,所述分群gi和所述分群gj为所述第i层的所述P个分群中任意两个分群;A continuous array of measurement cells is inserted between the center point of the cluster gi and the center point of the cluster gj, and the number of the continuously arrayed measurement cells is T; where the cluster gi and the cluster gj are the i-th Any two of the P groupings of the layer;
统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q;确定所述分群gi和所述分群gj之间的第三交融度为Q/T,其中,所述T和所述Q为整数,所述T大于0且所述Q大于或等于0。The statistics include the number of measurement cells Q of the color brightness sample points in the cluster gi and the cluster gj; it is determined that the third blending degree between the cluster gi and the cluster gj is Q / T, where T and all Said Q is an integer, said T is greater than 0 and said Q is greater than or equal to 0.
在一些可能的实施方式中,所述连续排列的量度单元格的长度方向,与所述分群gi的中心点和所述分群gj的中心点的连线垂直。In some possible implementation manners, a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj.
在一些可能的实施方式中,所述色彩亮度三维空间包括的两个色彩维度为第一色彩维度和第二色彩维度,其中,任一分群的中心点的第一色彩维度坐标等于该任一分群中所有色彩亮度样点的第一色彩维度坐标的平均值,所述该任一分群的中心点的第二色彩维度坐标等于该任一分群中所有色彩亮度样点的第二色彩维度坐标的平均值。In some possible implementation manners, the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of any cluster is equal to the any cluster The average value of the first color dimension coordinates of all color brightness samples in the cluster, and the second color dimension coordinate of the center point of the any cluster is equal to the average of the second color dimension coordinates of all color brightness samples in the any cluster value.
在一些可能的实施方式中,所述计算单元、所述确定单元、所述比较单元和所述估测单元可以分别针对P=2,…X执行所述计算、所述确定、所述比较和所述估测,X为大于2的整数。In some possible implementation manners, the calculation unit, the determination unit, the comparison unit, and the estimation unit may perform the calculation, the determination, the comparison, and In the estimation, X is an integer greater than two.
所述估测单元进一步用于,在分别估测到所述拍摄环境中存在P=2,…Y个色温不同的光源的情况下,确定所述拍摄环境中存在P=Y个色温不同的光源,所述Y为大于2且小于等于所述X的整数。The estimation unit is further configured to determine, when it is estimated that P = 2, ... Y light sources with different color temperatures exist in the shooting environment, determine that P = Y light sources with different color temperatures exist in the shooting environment. , Wherein Y is an integer greater than 2 and less than or equal to X.
第六方面,本申请实施例还提供一种图像处理装置,包括:According to a sixth aspect, an embodiment of the present application further provides an image processing apparatus, including:
相互耦合的光源估测装置和校正装置。Mutually coupled light source estimation device and correction device.
所述光源估测装置为第五方面或第四方面提供的任意一种光源估测装置。The light source estimation device is any one of the light source estimation devices provided in the fifth aspect or the fourth aspect.
所述校正装置用于,依据P个色温不同的光源对所述图像进行校正,所述校正包括如下校正中的至少一种:自动白平衡校正、色彩校正、饱和度校正、或对比度校正。The correction device is configured to correct the image according to P light sources with different color temperatures, and the correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
其中,所述校正装置例如可为图像信号处理器(image signal processor,ISP),所述ISP例如可包括如下校正电路中的至少一种:自动白平衡校正电路、色彩校正电路、饱和度校正电路、或对比度校正电路。The correction device may be, for example, an image signal processor (ISP). The ISP may include at least one of the following correction circuits: an automatic white balance correction circuit, a color correction circuit, and a saturation correction circuit. , Or contrast correction circuit.
第七方面,本申请实施例还提供一种光源估测装置,所述光源估测装置包括相互耦合 的处理器和存储器,所述存储器中存储有计算机程序;所述处理器用于调用所述存储器中存储的计算机程序,以执行第一方面或第二方面提供的任意一种光源估测方法。In a seventh aspect, an embodiment of the present application further provides a light source estimation device. The light source estimation device includes a processor and a memory coupled to each other. The memory stores a computer program. The processor is configured to call the memory. A computer program stored in the computer to execute any one of the light source estimation methods provided in the first aspect or the second aspect.
第八方面,本申请实施例还提供一种图像处理装置,所述光源估测装置包括相互耦合的处理器和存储器,所述存储器中存储有计算机程序;所述处理器用于调用所述存储器中存储的计算机程序,以执行第三方面提供的任意一种图像处理方法。According to an eighth aspect, an embodiment of the present application further provides an image processing apparatus. The light source estimation apparatus includes a processor and a memory coupled to each other. The memory stores a computer program. The processor is configured to call the memory. A stored computer program to execute any one of the image processing methods provided by the third aspect.
第九方面,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序被相关硬件执行,以完成第一方面或第二方面提供的任意一种光源估测方法。In a ninth aspect, an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, wherein the computer program is executed by related hardware to complete the first aspect or the second aspect Any of the light source estimation methods provided.
第十方面,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被相关硬件执行,以完成第三方面提供的任意一种图像处理方法。According to a tenth aspect, an embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is executed by related hardware to complete any one of the images provided by the third aspect. Approach.
第十一方面,本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行第一方面或第二提供的任意一种光源估测方法。According to an eleventh aspect, an embodiment of the present application further provides a computer program product, and when the computer program product runs on a computer, the computer is caused to execute any one of the light source estimation methods provided in the first aspect or the second aspect.
第十二方面,本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行第三方面提供的任意一种图像处理方法。In a twelfth aspect, an embodiment of the present application further provides a computer program product, and when the computer program product runs on a computer, the computer is caused to execute any one of the image processing methods provided in the third aspect.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1A是本申请实施例举例提供的一种设备系统架构示意图。FIG. 1A is a schematic diagram of a device system architecture according to an example of the present application.
图1B是本申请实施例举例提供的图像处理部件的架构示意图。FIG. 1B is a schematic structural diagram of an image processing component provided as an example in an embodiment of the present application.
图1C是本申请实施例举例提供的一种标准光源的色温等级划分方式。FIG. 1C is a color temperature level division method of a standard light source provided by way of example in the embodiment of the present application.
图2是本申请实施例举例提供的一种将色彩信息组映射到在一二维色彩坐标平面的示意图。FIG. 2 is a schematic diagram of mapping a color information group to a two-dimensional color coordinate plane according to an example of the present application.
图3A和3B是本申请实施例举例提供的几种图像的子快划分示意图。3A and 3B are schematic diagrams of sub-speed division of several images provided by way of example in the embodiment of the present application.
图4是本申请实施例举例提供的一种混合色温光源场景下的色彩亮度样点的分布情况的示意图。FIG. 4 is a schematic diagram of the distribution of color brightness samples in a mixed color temperature light source scene provided by way of example in the embodiment of the present application.
图5是本申请实施例举例提供的一种单色温光源场景下的色彩亮度样点的分布情况的示意图。FIG. 5 is a schematic diagram of the distribution of color brightness samples in a monochrome temperature light source scene provided by way of example in the embodiment of the present application.
图6是本申请实施例提供的一种光源估测方法的流程示意图。FIG. 6 is a schematic flowchart of a light source estimation method according to an embodiment of the present application.
图7是本申请实施例提供的一种色彩亮度样点沿亮度维度分层的示意图。FIG. 7 is a schematic diagram of color brightness sample points layered along the brightness dimension according to an embodiment of the present application.
图8是本申请实施例提供的一种色彩亮度样点分群的示意图。FIG. 8 is a schematic diagram of clustering of color brightness samples according to an embodiment of the present application.
图9是本申请实施例提供的一种在两个色彩亮度样点分群的中心点之间插入连续排列的量度单元格的示意图。FIG. 9 is a schematic diagram of inserting a continuously arranged measurement cell between the center points of two color brightness sample point clusters according to an embodiment of the present application.
图10为本申请实施例提供的一种图像处理方法的流程示意图。FIG. 10 is a schematic flowchart of an image processing method according to an embodiment of the present application.
图11A为本申请实施例提供的一种图像处理装置的架构示意图。FIG. 11A is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application.
图11B为本申请实施例提供的另一种图像处理装置的架构示意图。FIG. 11B is a schematic structural diagram of another image processing apparatus according to an embodiment of the present application.
图12为本申请实施例还提供了一种光源估测装置的架构示意图。FIG. 12 is a schematic structural diagram of a light source estimation device according to an embodiment of the present application.
图13为本申请实施例还提供了另一种光源估测装置的架构示意图。FIG. 13 is a schematic structural diagram of another light source estimation device according to an embodiment of the present application.
图14为本申请实施例还提供了另一种光源估测装置的架构示意图。FIG. 14 is a schematic diagram of another light source estimation device according to an embodiment of the present application.
图15为本申请实施例还提供了一种图像处理装置的架构示意图。FIG. 15 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present application.
图16为本申请实施例还提供了另一种图像处理装置的架构示意图。FIG. 16 is a schematic structural diagram of another image processing apparatus according to an embodiment of the present application.
具体实施方式detailed description
本申请的说明书和权利要求书及上述附图中的术语“包括”和“具有”以及它们任何变形,意图在覆盖不排他的包括。例如包括一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或者可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。此外,本申请的说明书和权利要求书及上述附图中术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。The terms "including" and "having" in the specification and claims of the present application and the above-mentioned drawings, as well as any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally includes Other steps or units inherent to these processes, methods, products or equipment. In addition, the terms "first", "second", "third", and "fourth" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order .
下面先对本申请的一些系统架构进行介绍。参见图1A,图1A为本申请提供的一种系统架构示意图。系统100包括摄像头110、图像处理部件120和存储器130。其中,摄像头110用于拍摄得到图像(原始图像)。图像处理部件120用于对摄像头110拍摄得到的图像进行一些相关处理(例如对摄像头110拍摄得到的图像进行自动白平衡校正、色彩校正、饱和度校正和/或对比度校正等)。存储器130用于存储一些与图像处理相关的程序代码或数据等。The following first introduces some system architectures of this application. Referring to FIG. 1A, FIG. 1A is a schematic diagram of a system architecture provided by the present application. The system 100 includes a camera 110, an image processing unit 120, and a memory 130. The camera 110 is configured to capture an image (original image). The image processing unit 120 is configured to perform some related processing on the image obtained by the camera 110 (for example, perform automatic white balance correction, color correction, saturation correction, and / or contrast correction on the image obtained by the camera 110). The memory 130 is used to store some program code or data related to image processing.
其中,图像处理部件120可能由一个或多个处理器组成;或者,图像处理部件120可能既包括一个或多个处理器,也可能还包括一些硬件电路;或者图像处理部件120也可能不包括处理器,而是包括一些硬件电路。Among them, the image processing component 120 may be composed of one or more processors; or, the image processing component 120 may include both one or more processors or some hardware circuits; or the image processing component 120 may not include processing Controller, but includes some hardware circuits.
参见图1B,图像处理部件120例如包括图像信号处理器121和光源估测装置122等。光源估测装置122可用于对图像拍摄环境中的光源存在情况进行估测(例如可估测图像拍摄环境中到底是存在单色温光源,还是存在混合色温光源)等。其中,光源估测装置122输出的对图像拍摄环境中的光源存在情况的估测结果,例如可被图像信号处理器121在进行相关图像处理(例如对图像进行自动白平衡校正、色彩校正、饱和度校正和/或对比度校正等)时选择性的使用。Referring to FIG. 1B, the image processing section 120 includes, for example, an image signal processor 121, a light source estimation device 122, and the like. The light source estimation device 122 can be used to estimate the existence of a light source in the image shooting environment (for example, it can be estimated whether a monochrome temperature light source or a mixed color temperature light source exists in the image shooting environment). Among them, the estimation result of the existence of the light source in the image shooting environment output by the light source estimation device 122 can be performed by the image signal processor 121 for related image processing (for example, automatic white balance correction, color correction, saturation of the image). (Such as degree correction and / or contrast correction).
其中,图1A中是以摄像头110、图像信号处理器121和光源估测装置122等在物理上独立设置为例的,但实际应用中,某几个部件也可能物理上一体集成。例如,在某些实际产品设计中,光源估测装置122可能被集成到图像信号处理器121中,光源估测装置122也可能被集成到摄像头110中。当光源估测装置被集成到图像信号处理器中,这种情况下,图像信号处理器可具有上述举例描述中的光源估测装置的功能,而被集成了光源估测装置的图像信号处理器仍可称为图像信号处理器。类似的,当光源估测装置被集成到摄像头中,这种情况下,摄像头也就可具有上述举例描述中的光源估测装置的功能,而被集成了光源估测装置的摄像头仍可称为摄像头,其他情况可以此类推。Among them, in FIG. 1A, the camera 110, the image signal processor 121, the light source estimation device 122, and the like are physically set independently as an example. However, in actual applications, some components may be physically integrated as a whole. For example, in some actual product designs, the light source estimation device 122 may be integrated into the image signal processor 121, and the light source estimation device 122 may also be integrated into the camera 110. When the light source estimation device is integrated into the image signal processor, in this case, the image signal processor may have the function of the light source estimation device described in the above example, and the image signal processor integrated with the light source estimation device It can still be called an image signal processor. Similarly, when the light source estimation device is integrated into the camera, in this case, the camera can also have the function of the light source estimation device described in the above example, and the camera integrated with the light source estimation device can still be called Camera, and so on in other cases.
本申请提到的方法可基于上述举例的架构来具体实施。下面对标准光源进行一些简单介绍。标准光源一般是指色温为标准色温的光源。标准光源的色温等级由高到低可划分为高色温、中色温和低色温等三个等级,高色温、中色温和低色温又可分别具体划分为若干个子等级。参见图1C,图1C举例示出了一种标准光源的色温等级划分方式,图1C所示举例中将色温划分为10个子等级,具体例如,可将D75、D65、D55与D50归入高色温,将CWF、TL84与U30归入中色温,将A与H归入低色温。其中,高色温光源的色彩偏向淡藍色,低色温光源 色彩偏向淡黃色。The method mentioned in this application may be specifically implemented based on the architecture exemplified above. The following is a brief introduction to the standard light source. The standard light source generally refers to a light source whose color temperature is a standard color temperature. The color temperature level of a standard light source can be divided into three levels: high color temperature, medium color temperature, and low color temperature. High color temperature, medium color temperature, and low color temperature can be divided into several sub-levels. Referring to FIG. 1C, FIG. 1C illustrates a color temperature level division method of a standard light source by way of example. In the example shown in FIG. 1C, the color temperature is divided into 10 sub-levels. , CWF, TL84 and U30 are classified as medium color temperature, and A and H are classified as low color temperature. Among them, the color of high color temperature light sources is light blue, and the color of low color temperature light sources is light yellow.
下面先介绍一种AWB校正方法。首先将图像切分成n×m个子块(subblock),分别将每个子块的所有像素相加后求得这个子块的色彩平均值(R,G,B),基于这个色彩平均值可以得到这个子块的色彩信息组(R/G,B/G),也可以将(R,G,B)转换到(Y,Cb,Cr)或(Y,U,V)的色彩空间,那么色彩信息组也可表示为(Cb,Cr)或(U,V)等形式。再将每个子块的色彩信息组映射在一二维色彩坐标平面上(例如图2举例所示),进而形成位于二维色彩坐标平面中的色彩样点,每个色彩样点对应一个色彩信息组。The following first introduces an AWB correction method. First, the image is cut into n × m subblocks, and all pixels of each subblock are added to obtain the color average value (R, G, B) of this subblock. Based on this color average value, this can be obtained. The color information group (R / G, B / G) of the sub-block, or (R, G, B) can be converted to (Y, Cb, Cr) or (Y, U, V) color space, then the color information Groups can also be expressed as (Cb, Cr) or (U, V). Then, the color information group of each sub-block is mapped on a two-dimensional color coordinate plane (for example, as shown in FIG. 2), and then a color sample point located in the two-dimensional color coordinate plane is formed, and each color sample point corresponds to one color information. group.
可以理解,块(block)和子块(subblock)是一种相对概念,将块(图像块)进行切分则可得到这个块的子块,若对子块继续进行切分,那么即可得到这个子块的子块,即块由子块组成,子块由块切分得到。当然,块和子块也都可称为块(图像块)。It can be understood that block (block) and subblock (subblock) is a relative concept. Dividing a block (image block) can get the subblock of this block. If you continue to divide the subblock, you can get this The sub-block of the sub-block, that is, the block is composed of the sub-blocks, and the sub-blocks are obtained by segmenting the blocks. Of course, both blocks and sub-blocks can be called blocks (image blocks).
图2所示举例中,小圆点表示子块的色彩信息组的色彩样点,九个大圆点表示九种标准光源的标定点。例如,虚线所圈定范围内的色彩样点可看作足够接近九种光源,这些色彩样点可看作是有效色彩样点,有效色彩样点可作为后续计算的基础,虚线所圈定范围之外的色彩样点可看作无效色彩样点,无效色彩样点可不作为后续计算的基础。当然也可将所有色彩样点均看作是有效色彩样点。In the example shown in FIG. 2, small dots represent color sample points of a color information group of a sub-block, and nine large dots represent calibration points of nine standard light sources. For example, the color samples within the range enclosed by the dotted line can be regarded as close enough to the nine light sources. These color samples can be regarded as valid color samples. The effective color samples can be used as the basis for subsequent calculations. Outside the range enclosed by the dotted line The color samples can be regarded as invalid color samples, and the invalid color samples can not be used as the basis for subsequent calculations. Of course, all color samples can also be regarded as valid color samples.
上述AWB校正方法的主要目标是计算出光源色温,因此可将虚线所圈定范围内的所有色彩样点相加后再求平均值Avg(R/G,B/G);依据标准光源的标定点(例如图2中九种标准光源的标定点)与Avg(R/G,B/G)的相对位置关系,估测出图像拍摄环境内存在的唯一光源的色温;基于平均值Avg(R/G,B/G)和估测出的图像拍摄环境内存在唯一光源的色温换算得到RGB三个通道的增益值,即(R-gain,G-gain,B-gain);再将(R-gain,G-gain,B-gain)乘以图像中每个像素的(R,G,B),以修正唯一光源的色温造成图像色彩的偏差,即完成AWB校正。The main goal of the above AWB correction method is to calculate the color temperature of the light source. Therefore, all color samples within the circled range of the dashed line can be added and the average Avg (R / G, B / G) can be calculated; according to the calibration point of the standard light source (Such as the calibration points of the nine standard light sources in Figure 2) and the relative positional relationship with Avg (R / G, B / G) to estimate the color temperature of the only light source existing in the image shooting environment; based on the average Avg (R / G, B / G) and the estimated color temperature of the only light source in the image shooting environment is converted to obtain the gain values of the three RGB channels, namely (R-gain, G-gain, B-gain); Gain, G-gain, B-gain) is multiplied by (R, G, B) of each pixel in the image to correct the color temperature deviation of the sole light source, which results in AWB correction.
上述AWB校正方法可估测出的图像拍摄环境内的唯一光源的色温(例如具体可输出这个唯一光源的色温为5000K),而当拍摄环境中存在多个光源且各光源色温皆不同,例如同时存在高中低色温的光源,上述AWB校正方法无法有效判断图像拍摄环境中是否存在多个不同色温光源,所以通常只能估算出唯一光源的色温作为校正图像色偏依据。其中,唯一光源可称为单光源。与之相反,多个不同色温可称混合色温。多个不同色温光源可称混合色温光源。The above AWB correction method can estimate the color temperature of the only light source in the image shooting environment (for example, the color temperature of this unique light source can be specifically output 5000K), and when there are multiple light sources in the shooting environment and the color temperature of each light source is different, such as at the same time There are light sources with high, medium, and low color temperatures. The above AWB correction method cannot effectively determine whether there are multiple light sources with different color temperatures in the image shooting environment, so the color temperature of the only light source can usually be estimated as the basis for correcting the color cast of the image. Among them, the only light source can be called a single light source. In contrast, multiple different color temperatures can be called mixed color temperatures. Multiple different color temperature light sources can be called mixed color temperature light sources.
因此,如何估测图像拍摄环境中是否存在多个不同色温光源的情况,变得非常有研究和应用价值。基于此,本申请实施例下面进一步提供一些光源估测方法,这些光源估测方法力求估测出图像拍摄环境中是否存在多个不同色温光源的情况。Therefore, how to estimate whether there are multiple light sources with different color temperatures in the image shooting environment has become of great research and application value. Based on this, the embodiments of the present application further provide some light source estimation methods. These light source estimation methods strive to estimate whether there are multiple light sources with different color temperatures in the image shooting environment.
本申请发明人经过大量研究发现,当图像拍摄环境中存在多个不同色温光源,那么不同色温的光源投射的物理特性,通常有别于单一光源投射的物理特性。因此,可通过分析光源投射的物理特性,来判断图像拍摄环境中是否存在多个不同色温光源,并且这种思路有利于克服物体本身颜色引起的光源色温误判。The inventors of the present application have found through extensive research that when there are multiple light sources with different color temperatures in the image shooting environment, the physical characteristics of light sources projected by different color temperatures are usually different from the physical characteristics of a single light source projection. Therefore, the physical characteristics of the light source projection can be analyzed to determine whether there are multiple light sources with different color temperatures in the image shooting environment, and this idea is helpful to overcome the misjudgement of the color temperature of the light source caused by the color of the object itself.
具体的,本申请实施例一些方案,利用图像的色彩信息与亮度信息来估测图像拍摄环境中是否存在两个或两个以上不同色温的光源。图像的色彩信息与亮度信息例如可通过以 下方式取得:将图像切分为m个子块,m为大于1的整数。获取所述m个子块的m个色彩亮度信息组。其中,每个色彩亮度信息组与一个子块对应(即所述m个子块与m个色彩亮度信息组之间一一对应),所述色彩亮度信息组包括亮度信息和色彩信息。其中,所述图像可以是摄像头拍摄得到的原始图像或其它图像。其中,图像的色彩信息与亮度信息包括图像的m个子块的m个色彩亮度信息组。Specifically, some solutions in the embodiments of the present application use color information and brightness information of an image to estimate whether there are two or more light sources with different color temperatures in an image shooting environment. The color and brightness information of an image can be obtained, for example, by dividing the image into m sub-blocks, where m is an integer greater than 1. Acquire m color luminance information groups of the m sub-blocks. Each color luminance information group corresponds to one sub-block (that is, a one-to-one correspondence between the m sub-blocks and m color luminance information groups), and the color luminance information group includes luminance information and color information. The image may be an original image obtained by a camera or other images. The color information and brightness information of the image include m color brightness information groups of m sub-blocks of the image.
例如,m可等于2、3、4、8、12、16、32、64、128、256或其它值。m个子块的尺寸可全部相同、部分相同或互不相同。子块的形状可为正方形、长方形或者其它形状。例如参见图3A和图3B,图3A所示举例中图像被划分为相同尺寸的m个子块,图3B所示举例中图像被划分为尺寸不完全相同的m个子块。当然,图像的子块切分方式不限于图3A和图3B所举例的方式。For example, m may be equal to 2, 3, 4, 8, 12, 16, 32, 64, 128, 256, or other values. The sizes of the m sub-blocks may be all the same, partially the same, or different from each other. The shape of the sub-blocks can be square, rectangular, or other shapes. For example, referring to FIG. 3A and FIG. 3B, in the example shown in FIG. 3A, the image is divided into m sub-blocks of the same size, and in the example shown in FIG. 3B, the image is divided into m sub-blocks of different sizes. Of course, the sub-block segmentation method of the image is not limited to the method illustrated in FIGS. 3A and 3B.
其中,色彩信息例如可通过如下形式表示:(R/G,B/G)或(Cb,Cr)或(U,V),亮度信息可表示为BV(bright value)。因此,子块的色彩亮度信息组例如可表示为(R/G,B/G,BV)或(Cb,Cr,BV)或(U,V,BV)。为了对图像各子块的色彩亮度信息组进行分析,进而分析出各子块的色彩亮度信息组之间的关联性。进一步的,可将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点。其中,每个色彩亮度样点与一个色彩亮度信息组对应(即,色彩亮度三维空间中的m个色彩亮度样点与m个色彩亮度信息组之间一一对应),所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。进一步的,对位于色彩亮度三维空间中的m个色彩亮度样点进行分群处理,可得到多个色彩亮度样点分群。或者,对位于色彩亮度三维空间中的m个色彩亮度样点先沿着亮度维度进行分层,而后针对每层的色彩亮度样点进行分群处理,则对于每层均可得到多个色彩亮度样点分群。The color information may be expressed in the following form: (R / G, B / G) or (Cb, Cr) or (U, V), and the brightness information may be expressed as BV (bright value). Therefore, the color luminance information group of the sub-block can be expressed as (R / G, B / G, BV) or (Cb, Cr, BV) or (U, V, BV), for example. In order to analyze the color and brightness information groups of each sub-block of the image, and then analyze the correlation between the color and brightness information groups of each sub-block. Further, the m color brightness information groups may be mapped to a color brightness three-dimensional space to obtain m color brightness sample points located in the color brightness three-dimensional space. Each color brightness sample point corresponds to one color brightness information group (that is, one-to-one correspondence between m color brightness sample points and m color brightness information groups in a color brightness three-dimensional space), and the color brightness three-dimensional space Includes two color dimensions and one brightness dimension. Further, by performing clustering processing on m color brightness sample points located in the color brightness three-dimensional space, multiple color brightness sample point groups can be obtained. Alternatively, the m color brightness samples located in the three-dimensional color brightness space are first layered along the brightness dimension, and then the color brightness samples of each layer are grouped, and multiple color brightness samples can be obtained for each layer. Point group.
本申请发明人针对单色温和混合色温这两类场景,进行相关色彩亮度样点的分布特性分析发现,混合色温场景下,色彩亮度样点分群之间有较强交融度;单色温场景下,色彩亮度样点分群之间有较弱的交融度。其中,两个色彩亮度样点分群之间的交融度,可表征两个分群的色彩亮度样点之间的联系的紧密程度。其中,两个分群之间交融度越大,表示两个分群的色彩亮度样点之间的联系的紧密程度越高;两个分群之间交融度越小,表示两个分群的色彩亮度样点之间的联系的紧密程度越低。下面通过两个实验例子进行一些举例说明。For the two types of scenes of monochrome temperature and mixed color temperature, the inventors of the present application analyzed the distribution characteristics of relevant color brightness sample points and found that in the mixed color temperature scene, there is a strong degree of blending between the color brightness sample groups; in the monochrome temperature scene, , There is a weaker blending degree between the color brightness sample clusters. The blending degree between the two color luminance sample clusters can indicate the closeness of the connection between the two color luminance sample clusters. Among them, the greater the degree of blending between the two clusters, the higher the degree of closeness between the color brightness samples of the two clusters; the smaller the degree of blending between the two clusters, the color brightness samples of the two clusters The tighter the connection is. Here are some examples through two experimental examples.
参见图4,图4中的右图为拍摄的图像,拍摄环境内有高色温的日光由窗外照入与低色温的A光,即拍摄环境内存在混合色温。图4中的左图示出了图像各子块的色彩亮度样点在色彩亮度三维空间中的分布情况,色彩亮度三维空间的水平面上是两个色彩维度,且在垂直方向上是一个亮度维度。左图上方9个点为标准光源的标记点,左图下方的点为右图的各子块的色彩亮度样点。若将色彩亮度样点分为两个群(Group1,Group2),其中,Group1属于高色温,Group2属于低色温。分析发现,这两个群的分布有较强的相互交融特性。并且这种交融特性,主要是由高低色温的光源投射在同一物体(例如地板等)上,两个光源在色彩与亮度都会有融合效果所引起。Referring to FIG. 4, the right image in FIG. 4 is a captured image. Daylight with a high color temperature in the shooting environment is illuminated through the window and A light with a low color temperature, that is, there is a mixed color temperature in the shooting environment. The left figure in FIG. 4 shows the distribution of the color brightness samples of each sub-block of the image in the three-dimensional space of color brightness. The horizontal plane of the three-dimensional space of color brightness has two color dimensions and one brightness dimension in the vertical direction. . The 9 points above the left are the marked points of the standard light source, and the points below the left are the color brightness samples of the subblocks on the right. If the color brightness samples are divided into two groups (Group1, Group2), Group1 belongs to a high color temperature, and Group2 belongs to a low color temperature. The analysis found that the distributions of these two groups have strong mutual blending characteristics. And this blending characteristic is mainly caused by light sources with high and low color temperatures being projected on the same object (such as the floor, etc.), and the two light sources will have a fusion effect in color and brightness.
请参见图5,图5右图为拍摄的图像,拍摄环境中只有单一高色温日光光源,再无其他 人工光源,即拍摄环境内不存在混合色温。但拍摄环境中有一面淡黄色的木纹墙,此木纹墙的色彩亮度样点是分布在低色温区,图5中的左图示出了图像各子块的色彩亮度样点在色彩亮度三维空间中的分布情况,左图上方的9个点为标准光源的标记点,左图下方的点为右图的各子块的色彩亮度样点。若将色彩亮度样点分为两个群(Group1,Group2),Group1属于高色温,Group2属于低色温。分析发现,这两个群之间的交融度是微弱的,这主要是由于木纹墙本身不发光,淡黄色只局限墙面自身无法向外投射在其他物体上。Please refer to Figure 5. The right image of Figure 5 is the captured image. In the shooting environment, there is only a single high color temperature daylight light source, and no other artificial light source, that is, there is no mixed color temperature in the shooting environment. However, there is a pale yellow wood grain wall in the shooting environment. The color brightness samples of this wood texture wall are distributed in the low color temperature region. The left figure in Figure 5 shows the color brightness samples of each sub-block in the color brightness. For the distribution in three-dimensional space, the 9 points on the upper left are labeled points of the standard light source, and the points on the lower left are sample points of the color brightness of each sub-block on the right. If the color brightness samples are divided into two groups (Group1, Group2), Group1 belongs to a high color temperature, and Group2 belongs to a low color temperature. The analysis found that the degree of blending between the two groups is weak, mainly because the wood grain wall itself does not emit light, and the light yellow color is limited to the wall surface itself cannot project on other objects.
通过上面实验发现,不同色温光源会投射在同一物体上,光源有融合效果。此特性在色彩亮度样点分布特性上反应,具体表现出色彩亮度样点分群之间有较强交融度,本申请实施例的一些方案利用这个特性来估测图像拍摄环境中是否存在混合色温光源。Through the above experiments, it was found that light sources of different color temperatures will be projected on the same object, and the light sources have a fusion effect. This characteristic is reflected in the distribution characteristics of color brightness samples, and specifically shows that there is a strong degree of fusion between color brightness sample groups. Some solutions in the embodiments of this application use this characteristic to estimate whether there is a mixed color temperature light source in the image shooting environment. .
参见图6,图6为本申请实施例提供的一种光源估测方法的流程示意图。一种光源估测方法,方法可在图1A或图1B所示系统架构中具体实施,例如光源估测方法可由图像处理部件120来主要执行,具体例如由图像处理部件120中的光源估测装置121来主要执行,方法具体可包括:Referring to FIG. 6, FIG. 6 is a schematic flowchart of a light source estimation method according to an embodiment of the present application. A light source estimation method may be implemented in the system architecture shown in FIG. 1A or FIG. 1B. For example, the light source estimation method may be mainly performed by the image processing unit 120, and specifically, for example, by the light source estimation device in the image processing unit 120. Mainly implemented from 121, the methods can specifically include:
601、将图像切分为m个子块。所述m为大于1的整数。其中,所述图像可是摄像头拍摄得到的原始图像或其它图像。601. Divide an image into m sub-blocks. The m is an integer greater than 1. The image may be an original image or another image captured by a camera.
602、获取所述m个子块的m个色彩亮度信息组。其中,每个色彩亮度信息组与一个子块对应(即所述m个子块与m个色彩亮度信息组之间一一对应),所述色彩亮度信息组包括亮度信息和色彩信息。602. Acquire m color luminance information groups of the m sub-blocks. Each color luminance information group corresponds to one sub-block (that is, a one-to-one correspondence between the m sub-blocks and m color luminance information groups), and the color luminance information group includes luminance information and color information.
603、将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点。每个色彩亮度样点与一个色彩亮度信息组对应,即色彩亮度三维空间中的m个色彩亮度样点与m个色彩亮度信息组之间一一对应。如前提到,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。603: Map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness sample points located in the color brightness three-dimensional space. Each color brightness sample point corresponds to a color brightness information group, that is, there is a one-to-one correspondence between m color brightness sample points and m color brightness information groups in a color brightness three-dimensional space. As mentioned above, the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
具体例如,假设m=128,那么表示图像被切分为128个子块,进而可获取128个子块的色彩亮度信息组,共计128个色彩亮度信息组,将这128个色彩亮度信息组映射到色彩亮度三维空间,可得到共计128个色彩亮度样点。其中,每个色彩亮度样点与一个色彩亮度信息组对应,每个色彩亮度信息组与一个子块对应。For example, assuming m = 128, it means that the image is cut into 128 sub-blocks, and then the color brightness information groups of 128 sub-blocks can be obtained, and a total of 128 color brightness information groups are mapped to the 128 color brightness information groups. In the three-dimensional space of brightness, a total of 128 color brightness samples can be obtained. Each color brightness sample corresponds to a color brightness information group, and each color brightness information group corresponds to a sub-block.
604、在所述m个色彩亮度样点被沿所述亮度维度划分为k层,并且,所述k层中的每层被划分了P个色彩亮度样点分群的情况之下,计算所述k层中的每层对应的分群数P的第一交融度。在一些可能的实施方式中,例如对色彩亮度样点进行分群可以使用如下分群算法中的任意一种:k-均值(k-means)算法、分层聚类(hierarchical clustering)算法、基于密度的聚类(density based clustering,DBSCAN)算法、或者使用层次结构平衡迭代减少和聚类(balanced iterative reducing and clustering using hierarchies,BIRCH)算法等。当然,对色彩亮度样点进行分群也可使用其它分群算法,对此,本实施例不做具体限定。604. Calculate the case where the m color brightness sample points are divided into k layers along the brightness dimension, and each of the k layers is divided into P color brightness sample groupings. The first blending degree of the number of clusters P corresponding to each of the k layers. In some possible implementations, for example, to cluster color brightness samples, any one of the following clustering algorithms can be used: k-means algorithm, hierarchical clustering algorithm, and density-based clustering algorithms. Clustering (density based clustering, DBSCAN) algorithms, or the use of hierarchical structure iterative reduction and clustering (balanced reducing clustering) algorithms, etc. Of course, other clustering algorithms may be used for clustering the color and brightness samples, which is not specifically limited in this embodiment.
可以理解,在k等于1的情况下表示m个色彩亮度样点被划分到了同一层,那么分层这个动作也就并不实际执行。其中,所述k层中的每层对应一亮度区间。其中,所述P为大于1的整数。所述k为正整数。例如P可等于2、3、4、5、6、7、8、9、10、11、13、15、20或 35或其它值。例如,k可等于1、2、3、4、5、6、7、8、9、10、11、13、17或其它值。It can be understood that when k is equal to 1, it means that m color luminance samples are divided into the same layer, so the action of layering is not actually performed. Each of the k layers corresponds to a brightness interval. Wherein, P is an integer greater than 1. K is a positive integer. For example, P may be equal to 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 20, or 35 or other values. For example, k may be equal to 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, or other values.
当k大于1时,所述k层中的不同层包括的色彩亮度样点的数量可全相同,部分相同或互不相同。当k大于1时,所述k层中的不同层对应的亮度区间的高度可全相同、部分相同或互不相同。When k is greater than 1, the number of color brightness samples included in different layers of the k layers may be all the same, partly the same, or different from each other. When k is greater than 1, the heights of the brightness intervals corresponding to different layers in the k layers may be all the same, partially the same, or different from each other.
例如,在一些可能的实施方式中,色彩亮度样点沿亮度维度而划分为k层,每层由暗到亮分布,每层色彩亮度样点的个数分别为S1、S2…Sk。其中,不同层中色彩亮度样点的数量可全相同,部分相同或互不相同。例如较亮层的色彩亮度样点数量可较多或较少,又例如每层的色彩亮度样点数量相等。For example, in some possible implementations, the color brightness sample points are divided into k layers along the brightness dimension, and each layer is distributed from dark to light, and the number of color brightness sample points of each layer are S1, S2, ..., Sk, respectively. Among them, the number of color brightness samples in different layers may be all the same, some of them may be the same or different from each other. For example, the number of color brightness samples of brighter layers may be more or less, and for example, the number of color brightness samples of each layer is equal.
605、基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度。605. Determine a second blending degree of the grouping number P corresponding to the image based on the first blending degree of the grouping number P corresponding to each of the k layers.
可以理解,在k等于1的情况下表示m个色彩亮度样点被划分到了同一层,那么此时只得到唯一一层对应的分群数P的第一交融度,此时,则可直接将唯一这层对应的分群数P的第一交融度直接作为(确定为)所述图像对应的分群数P的第二交融度。It can be understood that when k is equal to 1, it means that m color brightness samples are divided into the same layer, then only the first blending degree of the number of clusters P corresponding to the only layer is obtained. At this time, the The first blending degree of the unique clustering number P corresponding to this layer is directly used as the second blending degree of the clustering number P corresponding to the image.
606、比较所述图像的对应的分群数P的第二交融度与交融度阈值。其中,此处的交融度阈值是与分群数P对应的交融度阈值,即,当分群数P的取值不同时,交融度阈值也可能对应不同。当然,交融度阈值也可能不与分群数P对应,即当分群数P的取值不同时,交融度阈值也可能不发生变化。其中,交融度阈值可为经验值,或是根据实验数据得到,本申请不做限定。606. Compare the second blending degree of the corresponding clustering number P of the image with the blending degree threshold. The blending degree threshold here is a blending degree threshold corresponding to the number of clusters P, that is, when the value of the number of clusters P is different, the blending threshold may also be different. Of course, the blending degree threshold may not correspond to the number of clusters P, that is, when the value of the number of clusters P is different, the blending threshold may not change. The blending threshold may be an empirical value or obtained based on experimental data, which is not limited in this application.
607、在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像的拍摄环境中存在P个色温不同的光源,即得到适合的光源数P。在一些可能实施方式中,在所述图像的对应的分群数P的第二交融度小于或所述交融度阈值的情况下,可估测所述图像所对应拍摄环境中并不存在P个色温不同的光源。可选地,本申请可进一步结合其它技术手段,估测出所述图像所对应拍摄环境中只存在单光源,还是存在多个不同色温光源。607. In the case where the second blending degree of the corresponding number of clusters P of the image is greater than the blending degree threshold, it is estimated that there are P light sources with different color temperatures in the shooting environment of the image, that is, a suitable number of light sources is obtained. P. In some possible implementation manners, when the second blending degree of the corresponding grouping number P of the image is less than or the blending degree threshold, it may be estimated that there are no P color temperatures in the shooting environment corresponding to the image Different light sources. Optionally, the present application may further combine other technical means to estimate whether there is only a single light source or multiple light sources with different color temperatures in the shooting environment corresponding to the image.
其中,两个色彩亮度样点分群之间的交融度,可表征两个分群的色彩亮度样点之间的联系的紧密程度。其中,两个分群之间交融度越大,表示两个分群的色彩亮度样点之间的联系的紧密程度越高;两个分群之间交融度越小,表示两个分群的色彩亮度样点之间的联系的紧密程度越低。The blending degree between the two color luminance sample clusters can indicate the closeness of the connection between the two color luminance sample clusters. Among them, the greater the degree of blending between the two clusters, the higher the degree of closeness between the color brightness samples of the two clusters; the smaller the degree of blending between the two clusters, the color brightness samples of the two clusters The tighter the connection is.
可以看出,本申请实施例给出了一种可行的光源估测方法,这种光源估测方法通过将图像切分的子块的色彩亮度信息组映射到色彩亮度三维空间,得到位于色彩亮度三维空间中的多个色彩亮度样点,并对多个色彩亮度样点进行分层分群处理,进而通过计算各层的色彩亮度样点分群的交融度来计算整个图像的交融度,并据此估测所述图像所对应拍摄环境中存在多个色温不同光源的情况。那么,这就为基于包括多个色温不同光源的情况进行图像校正奠定了基础。例如使得在包括多个色温不同光源的情况下进行针对性图像校正变得可能,进而有利于提升图像校正的合理性。It can be seen that the embodiment of the present application provides a feasible light source estimation method. This light source estimation method obtains the color brightness by mapping the color brightness information group of the image segmented sub-blocks to the color brightness three-dimensional space. Multiple color brightness sample points in three-dimensional space, and perform multiple layer clustering processing on multiple color brightness sample points, and then calculate the blending degree of the entire image by calculating the blending degree of the color brightness sample point clustering of each layer, and based on this It is estimated that there are multiple light sources with different color temperatures in the shooting environment corresponding to the image. Then, this lays the foundation for image correction based on the situation that includes multiple light sources with different color temperatures. For example, it makes it possible to perform targeted image correction when multiple light sources with different color temperatures are included, which in turn helps to improve the rationality of image correction.
在一些可能的实施方式中,由于P为大于1的整数,那么可分别针对P=2,…X执行所述计算、确定、比较和估测,X为大于2的整数。在分别估测到所述拍摄环境中存在P=2,…Y 个色温不同的光源(即分别确定适合的光源数为P=2,…Y)的情况下,确定所述拍摄环境中存在P=Y个色温不同的光源,所述Y为大于2且小于等于所述X的整数。也即是说,分别针对P的不同取值重复执行图6对应的方法中的与估测有关的部分步骤,确定每种取值是否可适合作为光源数,并将可适合作为光源数的最大P取值确定为最终的光源数。因此,P的每种取值其实是一个假设的光源数,该取值被应用于该光源估测方法以确定该假定的取值是否合适。当存在多个合适的取值时,例如可将其中最大值作为最终确定的光源数。可以理解为,这是因为更多数量的光源中包括了其中的部分数量的光源。例如假设P=2至10,并针对2至10分别执行该方法,当P=2至5均被确定为适合的光源数,则可以选择P=5作为最终光源数。这是因为5个光源中包括了之前估测得到的2、3和4个光源,所以选取其中最大值是合理的。相反,当P=6至10被应用于以上方法时,通过所述方法确定出并不存在P=6至10个光源,则之前假设的P=6至10的取值是不合适的,不存在这种数量的光源。In some possible implementations, since P is an integer greater than 1, the calculation, determination, comparison, and estimation may be performed for P = 2,... X, respectively, where X is an integer greater than 2. When it is estimated that there are P = 2, ... Y light sources with different color temperatures in the shooting environment (that is, it is determined that the appropriate number of light sources is P = 2, ... Y), it is determined that P exists in the shooting environment. = Y light sources with different color temperatures, where Y is an integer greater than 2 and less than or equal to X. That is to say, the partial steps related to the estimation in the method corresponding to FIG. 6 are repeatedly performed for different values of P to determine whether each value is suitable as the number of light sources and the maximum number of light sources The value of P is determined as the final number of light sources. Therefore, each value of P is actually a hypothetical light source number, and this value is applied to the light source estimation method to determine whether the hypothetical value is appropriate. When there are multiple suitable values, for example, the maximum value can be used as the final number of light sources. It can be understood that this is because a larger number of light sources include a part of the number of light sources. For example, suppose P = 2 to 10 and execute the method for 2 to 10 respectively. When P = 2 to 5 are determined as the appropriate number of light sources, P = 5 can be selected as the final number of light sources. This is because the 5 light sources include 2, 3, and 4 light sources previously estimated, so it is reasonable to choose the maximum value. In contrast, when P = 6 to 10 is applied to the above method, it is determined through the method that there are no P = 6 to 10 light sources, and the value of P = 6 to 10 previously assumed is not appropriate, not There are such a number of light sources.
举例来说,分别设定P=P1和P=P2;那么,计算所述k层中的每层对应的分群数P1的第一交融度;基于所述k层中的每层对应的分群数P1的第一交融度确定所述图像对应的分群数P1的第二交融度;比较图像的对应分群数P1的第二交融度与分群数P1的交融度阈值。并且计算所述k层中的每层对应的分群数P2的第一交融度;基于所述k层中的每层对应的分群数P2的第一交融度确定所述图像对应的分群数P2的第二交融度;比较所述图像的对应的分群数P2的第二交融度与分群数P2的交融度阈值。For example, set P = P1 and P = P2 respectively; then, calculate the first blending degree of the number of clusters P1 corresponding to each of the k layers; based on the number of clusters corresponding to each of the k layers The first blending degree of P1 determines the second blending degree of the number of clusters P1 corresponding to the image; comparing the second blending degree of the corresponding number of clusters P1 of the image with the blending degree threshold of the number of clusters P1. And calculate a first blending degree of the number of clusters P2 corresponding to each of the k layers; and determine a number of clusters P2 corresponding to the image based on the first blending degree of the number of clusters P2 corresponding to each of the k layers A second blending degree; comparing the second blending degree of the corresponding number of clusters P2 of the image with the blending degree threshold of the number of clusters P2.
在所述图像的对应的分群数P1的第二交融度大于分群数P1的交融度阈值,且所述图像的对应的分群数P2的第二交融度小于或等于分群数P2的交融度阈值的情况下,则可估测所述图像的拍摄环境中存在P1个色温不同的光源。The second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1, and the second degree of fusion of the corresponding number of clusters P2 of the image is less than or equal to the threshold of the degree of fusion of the number of clusters P2 In this case, it can be estimated that there are P1 light sources with different color temperatures in the shooting environment of the image.
此外,在所述图像的对应的分群数P1的第二交融度大于分群数P1的交融度阈值,且所述图像的对应的分群数P2的第二交融度大于分群数P2的交融度阈值的情况下,当所述P2大于所述P1(例如P2=P1+1),可估测所述图像的拍摄环境中存在P2个色温不同的光源。In addition, the second degree of fusion of the corresponding number of clusters P1 in the image is greater than the threshold of the degree of fusion of the number of clusters P1 and the second degree of fusion of the corresponding number of clusters P2 of the image is greater than the threshold of the degree of fusion of the number of clusters P2 In the case, when the P2 is larger than the P1 (for example, P2 = P1 + 1), it can be estimated that there are P2 light sources with different color temperatures in the shooting environment of the image.
或者在另一个可选实施例中,在所述图像的对应的分群数P1的第二交融度大于分群数P1的交融度阈值,并且所述图像的对应的分群数P2的第二交融度大于分群数P2的交融度阈值的情况下,当所述图像的对应分群数P2的第二交融度与分群数P2的交融度阈值之间的差异性(这差异性可以表现为(所述图像的对应分群数P2的第二交融度-分群数P2的交融度阈值)/交融度阈值),大于所述图像的对应分群数P1的第二交融度与分群数P1的交融度阈值之间的差异性,估测所述图像所对应拍摄环境中包括P2个色温不同的光源。即,超越相应交融度阈值更多的第二交融度所对应的分群数被确定为光源数。Or in another optional embodiment, the second blending degree of the corresponding number of clusters P1 in the image is greater than the threshold of the blending degree of the number of clusters P1, and the second blending degree of the corresponding number of clusters P2 of the image is greater than In the case of the blending degree threshold of the number of clusters P2, when the second blending degree of the corresponding clustering number P2 of the image is different from the blending degree threshold of the clustering number P2 (this difference can be expressed as (the image's The second degree of fusion corresponding to the number of clusters P2-the threshold of the degree of fusion of the number of clusters P2) / the threshold of the degree of fusion) is greater than the difference between the second degree of fusion of the corresponding number of clusters P1 and the threshold of the degree of fusion of the number of clusters P1 It is estimated that the shooting environment corresponding to the image includes P2 light sources with different color temperatures. That is, the number of clusters corresponding to the second blending degree that exceeds the corresponding blending degree threshold more is determined as the number of light sources.
在一些可能的实施方式中,基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度可包括:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理,以得到所述图像的对应的分群数P的第二交融度。其中,当对所述k层中的每层对应的分群数P的第一交融度加权求和处理以得到所述图像的对应的分群数P的第二交融度时,那么每层对应的分群数P的第一交融度的加权求和权重可基于各层的亮度区间的高度来确定,例如,亮度区间的高度相对越高的层,其对应的加权求和权重可越大,亮度区间高度相对越小的层,其对应的加权求和权重可越小。或者,每层对应的分 群数P的第一交融度的加权求和权重可基于各层的色彩亮度样点的数量确定,例如,色彩亮度样点数量相对越多的层,其对应的加权求和权重可以越大,色彩亮度样点数量相对越少的层,其对应的加权求和权重可越小。当然,也可以基于其它的参数来确定各层的加权求和权重。In some possible implementation manners, determining the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers may include: The first blending degree corresponding to the number of clusters P of each layer is summed or weighted to obtain a second blending degree corresponding to the number of clusters P of the image. Wherein, when the first blending degree P corresponding to the number of clusters P in each of the k layers is weighted and summed to obtain the second blending degree corresponding to the number of clusters P in the image, then the corresponding clusters in each layer The weighted summation weight of the first blending degree of the number P can be determined based on the height of the brightness interval of each layer. For example, the higher the weighted summation weight of a layer with a relatively higher brightness interval, the greater the height of the brightness interval. The relatively smaller the layer, the smaller the corresponding weighted summation weight can be. Alternatively, the weighted summation weight of the first blending degree corresponding to the number of clusters P of each layer may be determined based on the number of color brightness samples of each layer. For example, the layer with a relatively large number of color brightness samples has a corresponding weighted calculation. The larger the sum weight, the smaller the number of color brightness samples, and the smaller the corresponding weighted sum weight. Of course, the weighted summation weight of each layer can also be determined based on other parameters.
其中,计算所述k层中的每层对应的分群数P的第一交融度的方式有多种。例如,在一些可能的实施方式中,当所述P大于2;计算所述k层中的第i层对应的分群数P的第一交融度可包括:计算所述第i层的P个分群中每两个分群之间的第三交融度。将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理,以得到所述第i层对应的分群数P的第一交融度。所述第i层为所述k层中的任意一层。又例如,在一些可能的实施方式中,当所述P等于2;计算所述k层中的第i层对应的分群数P的第一交融度可包括:计算所述第i层的两个分群之间的第三交融度;其中,所述第i层对应的分群数P的第一交融度即等于所述两个分群之间的第三交融度。所述第i层为所述k层中的任意一层。There are multiple ways to calculate the first blending degree of the number of clusters P corresponding to each of the k layers. For example, in some possible implementation manners, when the P is greater than 2; calculating the first blending degree of the number of clusters P corresponding to the i-th layer in the k layers may include: calculating the P-th clusters of the i-th layer The third degree of integration between each two subgroups. The third blending degree between each two clusters in the P clusters is summed or weighted to obtain a first blending degree of the number of clusters P corresponding to the i-th layer. The i-th layer is any one of the k layers. For another example, in some possible implementation manners, when the P is equal to 2; calculating the first blending degree of the number of clusters P corresponding to the i-th layer in the k-layer may include: calculating two of the i-th layer The third degree of integration between the clusters; wherein the first degree of integration of the number of clusters P corresponding to the i-th layer is equal to the third degree of integration between the two clusters. The i-th layer is any one of the k layers.
其中,计算两个分群之间的交融度的方式可以有多种方式。例如,在一些可能实施方式中,计算分群gi和分群gj之间的第三交融度可包括:在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格,所述连续排列的量度单元格数量为T。统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q。确定所述分群gi和所述分群gj之间的第三交融度为Q/T。所述T和所述Q为整数。所述T大于0且所述Q大于或等于0。所述分群gi和所述分群gj为所述第i层的所述P个分群中任意两个分群。Among them, there can be multiple ways to calculate the blending degree between the two clusters. For example, in some possible implementations, calculating the third degree of blending between the cluster gi and the cluster gj may include inserting a continuous array of measurement cells between the center point of the cluster gi and the center point of the cluster gj, the continuous The number of arranged measurement cells is T. The statistics include the number of measurement cells Q of the color brightness samples in the clusters gi and gj. It is determined that the third blending degree between the cluster gi and the cluster gj is Q / T. The T and the Q are integers. The T is greater than 0 and the Q is greater than or equal to 0. The cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
进一步的,为了进一步简化运算,也可在同一个色彩平面内计算两两分群之间的第三交融度。例如,计算分群gi和分群gj之间的第三交融度包括:将分群gi和分群gj投影到同一个色彩平面(即将分群gi和分群gj中的色彩亮度样点的亮度取相同值),在被投影到同一个色彩平面的分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格。所述连续排列的量度单元格数量为T。统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q。确定所述分群gi和所述分群gj之间的第三交融度为Q/T。其中。所述T大于0且所述Q大于或等于0,所述T和所述Q为整数。所述分群gi和所述分群gj为所述第i层的所述P个分群中任意两个分群。Further, in order to further simplify the calculation, the third blending degree between two pairs of subgroups can also be calculated in the same color plane. For example, calculating the third degree of fusion between cluster gi and cluster gj includes: projecting cluster gi and cluster gj to the same color plane (that is, the brightness of the color brightness sample points in cluster gi and cluster gj take the same value). Continuously arranged measurement cells are inserted between the center point of the cluster gi and the center point of the cluster gj that are projected onto the same color plane. The number of the continuously arranged measurement cells is T. The statistics include the number of measurement cells Q of the color brightness samples in the clusters gi and gj. It is determined that the third blending degree between the cluster gi and the cluster gj is Q / T. among them. The T is greater than 0 and the Q is greater than or equal to 0, and T and Q are integers. The cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer.
例如分群gi中的色彩亮度样点到分群gi的中心点的距离,小于或等于这个色彩亮度样点到分群gj的中心点的距离。For example, the distance between the color brightness sample point in the cluster gi and the center point of the group gi is less than or equal to the distance between this color brightness sample point and the center point of the group gj.
在一些可能实施方式中,单个量度单元格的长例如可等于Dist_D65_D50、Dist_D75_D65或Dist_D55_D50或其他经验值。其中,Dist_D75_D65表示在色彩平面中,标准光源D75和D65的标定点之间的距离;Dist_D65_D50表示在色彩平面中,标准光源D65和D50的标定点之间的距离;Dist_D55_D50表示在色彩平面中,标准光源D55和D50的标定点之间的距离;其他情况以此类推。单个量度单元格的宽例如等于长×1/32、长×1/20、长×1/16、长×1/19或其他经验值,例如单个量度单元格的宽Dist_D65_D50/32、Dist_D75_D65/32,其他情况以此类推。In some possible implementations, the length of a single measurement cell may be equal to, for example, Dist_D65_D50, Dist_D75_D65, or Dist_D55_D50 or other experience values. Among them, Dist_D75_D65 represents the distance between the calibration points of the standard light sources D75 and D65 in the color plane; Dist_D65_D50 represents the distance between the calibration points of the standard light source D65 and D50 in the color plane; Dist_D55_D50 represents the color plane, the standard The distance between the calibration points of the light sources D55 and D50; in other cases and so on. The width of a single measurement cell is equal to length × 1/32, length × 1/20, length × 1/16, length × 1/19, or other experience values, such as the width of a single measurement cell Dist_D65_D50 / 32, Dist_D75_D65 / 32 , And so on in other cases.
可以理解,可在色彩亮度三维空间内计算计算两两分群之间的第三交融度,也可以在同一个色彩平面内计算两两分群之间的第三交融度(这种情况下可先将两个分群投影到同 一个色彩平面,得到位于同一色彩平面的两个分群的所有样点)。当在色彩亮度三维空间内计算计算两两分群之间的第三交融度,那么单个量度单元格是具有长宽高的三维立体的量度单元格,而在这种情况下,单个量度单元格的高则可大于或者等于两个分群所在的分层的层高,其长宽则如可参考上述举例。当在色彩二维平面内计算计算两两分群之间的第三交融度,那么单个量度单元格是具有长宽而不具有高的平面的量度单元格,在这种情况下单个量度单元格的长宽则如可参考上述举例。It can be understood that the third blending degree between two pairs of subgroups can be calculated and calculated in the three-dimensional space of color brightness, and the third blending degree between two pairs of subgroups can also be calculated in the same color plane. The two clusters are projected onto the same color plane to obtain all the samples of the two clusters located on the same color plane). When the third blending degree between two pairs of subgroups is calculated in the three-dimensional space of color and brightness, then a single measurement cell is a three-dimensional measurement cell having a length, a width, and a height, and in this case, a single measurement cell The height may be greater than or equal to the layer height of the layer where the two clusters are located. For the length and width, refer to the above examples. When the third blending degree between two pairs of subgroups is calculated in the two-dimensional color plane, then a single measurement cell is a measurement cell with a length and a width but not a high plane. In this case, the single measurement cell For the length and width, please refer to the above examples.
例如参见图9,图9所示举例中,被投影到同一个色彩平面的两个分群的中心点分别为C1和C2,图中的点表示两个分群的色彩亮度样点,图中的矩形框表示量度单元格,量度单元格上方的数字表示落入该量度单元格的色彩亮度样点数量,例如当量度单元格上方的数字为1,表示两个分群中落入该量度单元格的色彩亮度样点数量为1,当量度单元格上方的数字为0,表示两个分群中落入该量度单元格的色彩亮度样点数量为0,当量度单元格上方的数字为3,表示两个分群中落入该量度单元格的色彩亮度样点数量为3,其它情况可以此类推。可以理解,插入到C1和C2的量度单元格中部分或全部量度单元格可能被落入色彩亮度样点,即插入到C1和C2的量度单元格中部分或全部量度单元格包括色彩亮度样点,如果统计出的包括色彩亮度样点的量度单元格的数量为Q,而插入到C1和C2的量度单元格的总数为T,那么可计算出两个分群之间的第三交融度为Q/T(也可表示为(Q/T)×100%)。例如假设统计出的包括色彩亮度样点的量度单元格的数量为30,而插入到C1和C2的量度单元格的总数为40,那么可计算出两个分群之间的第三交融度为30/40=0.75(75%),又例如假设统计出的包括色彩亮度样点的量度单元格的数量为45,而插入到C1和C2的量度单元格的总数也为45,那么可计算出两个分群之间的第三交融度为45/45=1(100%),其它情况可以此类推。For example, see FIG. 9. In the example shown in FIG. 9, the center points of the two clusters that are projected onto the same color plane are C1 and C2 respectively. The points in the figure represent the color brightness samples of the two clusters. The box indicates the measurement cell. The number above the measurement cell indicates the number of color brightness samples that fall into the measurement cell. For example, when the number above the measurement cell is 1, it indicates the color that falls into the measurement cell in two subgroups. The number of brightness samples is 1, when the number above the measurement cell is 0, it means that the number of color brightness samples that fall into the measurement cell in the two clusters is 0, and when the number above the measurement cell is 3, it means two The number of color brightness samples that fall into the measurement cell in the cluster is 3, and so on in other cases. It can be understood that some or all of the measurement cells inserted into the measurement cells of C1 and C2 may fall into the color brightness samples, that is, some or all of the measurement cells inserted into the measurement cells of C1 and C2 include the color brightness samples. If the number of measured measurement cells including color brightness samples is Q and the total number of measurement cells inserted into C1 and C2 is T, then the third degree of integration between the two clusters can be calculated as Q / T (also expressed as (Q / T) × 100%). For example, assuming that the number of measurement cells including color brightness samples is 30, and the total number of measurement cells inserted into C1 and C2 is 40, then the third degree of integration between the two clusters can be calculated as 30 / 40 = 0.75 (75%), for example, assuming that the number of measurement cells including color brightness samples is 45, and the total number of measurement cells inserted into C1 and C2 is also 45, then two can be calculated The third degree of integration between the subgroups is 45/45 = 1 (100%), and so on in other cases.
在一些可能的实施方式中,所述连续排列的量度单元格的长度方向,可以与所述分群gi的中心点和所述分群gj的中心点的连线垂直(例如图9举例所示)。当然,所述连续排列的量度单元格的长度方向,也可与所述分群gi的中心点和所述分群gj的中心点的连线不垂直。例如长度方向与中心点连线之间的夹角范围例如可为60°至90°。In some possible implementation manners, the length direction of the continuously arranged measurement cells may be perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj (for example, as shown in FIG. 9). Of course, the length direction of the continuously arranged measurement cells may not be perpendicular to the line connecting the center point of the cluster gi and the center point of the cluster gj. For example, the included angle range between the longitudinal direction and the line connecting the center point may be, for example, 60 ° to 90 °.
在一些可能的实施方式中,所述色彩亮度三维空间包括的两个色彩维度为第一色彩维度和第二色彩维度,其中,所述分群gi的中心点的第一色彩维度坐标等于分群gi中所有色彩亮度样点第一色彩维度坐标的平均值,所述分群gi的中心点的第二色彩维度坐标等于分群gi中所有色彩亮度样点第二色彩维度坐标的平均值。In some possible implementation manners, the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of the cluster gi is equal to that in the cluster gi The average value of the first color dimension coordinates of all the color brightness sample points, and the second color dimension coordinate of the center point of the cluster gi is equal to the average value of the second color dimension coordinates of all the color brightness sample points in the cluster gi.
下面结合附图对计算分群之间交融度的方法进行更具体的举例。In the following, a more specific example of a method for calculating the degree of blending between clusters will be given with reference to the drawings.
首先将色彩亮度三维空间中的色彩亮度样点沿亮度维度划分为k层。每层色彩亮度样点的个数分别为S1、S2…Sk。请参见图7,图7所示举例中色彩亮度样点被沿亮度维度划分为了5层,即k=5,即共分为5个层。图7中的水平面(色彩平面)为两个色彩维度,垂直方向为一个亮度维度。垂直于亮度维度的4个平面将色彩亮度三维空间划分为5层,使得多个色彩亮度样点分布于这5层中。层的划分规则之前实施例已有介绍,此处不做赘述。First, the color brightness sample points in the color brightness three-dimensional space are divided into k layers along the brightness dimension. The number of color brightness samples for each layer is S1, S2 ... Sk. Please refer to FIG. 7. In the example shown in FIG. 7, the color and brightness samples are divided into 5 layers along the brightness dimension, that is, k = 5, that is, divided into 5 layers. The horizontal plane (color plane) in FIG. 7 is two color dimensions, and the vertical direction is one brightness dimension. The four planes perpendicular to the brightness dimension divide the color brightness three-dimensional space into five layers, so that multiple color brightness samples are distributed in these five layers. The layer division rules have been described in the previous embodiments, and will not be repeated here.
在完成分层之后,对每层中的色彩亮度样点进行分群处理。参见图8,图8所示举例中以每层的色彩亮度样点分成2个分群为例(P=2),图8的平面即是两个色彩维度形成的色彩 平面。图8具体示出了某一层中所包括的多个色彩亮度样点被分成2个分群的结果,其每个群中心点分别为C1与C2。分群算法可参照之前实施例的介绍。After the layering is completed, the color brightness samples in each layer are grouped. Referring to FIG. 8, in the example shown in FIG. 8, the color brightness samples of each layer are divided into two clusters (P = 2). The plane in FIG. 8 is a color plane formed by two color dimensions. FIG. 8 specifically shows a result of dividing a plurality of color luminance samples included in a layer into two clusters, and the center points of each cluster are respectively C1 and C2. The clustering algorithm can refer to the introduction of the previous embodiment.
在一些可能的实施方式中,例如若某两个分群的中心点(C1与C2)之间的距离小于最小距离阈值(可表示为Cent_Dist_min),则这两个分群可不计入图像交融度的计算。此处以两个分群中心点之间的距离大于Cent_Dist_min并被计入计算为例。例如量测得标准光源D65与D50在色彩平面(R/G与B/G平面)上的标定点之间的距离为Dist_D65_D50,例如可以设定上述最小距离阈值Cent_Dist_min=Dist_D65_D50×70%,并以此为标准来选择该层是否计入图像交融度的计算。当然,有些情况下,即使某两个分群的中心点(C1与C2)之间的距离小于最小距离阈值,也可能将这两个分群计入图像交融度的计算,这种情况下可认为最小距离阈值Cent_Dist_min=0。In some possible implementations, for example, if the distance between the center points (C1 and C2) of two clusters is less than the minimum distance threshold (can be expressed as Cent_Dist_min), the two clusters may not be included in the calculation of the image blending degree. . Here, the distance between the center points of two clusters is greater than Cent_Dist_min and is included in the calculation as an example. For example, the distance between the calibration points of the standard light sources D65 and D50 on the color planes (R / G and B / G planes) is Dist_D65_D50. For example, the above minimum distance threshold Cent_Dist_min = Dist_D65_D50 × 70% can be set, and This is used as a criterion to select whether this layer is included in the calculation of image blending. Of course, in some cases, even if the distance between the center points (C1 and C2) of two clusters is less than the minimum distance threshold, the two clusters may be included in the calculation of the image fusion degree. In this case, it can be considered as the smallest. The distance threshold Cent_Dist_min = 0.
在完成分群之后,在C1与C2之间插入连续排列的量度单元格。参见图9,图9中举例示出在C1与C2之间插入了连续排列的多个量度单元格,其中,单个量度单元格的长可为Dist_D65_D50。单个量度单元格的宽可为Dist_D65_D50/32。实际使用的单个量度单元格的长和宽也可以是其他适合的值,本申请不做限定。假设插入的连续排列的量度单元格数量为T(在图9中所示举例中,T表示C1与C2之间插入的量度单元格的总数量),则可统计包括了两个分群中的色彩亮度样点的量度单元格数量Q(在图9中所示举例中,Q表示上方数字大于0的量度单元格的总数,而每个量度单元格上方的数字则表示这个量度单元格包括的色彩亮度样点的个数);进而可确定两个分群之间的交融度为Q/T(或Q/T×100%)。Q/T越大表示两个分群之间的交融度越大。由于图9中是以P=2为例的,那么每层的交融度就等于这一层的两个分群之间的交融度。After grouping is complete, successively arranged measurement cells are inserted between C1 and C2. Referring to FIG. 9, an example is shown in which a plurality of measurement cells arranged consecutively are inserted between C1 and C2, and the length of a single measurement cell may be Dist_D65_D50. The width of a single measurement cell can be Dist_D65_D50 / 32. The length and width of a single measurement cell actually used may also be other suitable values, which are not limited in this application. Assuming that the number of consecutively arranged measurement cells is T (in the example shown in FIG. 9, T represents the total number of measurement cells inserted between C1 and C2), the statistics include the colors in the two clusters Number of measurement cells for brightness samples Q (In the example shown in Figure 9, Q represents the total number of measurement cells whose number above is greater than 0, and the number above each measurement cell indicates the color included in this measurement cell Number of brightness samples); furthermore, it can be determined that the blending degree between the two clusters is Q / T (or Q / T × 100%). A larger Q / T indicates a greater degree of blending between the two clusters. Since P = 2 is taken as an example in FIG. 9, the fusion degree of each layer is equal to the fusion degree between two subgroups of this layer.
图9中以分群数P=2为例,当然,若P大于2,那么可先按上述举例方式计算出各层两两分群之间的交融度,将某层每两两之间的交融度进行求和或加权求和处理,进而得到这层的交融度。例如将某层分为(g1,g2,g3,g4)共4个群。其中,假设L(g1,g2)表示g1与g2之间的交融度,以此类推。则L(g1,g2)、L(g1,g3)、L(g1,g4)、L(g2,g3)、L(g2,g4)和L(g3,g4)等六个交融度求和(或加权求和)以求得此层的交融度,其它分群的情况以此类推。计算得到各层的交融度之后,将各层的交融度进行求和(或加权求和)以得到整个图像的交融度。具体的,将各层的交融度乘以相应加权值之后,再求和得到图像的交融度Total_Con P(P代表每一层分了多少群),若图像的交融度超过交融度阈值Th P(交融度阈值Th P与分群数P对应),即可估测出图像拍摄环境中存在P个不同色温光源。 In FIG. 9, the number of clusters P = 2 is taken as an example. Of course, if P is greater than 2, then the degree of blending between the two subgroups of each layer can be calculated according to the above example. Perform the summation or weighted summation process to obtain the blending degree of this layer. For example, a certain layer is divided into (g1, g2, g3, g4) four groups. Among them, it is assumed that L (g1, g2) represents the blending degree between g1 and g2, and so on. Then L (g1, g2), L (g1, g3), L (g1, g4), L (g2, g3), L (g2, g4), and L (g3, g4), etc. (Or weighted summation) to obtain the blending degree of this layer, and so on for other clusters. After calculating the blending degree of each layer, the blending degree of each layer is summed (or weighted summation) to obtain the blending degree of the entire image. Specifically, after multiplying the blending degree of each layer by the corresponding weighted value, the summation of the image's blending degree Total_Con P (P represents how many groups each layer is divided into), if the blending degree of the image exceeds the blending threshold Th P ( The blending threshold Th P corresponds to the number of clusters P), and it can be estimated that there are P light sources of different color temperatures in the image shooting environment.
在一种场景中,假设图像拍摄环境中可能最多有4种光源,设定P=2,3,4,设定交融度阈值为Th 2、Th 3与Th 4,若图像的交融度Total_Con 2、Total_Con 3与Total_Con 4都小于对应的交融度阈值,则判定图像拍摄环境只存在单色温的光源,即不存在混合色温光源。如果Total_Con 2、Total_Con 3与Total_Con 4都大于对应的交融度阈值,那么则可以估测出的图像拍摄环境存在4种不同色温光源。又例如,如果Total_Con 2和Total_Con 3大于对应的交融度阈值,Total_Con 4小于对应的交融度阈值Th 4,则可估测出的图像拍摄环境存在3种不同色温光源。又例如,如果Total_Con 2大于对应的交融度阈值Th 2,Total_Con 3与Total_Con 4小于对应的交融度阈值,则可估测出的图像拍摄环境存在2种不同色温光源。 In a scenario, it is assumed that there may be at most 4 light sources in the image shooting environment. Set P = 2, 3, 4 and set the blending threshold to Th 2 , Th 3 and Th 4. If the blending degree of the image is Total_Con 2 , Total_Con 3 and Total_Con 4 are all smaller than the corresponding blending thresholds, it is determined that there is only a monochromatic temperature light source in the image shooting environment, that is, there is no mixed color temperature light source. If Total_Con 2 , Total_Con 3 and Total_Con 4 are all larger than the corresponding blending threshold, then it can be estimated that there are four different color temperature light sources in the image shooting environment. For another example, if Total_Con 2 and Total_Con 3 are larger than the corresponding blending threshold and Total_Con 4 is smaller than the corresponding blending threshold Th 4 , it can be estimated that there are three different color temperature light sources in the image shooting environment. For another example, if Total_Con 2 is larger than the corresponding blending threshold Th 2 , Total_Con 3 and Total_Con 4 are smaller than the corresponding blending threshold, it can be estimated that there are two different color temperature light sources in the image shooting environment.
在另一场景中,当多种分组情况下得到的图像的交融度均大于对应交融度阈值,也可能采用如下举例的方式,来估测出图像拍摄环境存在几种不同色温光源。例如假设图像拍摄环境中可能最多有4种光源,设定P=2,3,4,设定交融度阈值为Th 2、Th 3与Th 4,若图像的交融度Total_Con 2、Total_Con 3与Total_Con 4都小于对应的交融度阈值,则判定图像拍摄环境只存在单色温的光源,即不存在混合色温光源。又例如,如果Total_Con 2大于对应的交融度阈值Th 2,Total_Con 3与Total_Con 4小于对应的交融度阈值,则可估测出的图像拍摄环境存在2种不同色温光源。如果Total_Con 4小于对应的交融度阈值Th 4,Total_Con 2与Total_Con 3大于对应的交融度阈值,则超越相应交融度阈值最多的图像交融度(即图像交融度与交融度阈值之间的差异性最大),其分群数被确定为不同色温光源的数量。具体例如(Total_Con 2-Th 2)/Th 2=0.36,(Total_Con 3-Th 3)/Th 3=0.25,从超越程度(差异性大小)来看,0.36>0.25,因此,可估测出的图像拍摄环境存在2种不同色温光源,其它情况以此类推。 In another scenario, when the blending degree of the images obtained under multiple grouping conditions is greater than the corresponding blending degree threshold, the following example may also be used to estimate that there are several different color temperature light sources in the image shooting environment. For example, suppose that there may be up to 4 light sources in the image shooting environment. Set P = 2, 3, 4 and set the blending thresholds as Th 2 , Th 3 and Th 4. If the blending levels of the images are Total_Con 2 , Total_Con 3 and Total_Con 4 are all smaller than the corresponding blending threshold, it is determined that only a light source with a single color temperature exists in the image shooting environment, that is, a light source with a mixed color temperature does not exist. For another example, if Total_Con 2 is larger than the corresponding blending threshold Th 2 , Total_Con 3 and Total_Con 4 are smaller than the corresponding blending threshold, it can be estimated that there are two different color temperature light sources in the image shooting environment. If Total_Con 4 is less than the corresponding blending degree threshold Th 4 , Total_Con 2 and Total_Con 3 are greater than the corresponding blending degree threshold, then the image blending degree that exceeds the corresponding blending degree threshold the most (that is, the difference between the image blending degree and the blending degree threshold is the largest ), The number of clusters is determined as the number of light sources with different color temperatures. For example, (Total_Con 2 -Th 2 ) / Th 2 = 0.36, (Total_Con 3 -Th 3 ) / Th 3 = 0.25. From the perspective of the degree of transcendence (the difference), 0.36> 0.25, so it can be estimated There are two different color temperature light sources in the image shooting environment, and so on in other cases.
在估测出图像拍摄环境中存在多个不同色温光源的情况下,可依据P个色温不同的光源对图像进行相关校正。In the case where it is estimated that there are multiple light sources with different color temperatures in the image shooting environment, the image may be correlated and corrected according to P light sources with different color temperatures.
参见图10,图10为本申请实施例提供的一种图像处理方法的流程示意图。一种图像处理方法,方法可在图1A或图1B所示系统架构中具体实施,例如图像处理方法可由图像处理部件120来主要执行,具体例如,图像处理方法中与光源估测相关的步骤可由图像处理部件120中的光源估测装置121来主要执行,而图像处理方法中与校正相关的步骤可由图像处理部件120中的图像信号处理器122来主要执行,方法具体可包括:Referring to FIG. 10, FIG. 10 is a schematic flowchart of an image processing method according to an embodiment of the present application. An image processing method may be implemented in the system architecture shown in FIG. 1A or FIG. 1B. For example, the image processing method may be mainly performed by the image processing unit 120. Specifically, for example, steps related to light source estimation in the image processing method may be performed by The light source estimation device 121 in the image processing component 120 is mainly executed, and the steps related to the correction in the image processing method may be mainly performed by the image signal processor 122 in the image processing component 120. The method may specifically include:
1001、执行光源估测方法。其中,光源估测方法可以为上述实施例提供的任意一种光源估测方法。1001. Perform a light source estimation method. The light source estimation method may be any one of the light source estimation methods provided in the foregoing embodiments.
1002、当估测出图像所对应拍摄环境中存在P个色温不同的光源,依据P个色温不同的光源对所述图像进行校正。当估测出图像所对应拍摄环境中存在单色温光源,依据单色温光源对所述图像进行校正。其中,所述校正可包括如下校正中的至少一种:自动白平衡校正、色彩校正、饱和度校正、或对比度校正。1002. When it is estimated that there are P light sources with different color temperatures in the shooting environment corresponding to the image, the image is corrected according to the P light sources with different color temperatures. When it is estimated that a monochrome temperature light source exists in the shooting environment corresponding to the image, the image is corrected according to the monochrome temperature light source. The correction may include at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
例如,校正可通过图像信号处理器(image signal processor,ISP)来执行。光源估测方法可通过光源估测装置来执行。具体图像处理装置的架构图可如图11A所示。例如当一张原始图像输入到ISP后,先由AWB校正电路校正光源色偏,经AWB校正后的图像,白色物件会尽量呈现白色,但其他色彩可能并不准确。色彩校正(color correction,CC)电路通过色彩校正将各色彩校正为正确颜色。经过色彩校正电路CC后的图像,饱和度校正电路可进一步利用色彩增强(color enhancement,CE)机制指定图像中特定色彩,将其饱和度增强或减弱以完成饱和度校正,进而提升图像色彩风格。对比度校正电路(例如Gamma)则用于校正图像亮度的对比度。图11A中的ISP中的各电路的顺序是可调整和变化的,例如还可调整为图11A举例所示的顺序得到图11B中的结构,当然还可以根据需要调整为其它的顺序,其它顺序本申请不做赘述。光源估测装置在估测出光源的数量之后将带有所述数量的信息传输至ISP,以便ISP利用该信息执行所述校正,不同类校正的执行顺序可调整和变化的。具体校正方法可参照其他现有文献,本申请不做赘述。For example, the correction may be performed by an image signal processor (ISP). The light source estimation method can be performed by a light source estimation device. A structural diagram of a specific image processing apparatus may be shown in FIG. 11A. For example, after an original image is input to the ISP, the color shift of the light source is corrected by the AWB correction circuit. For the image after AWB correction, white objects will appear as white as possible, but other colors may not be accurate. A color correction (CC) circuit corrects each color to the correct color through color correction. For the image after the color correction circuit CC, the saturation correction circuit can further use the color enhancement (CE) mechanism to specify a specific color in the image, and increase or decrease its saturation to complete the saturation correction, thereby improving the color style of the image. A contrast correction circuit (such as Gamma) is used to correct the contrast of the image brightness. The order of the circuits in the ISP in FIG. 11A can be adjusted and changed. For example, it can also be adjusted to the order shown in the example in FIG. 11A to obtain the structure in FIG. 11B. Of course, it can also be adjusted to other orders according to needs. This application does not go into details. After estimating the number of light sources, the light source estimation device transmits information with the number to the ISP, so that the ISP performs the correction using the information, and the execution order of different types of corrections can be adjusted and changed. For specific correction methods, refer to other existing literatures, which are not described in this application.
当光源估测装置侦测到图像拍摄环境中存在多色温光源,此时所拍摄的图像可能出现淡蓝(高色温光源引起)与淡黄(低色温光源引起)的颜色,此图像的颜色经过CC与CE的色彩强化后,光源的颜色在图像上会更加强烈。因为大脑会认定光源颜色为白色。人对光源的颜色并不敏锐,多色温光源环境下拍摄的图像,其过于强烈的光源颜色会被使用者认定是颜色出错误,尤其是高色温的淡蓝色。为减少混合色温场景下的色彩偏差感,因此调整AWB而使光源的修正偏向高色温,以降低淡蓝色的偏色,降低CC与CE的色彩强度,以减弱光源的颜色,降低Gamma的对比度,使高低色温光源的亮度差异缩小,让多色温光源环境下拍出的照片,有利于更加接近人眼所见的场景。When the light source estimation device detects that there is a multi-color temperature light source in the image shooting environment, the captured image may appear light blue (caused by a high color temperature light source) and light yellow (caused by a low color temperature light source). After CC and CE color enhancement, the color of the light source will be more intense on the image. Because the brain recognizes that the light source is white. People are not sensitive to the color of the light source. For images taken under a multi-color temperature light source environment, the excessively strong color of the light source will be considered by the user to be the wrong color, especially a light blue with a high color temperature. In order to reduce the sense of color deviation in mixed color temperature scenes, the AWB is adjusted so that the correction of the light source is biased to a high color temperature to reduce the color cast of light blue, reduce the color intensity of CC and CE, reduce the color of the light source, and reduce the contrast of Gamma , To reduce the brightness difference between high and low color temperature light sources, so that photos taken under a multi-color temperature light source environment, is conducive to closer to the scene seen by the human eye.
参见图12,本申请实施例还提供一种光源估测装置1200,其中,光源估测装置1200可包括:Referring to FIG. 12, an embodiment of the present application further provides a light source estimation device 1200. The light source estimation device 1200 may include:
切分单元1210、获取单元1220、映射单元1230、计算单元1240、确定单元1250、比较单元1260和估测单元1270。其中,切分单元1210,用于将图像切分为m个子块,所述m为大于1的整数。获取单元1220,用于获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息。The segmentation unit 1210, the acquisition unit 1220, the mapping unit 1230, the calculation unit 1240, the determination unit 1250, the comparison unit 1260, and the estimation unit 1270. The segmentation unit 1210 is configured to segment an image into m sub-blocks, where m is an integer greater than 1. The obtaining unit 1220 is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information.
映射单元1230,用于将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,其中,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。A mapping unit 1230 is configured to map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where each color brightness sample is associated with one The color brightness information group corresponds, and the color brightness three-dimensional space includes two color dimensions and one brightness dimension.
计算单元1240,用于在所述m个色彩亮度样点被沿所述亮度维度划分为k层,且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度。其中,所述k层中的每层对应一亮度区间(连续亮度区间)。其中,所述P为大于1的整数,所述k为正整数。确定单元1250,用于基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度。比较单元1260,用于比较所述图像的对应的分群数P的第二交融度与交融度阈值。其中,估测单元1270,用于在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中至少存在P个色温不同的光源。此外,估测单元1270还可用于,在所述图像的对应的分群数P的第二交融度小于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中存在的不同色温的光源的数量不为P个。A calculation unit 1240 is configured to calculate when the m color luminance samples are divided into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups. The first blending degree of the number of clusters P corresponding to each of the k layers. Each of the k layers corresponds to a brightness interval (continuous brightness interval). Wherein, P is an integer greater than 1, and k is a positive integer. A determining unit 1250 is configured to determine a second blending degree of the grouping number P corresponding to the image based on a first blending degree of the grouping number P corresponding to each of the k layers. The comparing unit 1260 is configured to compare the second blending degree of the corresponding grouping number P of the image with the blending degree threshold. The estimation unit 1270 is configured to estimate that at least P different color temperatures exist in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is greater than the blending degree threshold. Light source. In addition, the estimation unit 1270 may be further configured to, when the second blending degree of the corresponding clustering number P of the image is less than the blending degree threshold, estimate the different color temperatures in the shooting environment corresponding to the image. The number of light sources is not P.
在一些可能实施方式中,所述k大于1,在基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度的方面,确定单元1250具体用于:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理以得到所述图像的对应的分群数P的第二交融度。In some possible implementation manners, where k is greater than 1, in determining an aspect of the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers, The determining unit 1250 is specifically configured to perform summing or weighted summing processing on a first blending degree P corresponding to the number of clusters P of each of the k layers to obtain a second blending degree corresponding to the number of clusters P of the image .
在一些可能的实施方式中,所述P大于2;在计算所述k层中的第i层对应的分群数P的第一交融度的方面,计算单元1240具体用于:计算所述第i层的P个分群中每两个分群之间的第三交融度;将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理以得到所述第i层对应的分群数P的第一交融度,所述第i层为所述k层中的任意一层。In some possible implementation manners, the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation unit 1240 is specifically configured to calculate the i-th A third blending degree between every two clusters in the P subgroups of the layer; summing or weighting the third blending degree between each two clusters in the P clusters to obtain the i-th The first blending degree of the grouping number P corresponding to the layer, and the i-th layer is any one of the k layers.
在一些可能的实施方式之中,在计算分群gi和分群gj之间的第三交融度的方面,所述计算单元1240具体用于:在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单 元格,所述连续排列的量度单元格数量为T。其中,所述分群gi和所述分群gj为所述第i层的所述P个分群中任意两个分群。并且,所述计算单元1240可统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q,以及确定所述分群gi和所述分群gj之间的第三交融度为Q/T,其中,所述T和所述Q为整数,所述T大于0且所述Q大于或等于0。在一些可能的实施方式中,所述连续排列的量度单元格的长度方向,与所述分群gi的中心点和所述分群gj的中心点的连线垂直。在一些可能的实施方式中,所述色彩亮度三维空间包括的两个色彩维度为第一色彩维度和第二色彩维度,任一分群的中心点的第一色彩维度坐标等于该任一分群中所有色彩亮度样点的第一色彩维度坐标的平均值,所述该任一分群的中心点的第二色彩维度坐标等于该任一分群中所有色彩亮度样点的第二色彩维度坐标的平均值。In some possible implementation manners, in terms of calculating a third blending degree between the cluster gi and the cluster gj, the calculation unit 1240 is specifically configured to: insert between the center point of the cluster gi and the center point of the cluster gj The number of consecutively arranged measurement cells is T. The cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer. In addition, the calculation unit 1240 may count the number of measurement cells Q including the color brightness sample points in the cluster gi and the cluster gj, and determine that the third blending degree between the cluster gi and the cluster gj is Q / T, wherein the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0. In some possible implementation manners, a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj. In some possible implementation manners, the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, and a first color dimension coordinate of a center point of any cluster is equal to all The average value of the first color dimension coordinates of the color brightness sample points, and the second color dimension coordinate of the center point of the any group is equal to the average value of the second color dimension coordinates of all the color brightness sample points in the any group.
在一些可能的实施方式中,所述计算单元、所述确定单元、所述比较单元和所述估测单元可以分别针对P=2,…X执行所述计算、所述确定、所述比较和所述估测,X为大于2的整数。所述估测单元进一步用于,在分别估测到所述拍摄环境中存在P=2,…Y个色温不同的光源的情况下,确定所述拍摄环境中存在P=Y个色温不同的光源,所述Y为大于2且小于等于所述X的整数。In some possible implementation manners, the calculation unit, the determination unit, the comparison unit, and the estimation unit may perform the calculation, the determination, the comparison, and In the estimation, X is an integer greater than two. The estimation unit is further configured to determine, when it is estimated that P = 2, ... Y light sources with different color temperatures exist in the shooting environment, determine that P = Y light sources with different color temperatures exist in the shooting environment. , Wherein Y is an integer greater than 2 and less than or equal to X.
其中,图12中的全部单元具体可由软件代码来实现(具体可由处理器执行的软件代码来实现);或图12中的部分单元具体可由软件代码来实现,而另一部分单元可由硬件电路来实现;或图12中的全部单元具体可由硬件电路来实现。图13所示举例中以图12中的全部单元均为硬件电路实现为例。Among them, all units in FIG. 12 may be specifically implemented by software codes (specifically, may be implemented by software codes executed by a processor); or some units in FIG. 12 may be specifically implemented by software codes, and another part of the units may be implemented by hardware circuits. ; Or all units in FIG. 12 may be specifically implemented by hardware circuits. In the example shown in FIG. 13, all units in FIG. 12 are implemented by hardware circuits as an example.
参见图13,本申请实施例还提供了一种光源估测装置1300,其中,光源估测装置1300可以由硬件电路所实现,可以包括:切分电路1310、获取电路1320、映射电路1330、计算电路1340、确定电路1350、比较电路1360和估测电路1370。其中,任一电路可包括多个晶体管、逻辑门或基本电路逻辑单元。Referring to FIG. 13, an embodiment of the present application further provides a light source estimation device 1300. The light source estimation device 1300 may be implemented by a hardware circuit, and may include a segmentation circuit 1310, an acquisition circuit 1320, a mapping circuit 1330, and a calculation. A circuit 1340, a determination circuit 1350, a comparison circuit 1360, and an estimation circuit 1370. Among them, any circuit may include multiple transistors, logic gates, or basic circuit logic units.
切分电路1310,用于将图像切分为m个子块,所述m为大于1的整数。获取电路1320用于获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息。映射电路1330,用于将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度。A segmentation circuit 1310 is configured to segment an image into m sub-blocks, where m is an integer greater than 1. The obtaining circuit 1320 is configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information. A mapping circuit 1330 is configured to map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, and each color brightness sample is associated with one color brightness. Corresponding to the information group, the three-dimensional space of color brightness includes two color dimensions and one brightness dimension.
计算电路1340,用于在所述m个色彩亮度样点被沿所述亮度维度划分为k层,且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度。其中,所述k层中的每层对应一亮度区间(连续亮度区间)。其中,所述P为大于1的整数,所述k为正整数。确定电路1350,用于基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度。比较电路1360,用于比较所述图像的对应的分群数P的第二交融度与交融度阈值。其中,估测电路1370,用于在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像所对应拍摄环境中至少存在P个色温不同的光源。A calculation circuit 1340 is configured to calculate when the m color luminance samples are divided into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups. The first blending degree of the number of clusters P corresponding to each of the k layers. Each of the k layers corresponds to a brightness interval (continuous brightness interval). Wherein, P is an integer greater than 1, and k is a positive integer. A determining circuit 1350 is configured to determine a second blending degree of the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers. The comparison circuit 1360 is configured to compare the second blending degree and the blending degree threshold of the corresponding grouping number P of the image. Wherein, an estimation circuit 1370 is configured to estimate that at least P different color temperatures exist in the shooting environment corresponding to the image when the second blending degree of the corresponding clustering number P of the image is greater than the blending degree threshold. Light source.
此外,估测电路1370还可以用于,在所述图像的对应的分群数P的第二交融度小于所述 交融度阈值的情况之下,估测所述图像所对应拍摄环境中存在的不同色温的光源的数量不为P个。In addition, the estimation circuit 1370 may be further configured to estimate a difference in a shooting environment corresponding to the image in a case where the second blending degree of the corresponding clustering number P of the image is smaller than the blending degree threshold. The number of light sources of color temperature is not P.
在一些可能实施方式中,所述k大于1,在基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度的方面,确定电路1350具体用于:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理以得到所述图像的对应的分群数P的第二交融度。In some possible implementation manners, where k is greater than 1, in determining an aspect of the second blending degree of the number of clusters P corresponding to the image based on the first blending degree of the number of clusters P corresponding to each of the k layers, The determining circuit 1350 is specifically configured to perform summing or weighted summing processing on the first blending degree P of the number of clusters P corresponding to each of the k layers to obtain the second blending degree of the corresponding number of clusters P of the image .
在一些可能的实施方式中,所述P大于2;在计算所述k层中的第i层对应的分群数P的第一交融度的方面,计算电路1340具体用于:计算所述第i层的P个分群中每两个分群之间的第三交融度;将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理以得到所述第i层对应的分群数P的第一交融度,所述第i层为所述k层中的任意一层。In some possible implementation manners, the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k-layers, the calculation circuit 1340 is specifically configured to calculate the i-th A third blending degree between every two clusters in the P subgroups of the layer; summing or weighting the third blending degree between each two clusters in the P clusters to obtain the i-th The first blending degree of the grouping number P corresponding to the layer, and the i-th layer is any one of the k layers.
在一些可能的实施方式中,在计算分群gi和分群gj之间的第三交融度的方面,所述计算电路1340具体用于:在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格,所述连续排列的量度单元格数量为T。其中,所述分群gi和所述分群gj为所述第i层的所述P个分群中的任意两个分群。并且,所述计算电路1340用于统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q,以及确定所述分群gi和所述分群gj之间的第三交融度为Q/T,其中,所述T和所述Q为整数,所述T大于0且所述Q大于或等于0。在一些可能的实施方式中,所述连续排列的量度单元格的长度方向,与所述分群gi的中心点和所述分群gj的中心点的连线垂直。In some possible implementation manners, in terms of calculating a third degree of fusion between cluster gi and cluster gj, the calculation circuit 1340 is specifically configured to: insert a continuous between a center point of cluster gi and a center point of cluster gj The number of the arranged measurement cells is T. The cluster gi and the cluster gj are any two clusters among the P clusters in the i-th layer. In addition, the calculation circuit 1340 is configured to count the number of measurement cells Q including color brightness samples in the cluster gi and the cluster gj, and determine that the third degree of integration between the cluster gi and the cluster gj is Q / T, wherein the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0. In some possible implementation manners, a length direction of the continuously arranged measurement cells is perpendicular to a line connecting a center point of the cluster gi and a center point of the cluster gj.
在一些可能的实施方式中,所述色彩亮度三维空间包括的两个色彩维度为第一色彩维度和第二色彩维度,任一分群的中心点的第一色彩维度坐标等于该任一分群中所有色彩亮度样点的第一色彩维度坐标的平均值,所述该任一分群的中心点的第二色彩维度坐标等于该任一分群中所有色彩亮度样点的第二色彩维度坐标的平均值。In some possible implementation manners, the two color dimensions included in the three-dimensional color luminance space are a first color dimension and a second color dimension, and a first color dimension coordinate of a center point of any cluster is equal to all The average value of the first color dimension coordinates of the color brightness sample points, and the second color dimension coordinate of the center point of the any group is equal to the average value of the second color dimension coordinates of all the color brightness sample points in the any group.
在一些可能的实施方式中,所述计算电路、所述确定电路、所述比较电路和所述估测电路可以分别针对P=2,…X执行所述计算、所述确定、所述比较和所述估测,X为大于2的整数。所述估测电路进一步用于,在分别估测到所述拍摄环境中存在P=2,…Y个色温不同的光源的情况下,确定所述拍摄环境中存在P=Y个色温不同的光源,所述Y为大于2且小于等于所述X的整数。In some possible implementation manners, the calculation circuit, the determination circuit, the comparison circuit, and the estimation circuit may perform the calculation, the determination, the comparison, and In the estimation, X is an integer greater than two. The estimation circuit is further configured to: when it is estimated that there are P = 2, ... Y light sources with different color temperatures in the shooting environment, determine that P = Y light sources with different color temperatures exist in the shooting environment , Wherein Y is an integer greater than 2 and less than or equal to X.
图14所示举例中以图12中的部分或全部单元由处理器执行的软件代码来实现为例。参见图14,本申请实施例还提供了一种光源估测装置1400,其中,所述光源估测装置1400包括相互耦合的处理器1410和存储器1420。存储器1410中存储有计算机程序。所述处理器1410用于调用所述存储器1420中存储的计算机程序,以执行本发明实施例提供的任意一种光源估测方法,具体可参照之前的实施例。In the example shown in FIG. 14, some or all of the units in FIG. 12 are implemented by software codes executed by a processor as an example. Referring to FIG. 14, an embodiment of the present application further provides a light source estimation device 1400. The light source estimation device 1400 includes a processor 1410 and a memory 1420 that are coupled to each other. A computer program is stored in the memory 1410. The processor 1410 is configured to call a computer program stored in the memory 1420 to execute any one of the light source estimation methods provided in the embodiments of the present invention. For details, refer to the previous embodiments.
其中,处理器1410可包括中央处理单元(central processing unit,CPU)或其他处理器,如数字信号处理器(DSP)、微处理器、微控制器或神经网络计算器。在一些具体的应用中,光源估测装置的各组件例如通过总线系统耦合在一起。其中,总线系统除了可以包括数据总线之外,还可包括电源总线、控制总线和状态信号总线等。但是为清楚说明起见,在图中将各种总线都标为总线系统1430。上述本申请实施例揭示的光源估测方法可应 用于处理器1410中,或由处理器1410实现。处理器1410可能是一种集成电路芯片,具有图像信号的处理能力。The processor 1410 may include a central processing unit (CPU) or other processors, such as a digital signal processor (DSP), a microprocessor, a microcontroller, or a neural network calculator. In some specific applications, the components of the light source estimation device are coupled together, for example, through a bus system. The bus system may include a data bus, a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the various buses are marked as the bus system 1430 in the figure. The light source estimation method disclosed in the foregoing embodiment of the present application may be applied to the processor 1410, or implemented by the processor 1410. The processor 1410 may be an integrated circuit chip, and has processing capabilities of image signals.
在一些实现过程中,上述光源估测方法的各步骤可通过处理器1410中的硬件的集成逻辑电路或者软件形式的指令完成。也就是说,处理器1410除了可以包括执行软件指令的计算单元还可以包括其他硬件加速器,例如可以包括专用集成电路、现成可编程门阵列或其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。处理器1410可实现或执行本申请实施例中公开的各光源估测方法、步骤及逻辑框图。本申请实施例所公开的光源估测方法的步骤可直接体现为硬件、软件或硬件及软件模块组合执行完成。软件模块可位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等等本领域成熟的存储介质之中。该存储介质位于存储器1420,例如处理器1410可读取存储器1420中的信息,结合其硬件完成上述方法的步骤。In some implementation processes, each step of the above-mentioned light source estimation method may be completed by an integrated logic circuit of hardware in the processor 1410 or an instruction in the form of software. That is, the processor 1410 may include, in addition to a computing unit executing software instructions, other hardware accelerators, such as an application-specific integrated circuit, an off-the-shelf programmable gate array or other programmable logic device, a discrete gate or transistor logic device, and a discrete Hardware components. The processor 1410 may implement or execute various light source estimation methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The steps of the light source estimation method disclosed in the embodiments of the present application can be directly implemented as hardware, software, or a combination of hardware and software modules. The software module may be located in a random storage, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, and the like, which are mature storage media in the art. The storage medium is located in the memory 1420. For example, the processor 1410 can read information in the memory 1420 and complete the steps of the foregoing method in combination with its hardware.
例如处理器1410例如可用于,将图像切分为m个子块,所述m为大于1的整数;获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息;将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,其中,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度;在所述m个色彩亮度样点被沿所述亮度维度划分为k层,且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度;所述k层中的每层对应一亮度区间,所述P为大于1的整数,所述k为正整数;基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度;比较所述图像的对应的分群数P的第二交融度与交融度阈值;在所述图像的对应的分群数P的第二交融度大于所述交融度阈值的情况下,估测所述图像的拍摄环境中存在P个色温不同的光源。For example, the processor 1410 may be used, for example, to divide an image into m sub-blocks, where m is an integer greater than 1, and obtain m color luminance information groups of the m sub-blocks, each color luminance information group and one sub-block Correspondingly, the color brightness information group includes brightness information and color information; the m color brightness information groups are mapped to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where Each color brightness sample corresponds to a color brightness information group, and the color brightness three-dimensional space includes two color dimensions and a brightness dimension; the m color brightness samples are divided into k layers along the brightness dimension And when each of the k layers is divided into P color luminance sample clusters, the first blending degree of the number of clusters P corresponding to each of the k layers is calculated; Each layer corresponds to a brightness interval, the P is an integer greater than 1, and the k is a positive integer; the number of clusters corresponding to the image is determined based on the first blending degree of the number of clusters P corresponding to each layer in the k layers The second blending degree of P; A second blending degree and a blending degree threshold value corresponding to the corresponding clustering number P of the image; and in a case where the second blending degree of the corresponding clustering number P of the image is greater than the blending degree threshold, the image is estimated There are P light sources with different color temperatures in the shooting environment.
参见图15,本申请实施例还提供一种图像处理装置1500,图像处理装置1500包括相互耦合的处理器1510和存储器1520。所述存储器1520中存储有计算机程序。所述处理器1510用于调用所述存储器1520中存储的计算机程序,以执行本发明实施例提供的任意一种图像处理方法。该方法除了做光源估测外,还执行之前提到的校正操作。Referring to FIG. 15, an embodiment of the present application further provides an image processing apparatus 1500. The image processing apparatus 1500 includes a processor 1510 and a memory 1520 coupled to each other. A computer program is stored in the memory 1520. The processor 1510 is configured to call a computer program stored in the memory 1520 to execute any image processing method provided by an embodiment of the present invention. In addition to light source estimation, this method also performs the previously mentioned correction operations.
参见图16,本申请实施例还提供了一种图像处理装置1600,其中,图像处理装置1600包括:相互耦合的光源估测装置1610和校正装置1620。其中,光源估测装置1610例如可为光源估测装置1200或1300或1400。所述校正装置1620用于,依据P个色温不同的光源对所述图像进行校正,所述校正包括如下校正中的至少一种:自动白平衡校正、色彩校正、饱和度校正、或对比度校正。所述校正装置例如可为图像信号处理器(ISP),所述ISP例如可包括如下校正电路中的至少一种:自动白平衡校正电路1621、色彩校正电路1622、饱和度校正电路1623或对比度校正电路1624。Referring to FIG. 16, an embodiment of the present application further provides an image processing device 1600. The image processing device 1600 includes a light source estimation device 1610 and a correction device 1620 coupled to each other. The light source estimation device 1610 may be, for example, the light source estimation device 1200 or 1300 or 1400. The correction device 1620 is configured to correct the image according to P light sources with different color temperatures. The correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction. The correction device may be, for example, an image signal processor (ISP). The ISP may include at least one of the following correction circuits: an automatic white balance correction circuit 1621, a color correction circuit 1622, a saturation correction circuit 1623, or a contrast correction. Circuit 1624.
例如,自动白平衡校正电路1621可用于依据P个色温不同的光源对图像进行自动白平衡校正。色彩校正电路1622可用于依据P个色温不同的光源对图像进行色彩校正。饱和度校正电路1623可用于依据P个色温不同的光源对图像进行饱和度校正。对比度校正电路1624可用于依据P个色温不同的光源对图像进行对比度校正。For example, the automatic white balance correction circuit 1621 may be used to perform automatic white balance correction on an image according to P light sources with different color temperatures. The color correction circuit 1622 can be used to perform color correction on an image according to P light sources with different color temperatures. The saturation correction circuit 1623 can be used to perform saturation correction on an image according to P light sources with different color temperatures. The contrast correction circuit 1624 can be used to perform contrast correction on an image according to P light sources with different color temperatures.
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序被相关硬件执行,以完成执行本发明实施例提供的任意一种光源估测方法。此外,本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被相关硬件执行,以完成执行本发明实施例提供的任意一种图像处理方法。An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, wherein the computer program is executed by related hardware to complete the execution of any one of the light sources provided by the embodiments of the present invention. Estimate method. In addition, an embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is executed by related hardware to complete execution of any image provided by the embodiment of the present invention. Approach.
本申请实施例还提供一种计算机程序产品,其中,当所述计算机程序产品在计算机上运行时,使得所述计算机执行本发明实施例提供的任意一种光源估测方法。此外,本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行本发明实施例提供的任意一种图像处理方法。An embodiment of the present application further provides a computer program product, wherein when the computer program product runs on a computer, the computer is caused to execute any one of the light source estimation methods provided by the embodiments of the present invention. In addition, an embodiment of the present application further provides a computer program product, and when the computer program product runs on a computer, the computer is caused to execute any one of the image processing methods provided by the embodiments of the present invention.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分可以参见其他实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in an embodiment, reference may be made to related descriptions in other embodiments.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可能可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the foregoing method embodiments, for simplicity of description, they are all described as a series of action combinations, but those skilled in the art should know that this application is not limited by the described action order. Because according to this application, some steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required for this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可以通过其他的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些界面,装置或者单元的间接耦合或通信连接,可以是电性或其他的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or integrated. To another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be electrical or other forms.
另外,在本申请各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the embodiments of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
上述集成的单元若以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可获取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或者部分可以以软件产品的形式来体现出来,其中,该计算机软件产品存储在一个计算机可读存储介质中,包括若干指令用以使得一台计算机设备(可以为个人计算机、服务器或者网络设备等,具体可以是计算机设备中的处理器)执行本申请的各个实施例上述方法的全部或部分步骤。其中,而前述的存储介质可包括:U盘、移动硬盘、磁碟、光盘、只读存储器(read-only memory,ROM)或者随机存取存储器(random access memory,RAM)等各种可以存储程序代码的介质。When the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-accessible storage medium. Based on this understanding, the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, where the computer software product is stored in a The computer-readable storage medium includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, and specifically a processor in the computer device) to perform all of the foregoing methods of the embodiments of the present application. Or some steps. Among them, the foregoing storage medium may include: various programs that can store programs such as a U disk, a mobile hard disk, a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM). The medium of the code.
以上所述,以上实施例仅用以说明本申请的技术方案而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,然而本领域的普通技术人员应当理解:其依然可对前述各实施例所记载的技术方案进行修改,或对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to describe the technical solution of the present application and are not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still apply the foregoing The technical solutions described in the embodiments are modified, or some technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种光源估测方法,其特征在于,包括:A light source estimation method, comprising:
    将图像切分为m个子块,所述m为大于1的整数;Segment the image into m sub-blocks, where m is an integer greater than 1;
    获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息;Acquiring m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group including brightness information and color information;
    将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,其中,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度;Mapping the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where each color brightness sample point corresponds to one color brightness information group, The three-dimensional space of color and brightness includes two color dimensions and one brightness dimension;
    在所述m个色彩亮度样点被沿所述亮度维度划分为k层,且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度;所述k层中的每层对应一亮度区间,所述P为大于1的整数,所述k为正整数;In the case where the m color brightness sample points are divided into k layers along the brightness dimension, and each of the k layers is divided into P color brightness sample groupings, calculate the A first blending degree of the number of clusters P corresponding to each layer; each of the k layers corresponds to a brightness interval, where P is an integer greater than 1, and k is a positive integer;
    基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度;Determining a second blending degree of the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers;
    比较所述第二交融度与交融度阈值;Comparing the second degree of fusion with a threshold of degree of fusion;
    在所述第二交融度大于所述交融度阈值的情况下,估测所述图像的拍摄环境中至少存在P个色温不同的光源。When the second degree of fusion is greater than the threshold of the degree of fusion, it is estimated that there are at least P light sources with different color temperatures in the shooting environment of the image.
  2. 根据权利要求1所述的方法,其特征在于,所述k大于1,所述基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度包括:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理以得到所述图像的对应的分群数P的第二交融度。The method according to claim 1, wherein the k is greater than 1, and determining the number of clusters P corresponding to the image based on a first blending degree of the number of clusters P corresponding to each of the k layers The second blending degree includes: summing or weighted summing the first blending degree P corresponding to the number of clusters P in each of the k layers to obtain a second blending degree corresponding to the number of clusters P of the image.
  3. 根据权利要求1或2所述的方法,其特征在于,所述P大于2;计算所述k层中的第i层对应的分群数P的第一交融度包括:The method according to claim 1 or 2, wherein the P is greater than 2; calculating the first blending degree of the number of clusters P corresponding to the ith layer in the k layers comprises:
    计算所述第i层的P个分群中每两个分群之间的第三交融度;Calculating a third blending degree between every two clusters in the P clusters of the i-th layer;
    将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理以得到所述第i层对应的分群数P的第一交融度,所述第i层为所述k层中的任意一层。Summing or weighted summing the third degree of integration between each two of the P groups to obtain the first degree of integration of the number of groups P corresponding to the i-th layer, where the i-th layer is Any one of the k layers.
  4. 根据权利要求3所述的方法,其特征在于,计算分群gi和分群gj之间的第三交融度包括:The method according to claim 3, wherein calculating the third blending degree between the cluster gi and the cluster gj comprises:
    在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格,所述连续排列的量度单元格数量为T;Insert continuously arranged measurement cells between the center point of the cluster gi and the center point of the cluster gj, and the number of the continuously arranged measurement cells is T;
    统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q;The statistics include the number of measurement cells Q of the color brightness samples in the clusters gi and gj;
    确定所述分群gi和所述分群gj之间的第三交融度为Q/T;Determining a third degree of integration between the cluster gi and the cluster gj as Q / T;
    其中,所述T和所述Q为整数,所述T大于0且所述Q大于或等于0,所述分群gi和所述分群gj为所述第i层的所述P个分群中任意两个分群。Wherein, the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0, and the cluster gi and the cluster gj are any two of the P clusters of the i-th layer Subgroups.
  5. 根据权利要求4所述的方法,其特征在于,The method according to claim 4, wherein:
    所述连续排列的量度单元格的长度方向,与所述分群gi的中心点和所述分群gj的中心点的连线垂直。The length direction of the continuously arranged measurement cells is perpendicular to the line connecting the center point of the cluster gi and the center point of the cluster gj.
  6. 根据权利要求4或5所述的方法,其特征在于,所述两个色彩维度为第一色彩维度和 第二色彩维度,其中,任一分群的中心点的第一色彩维度坐标等于该任一分群中所有色彩亮度样点的第一色彩维度坐标的平均值,所述该任一分群的中心点的第二色彩维度坐标等于该任一分群中所有色彩亮度样点的第二色彩维度坐标的平均值。The method according to claim 4 or 5, wherein the two color dimensions are a first color dimension and a second color dimension, wherein the first color dimension coordinate of the center point of any cluster is equal to the any one The average value of the first color dimension coordinates of all color brightness samples in a cluster, and the second color dimension coordinate of the center point of any one cluster is equal to the second color dimension coordinates of all color brightness samples in any one cluster. average value.
  7. 根据权利要求1至6任意一项所述的方法,其特征在于,分别针对P=2,…X执行所述计算、所述确定、所述比较和所述估测,X为大于2的整数;The method according to any one of claims 1 to 6, characterized in that the calculation, the determination, the comparison, and the estimation are performed for P = 2, ... X, respectively, and X is an integer greater than 2 ;
    在分别估测到所述拍摄环境中存在P=2,…Y个色温不同的光源的情况下,确定所述拍摄环境中存在P=Y个色温不同的光源,所述Y为大于等于2且小于等于所述X的整数。When it is estimated that P = 2, ... Y light sources with different color temperatures exist in the shooting environment, it is determined that P = Y light sources with different color temperatures exist in the shooting environment, where Y is 2 or more and An integer less than or equal to said X.
  8. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    执行如权利要求1至7任意一项所述的光源估测方法;Performing the light source estimation method according to any one of claims 1 to 7;
    依据P个色温不同的光源对所述图像进行校正,其中,所述校正包括如下校正中的至少一种:自动白平衡校正、色彩校正、饱和度校正、或对比度校正。The image is corrected according to P light sources with different color temperatures, wherein the correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
  9. 一种光源估测装置,其特征在于,包括:A light source estimation device, comprising:
    切分单元,用于将图像切分为m个子块,所述m为大于1的整数;A segmentation unit, configured to segment an image into m sub-blocks, where m is an integer greater than 1;
    获取单元,用于获取所述m个子块的m个色彩亮度信息组,每个色彩亮度信息组与一个子块对应,所述色彩亮度信息组包括亮度信息和色彩信息;An obtaining unit, configured to obtain m color brightness information groups of the m sub-blocks, each color brightness information group corresponding to one sub-block, and the color brightness information group includes brightness information and color information;
    映射单元,用于将所述m个色彩亮度信息组映射到色彩亮度三维空间,以得到位于所述色彩亮度三维空间中的m个色彩亮度样点,其中,每个色彩亮度样点与一个色彩亮度信息组对应,所述色彩亮度三维空间包括两个色彩维度和一个亮度维度;A mapping unit, configured to map the m color brightness information groups to a color brightness three-dimensional space to obtain m color brightness samples located in the color brightness three-dimensional space, where each color brightness sample is associated with a color The brightness information group corresponds, and the three-dimensional space of color brightness includes two color dimensions and one brightness dimension;
    计算单元,用于在所述m个色彩亮度样点被沿所述亮度维度划分为k层,且所述k层中的每层被划分了P个色彩亮度样点分群的情况下,计算所述k层中的每层对应的分群数P的第一交融度;其中,所述k层中的每层对应一亮度区间,其中,所述P为大于1的整数,所述k为正整数;A calculation unit, configured to calculate all the m color luminance sample points into k layers along the luminance dimension, and each of the k layers is divided into P color luminance sample groups. The first blending degree of the number of clusters P corresponding to each of the k layers is described; wherein each of the k layers corresponds to a brightness interval, where P is an integer greater than 1 and k is a positive integer ;
    确定单元,用于基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度;A determining unit, configured to determine a second blending degree of the grouping number P corresponding to the image based on the first blending degree of the grouping number P corresponding to each of the k layers;
    比较单元,用于比较所述第二交融度与交融度阈值;A comparison unit, configured to compare the second degree of fusion with a threshold of degree of fusion;
    估测单元,用于在所述第二交融度大于所述交融度阈值的情况下,估测所述图像的拍摄环境中至少存在P个色温不同的光源。An estimation unit is configured to estimate that, in a case where the second blending degree is greater than the blending degree threshold, at least P light sources with different color temperatures exist in a shooting environment of the image.
  10. 根据权利要求9所述的装置,其特征在于,所述k大于1,在基于所述k层中的每层对应的分群数P的第一交融度确定所述图像对应的分群数P的第二交融度的方面,所述确定单元具体用于:对所述k层中的每层对应的分群数P的第一交融度进行求和或加权求和处理以得到所述图像的对应的分群数P的第二交融度。The device according to claim 9, wherein the k is greater than 1, and the first number of the grouping number P corresponding to the image is determined based on a first blending degree of the number of groupings P corresponding to each of the k layers. In the aspect of two blending degrees, the determining unit is specifically configured to: perform summing or weighted summing processing on the first blending degree of the number of clusters P corresponding to each of the k layers to obtain corresponding clusters of the image Count the second degree of blending.
  11. 根据权利要求9或10所述的装置,其特征在于,所述P大于2;在计算所述k层中的第i层对应的分群数P的第一交融度的方面,所述计算单元具体用于:计算所述第i层的P个分群中每两个分群之间的第三交融度;将所述P个分群中每两个分群之间的第三交融度进行求和或加权求和处理以得到所述第i层对应的分群数P的第一交融度,所述第i层为所述k层中的任意一层。The device according to claim 9 or 10, wherein the P is greater than 2; in calculating a first blending degree of the number of clusters P corresponding to the i-th layer in the k layers, the calculation unit is specifically For: calculating the third degree of fusion between every two subgroups in the P subgroups of the i-th layer; and summing or weighting the third degree of integration between every two subgroups in the P subgroups And processing to obtain a first blending degree of the clustering number P corresponding to the i-th layer, where the i-th layer is any one of the k-layers.
  12. 根据权利要求11所述的装置,其特征在于,在计算分群gi和分群gj之间的第三交 融度的方面,所述计算单元具体用于:The device according to claim 11, wherein in the aspect of calculating a third degree of fusion between the cluster gi and the cluster gj, the calculation unit is specifically configured to:
    在分群gi的中心点和分群gj的中心点之间插入连续排列的量度单元格,所述连续排列的量度单元格数量为T;Insert continuously arranged measurement cells between the center point of the cluster gi and the center point of the cluster gj, and the number of the continuously arranged measurement cells is T;
    统计包括了分群gi和分群gj中的色彩亮度样点的量度单元格数量Q;确定所述分群gi和所述分群gj之间的第三交融度为Q/T;The statistics include the number of measurement cells Q of the color brightness sample points in the cluster gi and the cluster gj; determining that the third degree of fusion between the cluster gi and the cluster gj is Q / T;
    其中,所述T和所述Q为整数,所述T大于0且所述Q大于或等于0;所述分群gi和所述分群gj为所述第i层的所述P个分群中任意两个分群。Wherein, the T and the Q are integers, the T is greater than 0 and the Q is greater than or equal to 0; the cluster gi and the cluster gj are any two of the P clusters of the i-th layer Subgroups.
  13. 根据权利要求12所述的装置,其特征在于,The device according to claim 12, wherein:
    所述连续排列的量度单元格的长度方向,与所述分群gi的中心点和所述分群gj的中心点的连线垂直。The length direction of the continuously arranged measurement cells is perpendicular to the line connecting the center point of the cluster gi and the center point of the cluster gj.
  14. 根据权利要求12或13所述的装置,其特征在于,所述两个色彩维度为第一色彩维度和第二色彩维度,其中,任一分群的中心点的第一色彩维度坐标等于该任一分群中所有色彩亮度样点的第一色彩维度坐标的平均值,所述该任一分群的中心点的第二色彩维度坐标等于该任一分群中所有色彩亮度样点的第二色彩维度坐标的平均值。The device according to claim 12 or 13, wherein the two color dimensions are a first color dimension and a second color dimension, wherein a first color dimension coordinate of a center point of any cluster is equal to the any one The average value of the first color dimension coordinates of all color brightness samples in a cluster, and the second color dimension coordinate of the center point of any one cluster is equal to the second color dimension coordinates of all color brightness samples in any one cluster. average value.
  15. 根据权利要求9至14任意一项所述的装置,其特征在于,所述计算单元、所述确定单元、所述比较单元和所述估测单元分别针对P=2,…X执行所述计算、所述确定、所述比较和所述估测,X为大于2的整数;The device according to any one of claims 9 to 14, wherein the calculation unit, the determination unit, the comparison unit, and the estimation unit respectively perform the calculation for P = 2, ... X , The determination, the comparison, and the estimation, X is an integer greater than 2;
    所述估测单元进一步用于,在分别估测到所述拍摄环境中存在P=2,…Y个色温不同的光源的情况下,确定所述拍摄环境中存在P=Y个色温不同的光源,所述Y为大于2且小于等于所述X的整数。The estimation unit is further configured to determine, when it is estimated that P = 2, ... Y light sources with different color temperatures exist in the shooting environment, determine that P = Y light sources with different color temperatures exist in the shooting environment. , Wherein Y is an integer greater than 2 and less than or equal to X.
  16. 一种图像处理装置,其特征在于,包括:An image processing device, comprising:
    相互耦合的光源估测装置和校正装置;Mutually coupled light source estimation device and correction device;
    所述光源估测装置为如权利要求9至15任意一项所述的光源估测装置;The light source estimation device is the light source estimation device according to any one of claims 9 to 15;
    所述校正装置用于,依据P个色温不同的光源对所述图像进行校正,所述校正包括如下校正中的至少一种:自动白平衡校正、色彩校正、饱和度校正、或对比度校正。The correction device is configured to correct the image according to P light sources with different color temperatures, and the correction includes at least one of the following corrections: automatic white balance correction, color correction, saturation correction, or contrast correction.
  17. 一种光源估测装置,其特征在于,所述光源估测装置包括相互耦合的处理器和存储器,所述存储器中存储有计算机程序;所述处理器用于调用所述存储器中存储的计算机程序,以执行权利要求1至7任意一项所述的光源估测方法。A light source estimation device, characterized in that the light source estimation device includes a processor and a memory coupled with each other, and the memory stores a computer program; the processor is configured to call the computer program stored in the memory, The light source estimation method according to any one of claims 1 to 7 is performed.
  18. 一种图像处理装置,其特征在于,所述光源估测装置包括相互耦合的处理器和存储器,所述存储器中存储有计算机程序;所述处理器用于调用所述存储器中存储的计算机程序,以执行权利要求8所述的图像处理方法。An image processing device, wherein the light source estimation device includes a processor and a memory coupled to each other, and the memory stores a computer program; the processor is configured to call the computer program stored in the memory to The image processing method according to claim 8 is executed.
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,其中,所述计算机程序被相关硬件执行以完成权利要求1至7任意一项所述的光源估测方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, wherein the computer program is executed by related hardware to complete the light source estimation according to any one of claims 1 to 7. method.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被相关硬件执行以完成权利要求8所述的图像处理方法。A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, and the computer program is executed by related hardware to complete the image processing method of claim 8.
PCT/CN2018/093144 2018-06-27 2018-06-27 Light source estimating method, image processing method and related products WO2020000262A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201880095117.9A CN112313946A (en) 2018-06-27 2018-06-27 Light source estimation method, image processing method and related product
PCT/CN2018/093144 WO2020000262A1 (en) 2018-06-27 2018-06-27 Light source estimating method, image processing method and related products

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/093144 WO2020000262A1 (en) 2018-06-27 2018-06-27 Light source estimating method, image processing method and related products

Publications (1)

Publication Number Publication Date
WO2020000262A1 true WO2020000262A1 (en) 2020-01-02

Family

ID=68984561

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/093144 WO2020000262A1 (en) 2018-06-27 2018-06-27 Light source estimating method, image processing method and related products

Country Status (2)

Country Link
CN (1) CN112313946A (en)
WO (1) WO2020000262A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090097745A1 (en) * 2007-10-11 2009-04-16 Korea Advanced Institute Of Science And Technology Method of performing robust auto white balance
CN103929632A (en) * 2014-04-15 2014-07-16 浙江宇视科技有限公司 Automatic white balance correcting method and device
CN105430367A (en) * 2015-12-30 2016-03-23 浙江宇视科技有限公司 Automatic white balance method and device
CN106791758A (en) * 2016-12-07 2017-05-31 浙江大华技术股份有限公司 The determination methods and device of natural light mixing colour temperature in a kind of image

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8229215B2 (en) * 2007-12-03 2012-07-24 Omnivision Technologies, Inc. Image sensor apparatus and method for scene illuminant estimation
JP5818668B2 (en) * 2011-12-16 2015-11-18 株式会社東芝 Auto white balance adjustment system
CN105959662B (en) * 2016-05-24 2017-11-24 深圳英飞拓科技股份有限公司 Self-adapted white balance method of adjustment and device
CN107959851B (en) * 2017-12-25 2019-07-19 Oppo广东移动通信有限公司 Colour temperature detection method and device, computer readable storage medium and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090097745A1 (en) * 2007-10-11 2009-04-16 Korea Advanced Institute Of Science And Technology Method of performing robust auto white balance
CN103929632A (en) * 2014-04-15 2014-07-16 浙江宇视科技有限公司 Automatic white balance correcting method and device
CN105430367A (en) * 2015-12-30 2016-03-23 浙江宇视科技有限公司 Automatic white balance method and device
CN106791758A (en) * 2016-12-07 2017-05-31 浙江大华技术股份有限公司 The determination methods and device of natural light mixing colour temperature in a kind of image

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHENG-FU YANG ET AL: "Fuzzy neural system for estimating the color temperature of digitally captured image with fpga implementation", 2015 IEEE 10TH CONFERENCE ON INDUSTRIAL ELECTRONICS AND APPLICATIONS (ICIEA), 15 June 2015 (2015-06-15), pages 410 - 415, XP032815907, DOI: 10.1109/ICIEA.2015.7334148 *

Also Published As

Publication number Publication date
CN112313946A (en) 2021-02-02

Similar Documents

Publication Publication Date Title
CN106412547B (en) A kind of image white balance method based on convolutional neural networks, device and calculate equipment
ES2763024T3 (en) Automatic white balance
Gijsenij et al. Improving color constancy by photometric edge weighting
CN111798467B (en) Image segmentation method, device, equipment and storage medium
US9390348B2 (en) Method for categorizing objects in image
TWI660633B (en) White balance calibration method based on skin color data and image processing apparatus thereof
CN111369659B (en) Texture mapping method, device and equipment based on three-dimensional model
CN103854261B (en) The bearing calibration of colour cast image
TWI777536B (en) Enhanced training method and device for image recognition model
CN110213556B (en) Automatic white balance method and system in monochrome scene, storage medium and terminal
US9401027B2 (en) Method and apparatus for scene segmentation from focal stack images
CN113393540B (en) Method and device for determining color edge pixel points in image and computer equipment
CN112232323B (en) Face verification method and device, computer equipment and storage medium
WO2020142871A1 (en) White balance processing method and device for image
CN102509099A (en) Detection method for image salient region
CN105681775A (en) White balance method and device
CN108063926B (en) Image processing method and device, computer readable storage medium and computer device
CN114745532B (en) Mixed color temperature scene white balance processing method and device, storage medium and terminal
CN113301318A (en) Image white balance processing method and device, storage medium and terminal
WO2019227355A1 (en) Image processing method and apparatus
WO2020000262A1 (en) Light source estimating method, image processing method and related products
WO2022120799A9 (en) Image processing method and apparatus, electronic device, and storage medium
WO2019137396A1 (en) Image processing method and device
CN116978308A (en) Display correction method and device and electronic equipment
CN112492286A (en) Automatic white balance correction method, device and computer storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18924631

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18924631

Country of ref document: EP

Kind code of ref document: A1