WO2019137396A1 - Image processing method and device - Google Patents

Image processing method and device Download PDF

Info

Publication number
WO2019137396A1
WO2019137396A1 PCT/CN2019/070980 CN2019070980W WO2019137396A1 WO 2019137396 A1 WO2019137396 A1 WO 2019137396A1 CN 2019070980 W CN2019070980 W CN 2019070980W WO 2019137396 A1 WO2019137396 A1 WO 2019137396A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
group
groups
value
target
Prior art date
Application number
PCT/CN2019/070980
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 华为技术有限公司
Publication of WO2019137396A1 publication Critical patent/WO2019137396A1/en

Links

Images

Classifications

    • G06T5/94
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows

Definitions

  • the present application relates to the field of image processing technologies, and in particular, to an image processing method and an image processing apparatus.
  • Color shading is a phenomenon in which an image is displayed when a photograph is taken, such as a cell phone or a camera.
  • the image is reddish in the center of the image and greenish around.
  • the color shading phenomenon is caused by the physical properties of an IR cut filter attached to the photosensitive member.
  • the IR cut filter reduces the transmittance of red light with a longer wavelength due to the increase of the incident angle.
  • the incident angle of the red light in the center of the image is smaller, the incident angle of the red light around the image is larger, and the red light entering the central region of the image More than the red light entering the image, so the center of the image is reddish and the area is green.
  • the light source of different color temperature in the photographing environment determines the degree of color shading, so the auto white balance (AWB) algorithm can be used to calculate the color temperature of the light source in the photographing environment, and then the current color is utilized.
  • the color shading compensation table corresponding to the color temperature of the light source compensates the RBG value of the preview image, thereby adjusting the color shading phenomenon of the preview image to prevent the phenomenon from occurring in the photograph taken.
  • the specific process of calculating the color temperature of the light source in the photographing environment by using the AWB algorithm is to first determine the color information of each pixel in the preview image, the color information includes the R/G value and the B/G value of the pixel, and then use each of the preview images. The color information of the pixel calculates the color temperature of the light source in the photographing environment.
  • the AWB algorithm is the color temperature of the light source determined by the color information of the image
  • the original color of the object in the image causes a misjudgment of the color temperature of the light source.
  • the color of the light source with high color temperature is light blue in the image. If there is a light blue object in the image, it is easy to misjudge the current color temperature of the light source as a high color temperature, which may result in the inability to accurately select the compensation table. Adjust the color shading phenomenon of the image.
  • the present application provides an image processing method and apparatus for solving the problem that the existing image processing method cannot accurately select the color shading compensation table, and thus cannot accurately adjust the color shading phenomenon of the image.
  • the present application provides an image processing method, the method comprising the steps of: dividing a target image into at least two blocks; determining at least one block group from the at least two blocks, the at least The materials displayed by each block in each block group of one block group are the same; the at least one block group is pre-compensated by using at least two compensation tables to obtain the color difference corresponding to each compensation table. a value, the compensation table that minimizes the color difference value is determined as a target compensation table; and the target image is color-compensated according to the target compensation table.
  • the present invention pre-compensates the block group with the same object material in the image by using each compensation table, and obtains the color difference value corresponding to each compensation table, so that the target compensation table corresponding to the color temperature of the light source in the photographing environment can be accurately selected, Used to accurately correct images with color shading.
  • the determining the at least one block group from the at least two blocks comprises: determining a location point of each block in a three-dimensional image coordinate system
  • the coordinate values of the position points are respectively a first R/G value, a first B/G value, and a brightness value of each block;
  • at least two reference points are determined in the three-dimensional image coordinate system, and each Position points of the blocks are classified into a group to which one of the at least two reference points belongs to obtain at least two first position point groups, and each of the at least two reference points is the each a center of gravity of all the location points in the first location point group to which the reference point belongs; determining a target group in the at least one first location point group, where the center of gravity of each of the first location point groups is located at each of the first location points Within the target group in the group, each of the target points in the target group is separated from the first location point group to which the target group belongs to a distance threshold; the distance corresponding to each target group is
  • the location point of each block is classified into a group to which one of the at least two reference points belongs
  • Obtaining at least two first location point groups includes: classifying a location point of each tile into a group to which a reference point closest to a location point of each block belongs to obtain at least two second location points Determining each of the second location points if a center of gravity of each of the at least two second location point groups coincides with a reference point in each of the second location point groups
  • the group is a first location point group; if the center of gravity of any of the at least two second location point groups does not coincide with the reference point in any of the second location point groups,
  • the center of gravity of each second location point group is used as a new reference point, and each of the location points is grouped by the new reference point to obtain the first location point group.
  • the determining the target group in the at least one first location point group includes: in the three-dimensional image coordinate system, a center of gravity of each of the at least two first location point groups is a spherical target group; if the radius of each target group in the target group is a first radius threshold, If the number of location points in each target group is not less than a quantity threshold, the radius of each target group is set as the first radius threshold; if the radius of each target group in the target group is the first a radius threshold, the number of location points in each target group is less than the number threshold, and the radius of each target group is increased until the number of location points in each target group is not Less than the number threshold, the increased radius is not greater than the second radius threshold.
  • the first radius threshold R min (1/5) * D
  • the second radius threshold R max D
  • D is the point corresponding to the color information of the gray card image obtained under the D65 standard light source in the two-dimensional coordinate system of R/G and B/G and the color information of the gray card image obtained under the D50 standard light source the distance between.
  • any one of the first to fourth implementation manners of the first aspect includes: pre-compensating each block in each block group by using at least two compensation tables to obtain each block group a second R/G value of the block and a second B/G value; determining an R/G difference value of each block group according to a second R/G value of each block in each block group Determining, according to the second B/G value of each block in each block group, a B/G difference value of each block group; according to the R/G difference value of each block group and a B/G difference value, the color difference value corresponding to each of the pre-compensation tables is determined, and the color difference value corresponding to each pre-compensation table is an average value of all R/G difference values of all block groups and all blocks The sum of the average values of the B/G
  • the expression of the R/G difference value is:
  • R/G_DV j (
  • R/G_DV j is the R/G difference value of the j-th block group in all block groups
  • C_R/G i is the second R/G of the i-th block in the j-th block group.
  • P is the number of blocks in the j-th block group
  • Avg_C_R/G is an average value of second R/G values of all blocks in the j-th block group;
  • B/G_DV j (
  • B/G_DV j is the B/G difference value of the j-th block group in all block groups
  • C_B/G i is the second B/G of the i-th block in the j-th block group
  • Avg_C_B/G is the average of the second R/G values of all the blocks in the j-th block group.
  • the color difference value corresponding to each pre-compensation table is a weighted average value of R/G difference values of all block groups.
  • R/G_TDV (R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
  • R/G_TDV represents the weighted average of the R/G difference values of all block groups
  • R/G_DV j is the R/G difference value of the jth block group in all block groups
  • V j is the said The spatial size value of the target group corresponding to the j block groups
  • N j is the number of blocks in the jth block group
  • K is the number of all block groups
  • B/G_TDV (B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
  • B/G_TDV represents the weighted average of the B/G difference values of all block groups
  • B/G_DV j is the B/G difference value of the jth block group in all block groups.
  • the present application further provides an image processing apparatus, which may be configured in a photographing apparatus or a photographing apparatus itself, the apparatus comprising: a dividing unit, configured to divide the target image into at least two blocks; a determining unit, configured to determine at least one block group from the at least two blocks, wherein each of the block groups in the at least one block group exhibits the same material material; the second determination a unit, configured to pre-compensate the at least one block group by using at least two compensation tables to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as a target compensation table; And performing color compensation on the target image according to the target compensation table.
  • the first determining unit is specifically configured to: determine a location point of each block in a three-dimensional image coordinate system, where coordinate values of the location points are respectively a first R/G value, a first B/G value, and a brightness value for each block; determining at least two reference points in the three-dimensional image coordinate system, and assigning a position point of each block to the location Deriving a group to which one of the at least two reference points belongs to obtain at least two first location point groups, each of the at least two reference points being a first location point to which each reference point belongs a center of gravity of all the location points in the group; determining a target group in the at least one first location point group, the center of gravity of each of the first location point groups being located in the target group in each of the first location point groups, Each of the target points in each target group in the target group is not greater than a distance threshold from a first location point group to which each target group belongs; determining a block group
  • the first determining unit is further configured to: locate a location point of each block into each of the regions The position point of the block belongs to the group to which the nearest reference point belongs to obtain at least two second location point groups; if the center of gravity of each of the at least two second location point groups is equal to each of the If the reference points in the second location point group coincide, determining that each of the second location point groups is the first location point group; if any of the at least two second location point groups is in the second location point group If the center of gravity does not coincide with the reference point in any of the second location point groups, then the center of gravity of each of the second location point groups is used as a new reference point, and each of the location points is used by the new reference point. Grouping is performed to obtain the first location point group.
  • the first determining unit is further configured to: in the three-dimensional image coordinate system, the at least two a target group of a spherical shape centered on a center of gravity of each of the first location point groups in a location point group; and if each of the target group groups has a radius of the first radius threshold, the target group is If the number of the location points is not less than the quantity threshold, the radius of each target group is set as the first radius threshold; if the radius of each target group in the target group is the first radius threshold, If the number of the location points in each target group is less than the quantity threshold, the radius of each target group is increased until the number of location points in each target group is not less than the quantity threshold.
  • the second determining unit is specifically configured to: use at least Two compensation tables respectively pre-compensate each block in each block group to obtain a second R/G value and a second B/G value of each block in each block group; according to each of the blocks The second R/G value of each block in the block group determines an R/G difference value of each block group, and determines the second B/G value according to each block in each block group a B/G difference value of each block group; determining, according to the R/G difference value and the B/G difference value of each block group, a color difference value corresponding to each of the pre-compensation tables, wherein each The color difference values corresponding to the pre-compensation tables are the sum of the average of the R/G difference values of all the block groups and the average value of the B/G difference values of all the block groups.
  • the expression of the R/G difference value is:
  • R/G_DV j (
  • R/G_DV j is the R/G difference value of the j-th block group in all block groups
  • C_R/G i is the second R/G of the i-th block in the j-th block group.
  • P is the number of blocks in the j-th block group
  • Avg_C_R/G is an average value of second R/G values of all blocks in the j-th block group;
  • B/G_DV j (
  • B/G_DV j is the B/G difference value of the jth block group in all block groups
  • C_B/G i is the second B/G of the i th block in the j th block group
  • Avg_C_B/G is the average of the second R/G values of all the blocks in the j-th block group.
  • the color difference value corresponding to each pre-compensation table is a weighted average value of R/G difference values of all the block groups.
  • R/G_TDV (R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
  • R/G_TDV represents the weighted average of the R/G difference values of all block groups
  • R/G_DV j is the R/G difference value of the jth block group in all block groups
  • V j is the said The spatial size value of the target group corresponding to the j block groups
  • N j is the number of blocks in the jth block group
  • K is the number of all block groups
  • B/G_TDV (B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
  • B/G_TDV represents the weighted average of the B/G difference values of all block groups
  • B/G_DV j is the B/G difference value of the jth block group in all block groups.
  • the present application also provides an image processing apparatus including a processor, a memory, and a bus system. Wherein the processor and the memory are connected by a bus system for storing instructions for executing the instructions stored by the memory to implement the image processing method of the first aspect and various implementations of the first aspect.
  • the apparatus provided by the present application can implement the image processing method of the first aspect and the various implementation manners of the first aspect, the apparatus provided by the present application has the beneficial effects and the image processing method of the first aspect. The effect is the same and will not be described here.
  • the present application further provides a computer readable storage medium having instructions stored therein, when executed on a computer, causing a computer to execute the image processing method described in the above first aspect .
  • the present application also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the image processing method of the first aspect described above.
  • the present application also provides a chip, the chip including a processor and/or program instructions, when the chip is running, implementing the image processing method of the first aspect of the present application.
  • FIG. 1 is a flowchart of an embodiment of an image processing method provided by the present application
  • FIG. 2 is an effect diagram of a block group composed of R/G values, B/G values, and luminance values similar to that provided by the present application;
  • FIG. 3 is a flowchart of an embodiment of a method for determining a block group according to the present application
  • FIG. 5 is a schematic diagram of distribution of standard light source points and block points in a two-dimensional coordinate system of R/G and B/G provided by the present application;
  • FIG. 6 is a flowchart of an embodiment of a method for determining a color difference value corresponding to a compensation table according to the present application
  • FIG. 7 is a structural block diagram of an embodiment of an image processing apparatus provided by the present application.
  • FIG. 8 is a structural block diagram of another embodiment of an image processing apparatus provided by the present application.
  • the image processing method provided by the present application can be applied to a photographing device, and can prevent the color shading phenomenon from occurring in the photographed image.
  • the photographing device can be any device equipped with a camera, such as a camera, a mobile phone, a video camera or the like.
  • the target image in the present application may be a preview image in the lens or an image after the shooting, and the present application is not specifically limited herein.
  • the inventive concept of the present application is to first divide a target image into a plurality of blocks, and use the R/G value, the B/G value, and the brightness value of each block to determine an area in which the same material of the image is located, and each area in the area.
  • the R/G values of the blocks are similar, the B/G values are similar, and the luminance values are similar.
  • each block in the region is pre-compensated by using each compensation table to obtain the color difference value corresponding to the compensation table, and the color difference value is minimized.
  • the compensation table is determined as a target compensation table for color compensation of the target image. Since the color difference value corresponding to each compensation table can reflect the effect of each compensation table on the color compensation of the target image, the target compensation table corresponding to the color temperature of the light source in the photographing environment can be accurately selected for accurate use. Fix images with color shading.
  • the color temperature of the light source can be divided into: D75 light source, color temperature is 7500 °K; D65 light source, color temperature is 6500 °K; D55 light source, color temperature is 5500 °K; D50 light source, color temperature is 5000 °K; CWF light source, The color temperature is 4100°K; the TL84 light source has a color temperature of 4000°K; the U30 light source has a color temperature of 3000°K; the A light source has a color temperature of 2850°K; and the H light source has a color temperature of 2300°K.
  • the nine light sources can be called standard light sources.
  • D75 light source, D65 light source, D55 light source and D50 light source can be classified as high color temperature light source, CWF light source, TL84 light source and U30 light source can be classified as medium color temperature light source, A light source and H light source. Can be classified as a low color temperature source.
  • the R/G value of the pixel is the ratio of the red R value of the pixel to the green G value
  • the B/G value is the blue B value and the green G value of the pixel, and the values of the R value, the B value, and the G value.
  • the range can be from 0 to 255.
  • color information in the present application may be represented by R/G value and B/G value, or may be represented by Cb and Cr in the YCbCr color space, or by using U and V in the YUV color space. It is indicated that this application does not specifically limit the manner in which color information is represented.
  • each threshold in the present application may be determined according to the description of the present application without any creative work, and the same threshold may be different values to solve the technology to be solved by the present application.
  • the problem is that the present application does not specifically limit the value of each threshold.
  • FIG. 1 is a flowchart of an embodiment of an image processing method provided by the present application, and the method may specifically include the following steps.
  • step 101 the target image is divided into at least two blocks.
  • the target image may be divided into n*m blocks, where n may represent the number of rows of the block, m may represent the number of columns of the block, and each block includes at least one pixel.
  • Step 102 Determine at least one block group from the at least two blocks, and each of the block groups in the at least one block group displays materials of the same material.
  • the R/G values of the pixels in the area where the material is the same in the image are similar, the B/G values are similar, and the brightness values are similar, so it can be determined according to the R/G value, B/G value and brightness value of each block.
  • the area where the same object is located to get the block group For example, in the effect diagram of the block group shown in FIG. 2, two block groups are displayed (blocks in different block groups in FIG. 2 are represented by wire frames of different gray scales), each The objects displayed in each block in the block group are the same material. Each block in the same block group may not be adjacent, and the same block may belong to different block groups.
  • the R/G value of each block is the ratio of the R value to the G value of the block
  • the B/G value of each block is the ratio of the B value to the G value of the block.
  • the R value of each block is the average of the R values of the pixels included in the block
  • the B value of each block is the average of the B values of the pixels included in the block
  • each block The luminance value is the average of the luminance values of the pixels included in the block.
  • the specific process of determining a block group may include the following sub-steps.
  • Sub-step 11 determining a position point of each block in a three-dimensional image coordinate system, the coordinate values of the position points are a first R/G value, a first B/G value, and a brightness value of each block, respectively.
  • each area can be determined in the three-dimensional image coordinate system whose coordinate axes are the R/G value axis, the B/G value axis, and the brightness value axis, respectively.
  • the position point of the block can be determined based on the distance between the respective position points to determine the R/G value, the B/G value, and the block whose luminance values are respectively close.
  • the value of the brightness value may be large, for example, the value range of the R/G value and the B/G value is 0-5, and the brightness value may be It is a hundred values, so the brightness value can be normalized, and the brightness value is limited to the range of R/G value and B/G value to improve the accuracy of data processing.
  • Sub-step 12 determining at least two reference points in the three-dimensional image coordinate system, and classifying the position points of each block into a group to which one of the at least two reference points belongs to obtain at least two a first location point group, wherein each of the at least two reference points is a center of gravity of all the location points in the first location point group to which each reference point belongs.
  • the number of the first location point groups may be set in advance, and may be, for example, a value of 1, 2, or 3.
  • the number of reference points used for grouping may be determined first, and the number of reference points is the same as the number of the first location point groups.
  • the R/G value of the center of gravity of each first location point group is an average value of the R/G values of the location points included in the first location point group
  • the B/G value of the center of gravity of each first location point group is The average value of the B/G values of the position points included in the first position point group
  • the brightness value of the center of gravity of each of the first position point groups is the average value of the brightness values of the position points included in the first position point group.
  • the application can determine the first location point group by using k-means clustering algorithm, k-modes clustering algorithm, and robust clustering using links (ROCK) algorithm, wherein k-means clustering is used.
  • the process of grouping the location points to obtain at least two first location point groups may include: randomly selecting at least two reference points in the three-dimensional image coordinate system; and locating the location of each block Entering into a group to which a reference point closest to the position point of each block belongs to obtain at least two second location point groups; if each of the at least two second location point groups is in a second position point group The center of gravity coincides with the reference point in each of the second location point groups, and then the each second location point group is determined to be the first location point group; if the at least two second location point groups are any If the center of gravity of the second location point group does not coincide with the reference point of any of the second location point groups, the center of gravity of each of the second location point groups is used as a new reference point, and the new reference is utilized.
  • two reference points may be randomly selected in the three-dimensional image coordinate system, respectively, as the reference point a and the reference point b, and the position closer to the reference point a is classified into the second position point group A, and the distance reference is used.
  • the position point closer to the point b is classified into the second position point group B, and then the center of gravity of the second position point group A and the center of gravity of the second position point group B are determined, if the center of gravity of the second position point group A and the reference point a If the center of gravity of the second position point group A does not coincide with the reference point b, the center of gravity of the second position point group A and the center of gravity of the second position point group B are re-grouped as a new reference point until each The center of gravity of the two-position point group coincides with the reference point of each of the second position point groups, and the two second position point groups obtained at this time are the first position point group to be determined, and the pair shown in FIG.
  • the effect map after the grouping is performed is described as an example
  • the number of the first location point groups in the present application may also be set to one.
  • all the location points may be classified into the first location point group, and the first location point group may be
  • the center of gravity is the center of gravity of all the points in the target image. This application does not specifically limit the number of points in the first position.
  • the R/G values of the respective position points closer to the center of gravity of the first position point group are closer, the B/G values are closer, and the brightness values are closer, and the position points correspond to
  • the object displayed on the block has the same probability of the same material, so the target group can be determined near the center of gravity of the first point group, and the object corresponding to the position point included in the target group has the same material.
  • the process of determining the target group is as follows.
  • Sub-step 13 determining a target group in the at least one first location point group, wherein a center of gravity of each of the first location point groups is located in a target group in each of the first location point groups, each of the target groups The position centers of the plurality of location points in the target group are not greater than the distance threshold from the first location point group to which each of the target groups belongs.
  • one target group may be separately determined in each first location point group to obtain a plurality of target groups, or one first location point group may be selected, in the first location.
  • a target group is determined in the point group to obtain a target group. This application does not specifically limit the number of target groups obtained.
  • a spherical target group may be established centering on a center of gravity of each of the at least two first location point groups in the three-dimensional image coordinate system; if the target is When the radius of each target group in the group is the first radius threshold, the number of the location points in each target group is not less than the quantity threshold, and the radius of each target group is set as the first radius a threshold; if the number of location points in each target group is less than the number threshold when the radius of each target group in the target group is a first radius threshold, then each target group is increased The radius until the number of position points in each target group is not less than the number threshold, and the increased radius is not greater than the second radius threshold.
  • D is two in R / G and B / G
  • Each gray card image is an image obtained by photographing a gray card having no color under each standard light source.
  • the color information of each gray card image includes an R/G value and a B/G value, and the R value, the B value, and the G value used to calculate the R/G value and the B/G value may be respectively for each gray card image.
  • the two spheres shown by C1 and C2 in FIG. 4 represent the two target groups obtained.
  • the position points in each target group are concentrated, the distance between each position point is short, and the R/G value, B/G value, and brightness value of each position point are relatively similar, so each target group is
  • the blocks corresponding to the location points within can form a corresponding block group.
  • the distance threshold may be a second radius threshold. It should be noted that the shape of the target group may be a square, a rectangle, a cylinder, or the like, and the shape of the target group is not specifically limited herein.
  • Sub-step 14 the block group corresponding to each target group is determined, and each block group corresponding to each target group includes a block corresponding to at least one position point in each target group.
  • the block corresponding to all the position points in each target group may be used to form the block. group.
  • the target image may include blocks with a strong color (dark color), so a block with a stronger color may be composed of blocks with stronger color, and a block with a stronger color may affect the compensation effect.
  • the determination affects the selection of the target compensation table, so in sub-step 11, the position of each block in the three-dimensional image coordinate system is determined, and the coordinate values of the position points are the first R/ of each block respectively.
  • the block that is used to form the block group to be closer to white, that is, the effective block may be determined.
  • the specific steps of determining the effective block may include: determining a standard light source point of each standard light source and a block point of each block in a two-dimensional coordinate system of R/G and B/G; determining each block point distance from each standard The distance of the light source point; determining the effective block, the distance of the block point of the effective block from the at least one standard light source point is not greater than the preset distance value.
  • the process of determining the standard light source point of each standard light source may be: first calculating the average value of the R value of the pixel points included in the gray card image obtained under each standard light source, the average value of the G value, and the average value of the B value.
  • the R/G value of each standard light source point is the ratio of the average value of the R value to the average value of the G value
  • the B/G value of each standard light source point is the average of the B value and the average value of the G value. The ratio is then determined in the two-dimensional coordinate system of R/G and B/G to determine the position of each standard source point.
  • FIG. 5 is a schematic diagram of the distribution of standard light source points and block points in a two-dimensional coordinate system of R/G and B/G provided by the present application.
  • the larger dots in Figure 5 represent nine standard source points, and the smaller points represent individual block points.
  • the distance between the block points in the dotted line range and the at least one standard light source point is not greater than the preset distance value, so the block group can be determined from the block corresponding to the block point within the dotted line range, that is, the effective block.
  • the process of determining the block group from the effective block is similar to the process described in the above sub-step 11 to sub-step 14, and details are not described herein again.
  • Step 103 Perform pre-compensation on the at least one block group by using at least two compensation tables to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as the target compensation table.
  • a corresponding compensation table may be set in advance for the light sources of different color temperatures.
  • each compensation table may be pre-compensated, and then the color difference degree of the pre-compensated image is used to evaluate each The compensation effect of the compensation table is obtained, so that the compensation effect is better, that is, the compensation table with a lower degree of color difference of the pre-compensated image is determined as the target compensation table for adjusting the image with color shading phenomenon.
  • the specific process of setting the compensation table in advance may be: firstly, the gray card image under the preset color temperature of the light source is divided into a plurality of blocks, and the method of dividing the gray card image into the block is the same as the method of dividing the block into the target image.
  • the gray card image is divided into n*m blocks, and each block in the gray card image can correspond to each block in the target image; calculating the R value and the B value of each block in the gray card image and
  • the value of G, the R value of each block in the gray card image may be an average value of the R values of the pixels included in the block, and the G value of each block may be the G of the pixel included in the block.
  • the average value of the value, the B value of each block may be the average value of the B values of the pixel points included in the block; the red color of each block is determined according to the R value, the G value and the B value of each block Channel gain (R-gain), green channel gain (G-gain), and blue channel gain (B-gain) to obtain a compensation table, the information in the compensation table including each block in the gray card image R-gain, G-gain, and B-gain.
  • G-gain is 1
  • R-gain is the ratio of the G value of the block to the R value
  • B-gain is the ratio of the G value of the block to the B value.
  • the R compensation value of each pixel in the target image may be calculated by using R-gain of a plurality of corresponding blocks, and the red R value of the pixel point is multiplied by The R compensation value gives the R value of the pre-compensated pixel.
  • the process of obtaining the G value and the B value of the pre-compensated pixel is similar to the process of obtaining the R value of the pre-compensated pixel, and will not be described herein.
  • the process of separately compensating the at least one block group using at least two compensation tables to obtain a color difference value corresponding to each compensation table may include the following sub-steps.
  • Sub-step 21 pre-compensating each block in each block group with at least two compensation tables to obtain a second R/G value and a second B/G value of each block in each block group.
  • the second R/G value may be a ratio of the R value of the pre-compensated block to the G value
  • the second B/G value may be a ratio of the B value to the G value of the pre-compensated block.
  • Sub-step 22 determining an R/G difference value of each block group according to a second R/G value of each block in each block group, according to each block in each block group
  • the second B/G value determines the B/G difference value for each of the block groups.
  • the expression of the R/G difference value may be:
  • R/G_DV j (
  • R/G_DV j is the R/G difference value of the j-th block group in all block groups
  • C_R/G i is the second R/G of the i-th block in the j-th block group.
  • P is the number of blocks in the j-th block group
  • Avg_C_R/G is the average value of the second R/G values of all the blocks in the j-th block group.
  • the expression of the B/G difference value may be:
  • B/G_DV j (
  • B/G_DV j is the B/G difference value of the j-th block group in all block groups
  • C_B/G i is the second B/G of the i-th block in the j-th block group
  • Avg_C_B/G is the average of the second R/G values of all the blocks in the j-th block group.
  • Sub-step 23 determining, according to the R/G difference value and the B/G difference value of each block group, a color difference value corresponding to each pre-compensation table, and a color difference corresponding to each pre-compensation table
  • the value is the sum of the average of the R/G difference values of all block groups and the average of the B/G difference values of all block groups.
  • the larger the number of blocks in each block group and the space size of the target group may be different, the larger the number of blocks, the larger the area of the area where the same material is located, the more representative, but the space of the target group.
  • the larger the size the greater the difference between the R/G value, the B/G value and the brightness value between the blocks, and the less the representative is the same material, so the color difference value corresponding to each pre-compensation table can be all areas.
  • the weighted average of the R/G difference values of the block group and the weighted average of the B/G difference values of all block groups are examples of all block groups.
  • R/G_TDV (R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
  • R/G_TDV represents the weighted average of the R/G difference values of all block groups
  • R/G_DV j is the R/G difference value of the jth block group in all block groups
  • V j is The spatial size value of the target group corresponding to the jth block group
  • N j is the number of blocks in the jth block group
  • K is the number of all block groups.
  • B/G_TDV (B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
  • B/G_TDV represents the weighted average of the B/G difference values of all block groups
  • B/G_DV j is the B/G difference value of the jth block group in all block groups.
  • the compensation table can be more comprehensively evaluated by using the weighted average of the R/G difference values of all the block groups and the weighted average of the B/G difference values of all the block groups to represent the color difference values corresponding to the compensation table.
  • the compensation effect improves the accuracy of the selected target compensation table.
  • the compensation table is used to pre-compensate the RGB values of each block of each block group in the target image to determine each The second R/G value of the block; the R/G difference value of each block group is calculated according to the expression of the R/G difference value; the weighted average of the R/G difference values of all the block groups described above The expression of the value, the weighted average of the R/G difference values of all the block groups is calculated; the B/ of all the block groups is calculated by calculating the weighted average of the R/G difference values of all the block groups.
  • Step 104 Perform color compensation on the target image according to the target compensation table.
  • the R value, the B value, and the G value that need to be adjusted for each pixel in the target image may be determined according to the information in the target compensation table, and it is determined that each pixel needs to be adjusted.
  • the process of the R value, the B value, and the G value is similar to the process of the above precompensation, and will not be described herein.
  • the R value, the B value and the G value of each pixel in the target image are adjusted accordingly to complete the color compensation of the target image.
  • This application uses the compensation table to pre-compensate the same block of objects in the image.
  • the color difference value corresponding to the compensation table can accurately select the target compensation table corresponding to the color temperature of the light source in the photographing environment, so as to accurately correct the image with color shading phenomenon.
  • the application can also determine the color temperature of the light source in the photographing environment according to the target compensation table, and the color temperature information of the light source can be used to adjust the position of the white point calculated by the AWB algorithm, so that the image processing according to the white point position is more accurate.
  • FIG. 7 is a structural block diagram of an embodiment of an image processing apparatus provided by the present application.
  • the apparatus may be configured in a photographing device or a photographing device itself.
  • the device may include: a dividing unit 701, and a first determining unit 702.
  • the second determining unit 703 is a compensation unit 704.
  • the dividing unit 701 is configured to divide the target image into at least two blocks.
  • the first determining unit 702 is configured to determine, from the at least two blocks, at least one block group, and each of the block groups in the at least one block group exhibits the same material material.
  • the second determining unit 703 is configured to pre-compensate the at least one block group with at least two compensation tables to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as a target compensation. table.
  • the compensation unit 704 is configured to perform color compensation on the target image according to the target compensation table.
  • the first determining unit 702 is specifically configured to: determine a location point of each block in a three-dimensional image coordinate system, where the coordinate value of the location point is a first R/G value of each block, respectively a B/G value and a brightness value; determining at least two reference points in the three-dimensional image coordinate system, and classifying a position point of each block into a group to which one of the at least two reference points belongs Obtaining at least two first location point groups, each of the at least two reference points being a center of gravity of all location points in the first location point group to which each reference point belongs; in at least one first location Determining a target group in a point group, wherein a center of gravity of each of the first location point groups is located in a target group in each of the first location point groups, and each of the target groups in the target group is distance from the target point The center of gravity of the first location point group to which each target group belongs is not greater than the distance threshold; the block group corresponding to each target group is determined, and each block
  • the first determining unit 702 is further configured to: classify a location point of each block into a group to which a reference point closest to the location point of each block belongs to obtain at least two second a location point group; if each of the at least two second location point groups has a center of gravity coincident with a reference point in each of the second location point groups, determining each of the second The location point group is a first location point group; if the center of gravity of any of the at least two second location point groups does not coincide with the reference point in any of the second location point groups, The center of gravity of each of the second location point groups is used as a new reference point, and each of the location points is grouped by the new reference point to obtain the first location point group.
  • the second determining unit 703 is specifically configured to: pre-compensate each block in each block group by using at least two compensation tables to obtain a second R/G of each block in each block group. And a second B/G value; determining an R/G difference value of each block group according to a second R/G value of each block in each block group, according to each block The second B/G value of each block in the group determines a B/G difference value of each block group; determining the location according to the R/G difference value and the B/G difference value of each block group a color difference value corresponding to each pre-compensation table, wherein the color difference value corresponding to each pre-compensation table is an average value of R/G difference values of all block groups and a B/G difference value of all block groups. The sum of the averages.
  • R/G_DV j (
  • R/G_DV j is the R/G difference value of the j-th block group in all block groups
  • C_R/G i is the second R/G of the i-th block in the j-th block group.
  • P is the number of blocks in the j-th block group
  • Avg_C_R/G is the average value of the second R/G values of all the blocks in the j-th block group.
  • B/G_DV j (
  • B/G_DV j is the B/G difference value of the j-th block group in all block groups
  • C_B/G i is the second B/G of the i-th block in the j-th block group
  • Avg_C_B/G is the average of the second R/G values of all the blocks in the j-th block group.
  • the color difference value corresponding to each of the pre-compensation tables is a sum of a weighted average value of R/G difference values of all block groups and a weighted average value of B/G difference values of all block groups.
  • R/G_TDV (R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
  • R/G_TDV represents the weighted average of the R/G difference values of all block groups
  • R/G_DV j is the R/G difference value of the jth block group in all block groups
  • V j is the said The spatial size value of the target group corresponding to the j block groups
  • N j is the number of blocks in the jth block group
  • K is the number of all block groups
  • B/G_TDV (B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
  • B/G_TDV represents the weighted average of the B/G difference values of all block groups
  • B/G_DV j is the B/G difference value of the jth block group in all block groups.
  • the image processing apparatus pre-compensates the block group having the same object material in the image by using each compensation table, and obtains the color difference value corresponding to each compensation table, so that the target corresponding to the color temperature of the light source in the photographing environment can be accurately selected.
  • FIG. 8 is a structural block diagram of another embodiment of an image processing apparatus provided by the present application, which includes a processor 801, a memory 802, and a bus system 803.
  • the processor 801 and the memory 802 are connected by a bus system 803 for storing instructions for executing instructions stored by the memory 802.
  • the memory 802 of the image processing apparatus stores the program code, and the processor 801 can call the program code stored in the memory 802 to perform the following operations: dividing the target image into at least two blocks; determining at least from the at least two blocks a block group, wherein each of the block groups in the at least one block group exhibits the same material material; and the at least one block group is pre-compensated using at least two compensation tables to obtain a color difference value corresponding to each compensation table, a compensation table that minimizes the color difference value is determined as a target compensation table; and the target image is color-compensated according to the target compensation table.
  • the image processing apparatus pre-compensates the block group having the same object material in the image by using each compensation table, and obtains the color difference value corresponding to each compensation table, so that the target corresponding to the color temperature of the light source in the photographing environment can be accurately selected.
  • the processor 801 may be a central processing unit (“CPU"), and the processor 801 may also be other general-purpose processors, digital signal processors (DSPs), dedicated Integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc.
  • the general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
  • the memory 802 can include read only memory and random access memory and provides instructions and data to the processor 801. A portion of the memory 802 may also include a non-volatile random access memory. For example, the memory 802 can also store information of the device type.
  • the bus system 803 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus.
  • each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 801 or an instruction in a form of software.
  • the steps of the method disclosed in the embodiments of the present invention may be directly implemented as a hardware processor, or may be performed by a combination of hardware and software modules in the processor.
  • the software modules can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
  • the storage medium is located in memory 802, and processor 801 reads the information in memory 802 and, in conjunction with its hardware, performs the steps of the above method. To avoid repetition, it will not be described in detail here.
  • the present application also provides a computer readable storage medium, wherein the computer readable storage medium can store instructions that, when executed on a computer, cause the computer to perform portions of the various embodiments of the method provided by the present invention or All steps.
  • the readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
  • the present application also provides a computer program product comprising instructions which, when executed on a computer, cause the computer to perform some or all of the steps in the above-described embodiments of the method provided by the present invention.
  • the present application also provides a chip that includes a processor and/or program instructions that, when executed, implement the method of the embodiment illustrated in FIG. 1 of the present application.

Abstract

Provided are an image processing method and device. The method comprises: dividing a target image into at least two blocks; determining at least one block group from the at least two blocks, wherein the materials of objects presented in various blocks in each block group of the at least one block group are the same; using at least two compensation tables to respectively perform pre-compensation on the at least one block group to obtain a color difference value corresponding to each compensation table, and determining a compensation table with the minimum color difference value to be a target compensation table; and performing color compensation on the target image according to the target compensation table. By means of the present application, a target compensation table corresponding to a light source color temperature in a photographing environment can be selected more accurately so as to accurately correct an image having a color shading phenomenon.

Description

一种图像处理方法及装置Image processing method and device
本申请要求在2018年1月12日提交中国专利局、申请号为201810031621.4、发明名称为“一种图像处理方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 20181003162, filed on Jan. 12, 2018, the entire disclosure of which is incorporated herein by reference. .
技术领域Technical field
本申请涉及图像处理技术领域,尤其是涉及一种图像处理方法和图像处理装置。The present application relates to the field of image processing technologies, and in particular, to an image processing method and an image processing apparatus.
背景技术Background technique
位偏色差(color shading)为使用拍照设配,例如手机或相机拍照时图像会出现的现象,其表现为图像中心区域偏红,四周偏绿。造成color shading现象是由贴在感光元件上的红外截止滤光片(IR cut filter)的物理特性引起的。IR cut filter对于波长较长的红色光的透射度会因入射角的增加而减小,图像中心区域的红色光入射角较小,四周的红色光入射角较大,进入图像中心区域的红色光多于进入图像四周的红色光,所以图像中心区域偏红,四周偏绿。Color shading is a phenomenon in which an image is displayed when a photograph is taken, such as a cell phone or a camera. The image is reddish in the center of the image and greenish around. The color shading phenomenon is caused by the physical properties of an IR cut filter attached to the photosensitive member. The IR cut filter reduces the transmittance of red light with a longer wavelength due to the increase of the incident angle. The incident angle of the red light in the center of the image is smaller, the incident angle of the red light around the image is larger, and the red light entering the central region of the image More than the red light entering the image, so the center of the image is reddish and the area is green.
由于不同色温的光源的红色光强度不同,拍照环境下不同色温的光源决定了color shading的程度,所以可以利用自动白平衡(auto white balance,AWB)算法计算拍照环境下的光源色温,再利用当前的光源色温对应的color shading补偿表对预览图像的RBG值进行补偿,从而调整预览图像出现的color shading现象,以防止拍摄出的照片出现该现象。利用AWB算法计算拍照环境下的光源色温的具体过程是,首先确定预览图像中各个像素点的色彩信息,该色彩信息包括像素点的R/G值以及B/G值,再利用预览图像中各个像素点的色彩信息计算拍照环境下的光源色温。Since the red light intensity of the light source of different color temperature is different, the light source of different color temperature in the photographing environment determines the degree of color shading, so the auto white balance (AWB) algorithm can be used to calculate the color temperature of the light source in the photographing environment, and then the current color is utilized. The color shading compensation table corresponding to the color temperature of the light source compensates the RBG value of the preview image, thereby adjusting the color shading phenomenon of the preview image to prevent the phenomenon from occurring in the photograph taken. The specific process of calculating the color temperature of the light source in the photographing environment by using the AWB algorithm is to first determine the color information of each pixel in the preview image, the color information includes the R/G value and the B/G value of the pixel, and then use each of the preview images. The color information of the pixel calculates the color temperature of the light source in the photographing environment.
但是,由于AWB算法是利用图像的色彩信息确定的光源色温,而图像中物体的原本颜色会引起对光源色温的误判。例如高色温的光源在图像中的色彩偏向淡蓝色,如果图像中存在淡蓝色的物体,则容易将当前的光源色温误判为高色温,从而导致无法准确选取补偿表,也就无法准确地调整图像的color shading现象。However, since the AWB algorithm is the color temperature of the light source determined by the color information of the image, the original color of the object in the image causes a misjudgment of the color temperature of the light source. For example, the color of the light source with high color temperature is light blue in the image. If there is a light blue object in the image, it is easy to misjudge the current color temperature of the light source as a high color temperature, which may result in the inability to accurately select the compensation table. Adjust the color shading phenomenon of the image.
发明内容Summary of the invention
本申请提供了一种图像处理方法及装置,用于解决现有图像处理方法无法准确选取color shading补偿表,进而无法准确地调整图像的color shading现象的问题。The present application provides an image processing method and apparatus for solving the problem that the existing image processing method cannot accurately select the color shading compensation table, and thus cannot accurately adjust the color shading phenomenon of the image.
第一方面,本申请提供了一种图像处理方法,该方法包括以下步骤:将目标图像划分为至少两个区块;从所述至少两个区块中确定至少一个区块群,所述至少一个区块群中每个区块群中各个区块所展示的物体材质均相同;使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表;根据所述目标补偿表对所述目标图像进行色彩补偿。In a first aspect, the present application provides an image processing method, the method comprising the steps of: dividing a target image into at least two blocks; determining at least one block group from the at least two blocks, the at least The materials displayed by each block in each block group of one block group are the same; the at least one block group is pre-compensated by using at least two compensation tables to obtain the color difference corresponding to each compensation table. a value, the compensation table that minimizes the color difference value is determined as a target compensation table; and the target image is color-compensated according to the target compensation table.
本申请通过使用各个补偿表对图像中物体材质相同的区块群进行预补偿,得到各个补偿表对应的色彩差异值,能够较准确地选出拍照环境下的光源色温对应的目标补偿表,以 用于准确修正具有color shading现象的图像。The present invention pre-compensates the block group with the same object material in the image by using each compensation table, and obtains the color difference value corresponding to each compensation table, so that the target compensation table corresponding to the color temperature of the light source in the photographing environment can be accurately selected, Used to accurately correct images with color shading.
结合第一方面,在第一方面的第一种实现方式中,所述从所述至少两个区块中确定至少一个区块群包括:确定每个区块在三维图像坐标系中的位置点,所述位置点的坐标值分别为每个区块的第一R/G值、第一B/G值以及亮度值;在所述三维图像坐标系中确定至少两个基准点,并将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置点群,所述至少两个基准点中每个基准点为所述每个基准点所属的第一位置点群中所有位置点的重心;在至少一个第一位置点群中确定目标群,所述每个第一位置点群的重心位于所述每个第一位置点群中的目标群内,所述目标群中每个目标群中各个位置点距离所述每个目标群所属的第一位置点群的重心不大于距离阈值;确定所述每个目标群对应的区块群,所述每个目标群对应的每个区块群包括所述每个目标群中至少一个位置点对应的区块。In conjunction with the first aspect, in a first implementation of the first aspect, the determining the at least one block group from the at least two blocks comprises: determining a location point of each block in a three-dimensional image coordinate system The coordinate values of the position points are respectively a first R/G value, a first B/G value, and a brightness value of each block; at least two reference points are determined in the three-dimensional image coordinate system, and each Position points of the blocks are classified into a group to which one of the at least two reference points belongs to obtain at least two first position point groups, and each of the at least two reference points is the each a center of gravity of all the location points in the first location point group to which the reference point belongs; determining a target group in the at least one first location point group, where the center of gravity of each of the first location point groups is located at each of the first location points Within the target group in the group, each of the target points in the target group is separated from the first location point group to which the target group belongs to a distance threshold; the distance corresponding to each target group is determined. Block group, each block corresponding to each target group Each group comprising at least one target point corresponding to the position of the block.
结合第一方面的第一种实现方式,在第一方面的第二种实现方式中,所述将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置点群包括:将每个区块的位置点归入距离所述每个区块的位置点最近的一个基准点所属的群中以得到至少两个第二位置点群;如果所述至少两个第二位置点群中每个第二位置点群的重心均与所述每个第二位置点群中的基准点重合,则确定所述每个第二位置点群为第一位置点群;如果所述至少两个第二位置点群中任一第二位置点群的重心与所述任一第二位置点群中的基准点不重合,则以所述每个第二位置点群的重心作为新的基准点,利用所述新的基准点对各个所述位置点进行分群,以得到所述第一位置点群。In conjunction with the first implementation of the first aspect, in a second implementation manner of the first aspect, the location point of each block is classified into a group to which one of the at least two reference points belongs Obtaining at least two first location point groups includes: classifying a location point of each tile into a group to which a reference point closest to a location point of each block belongs to obtain at least two second location points Determining each of the second location points if a center of gravity of each of the at least two second location point groups coincides with a reference point in each of the second location point groups The group is a first location point group; if the center of gravity of any of the at least two second location point groups does not coincide with the reference point in any of the second location point groups, The center of gravity of each second location point group is used as a new reference point, and each of the location points is grouped by the new reference point to obtain the first location point group.
结合第一方面的第一种实现方式,在第一方面的第三种实现方式中,所述在至少一个第一位置点群中确定目标群,包括:在所述三维图像坐标系中,以所述至少两个第一位置点群中每个第一位置点群的重心为中心建立球形的目标群;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数不小于数量阈值,则将所述每个目标群的半径设置为所述第一半径阈值;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数小于所述数量阈值,则增大所述每个目标群的半径直至所述每个目标群中的位置点的个数不小于所述数量阈值,增大后的所述半径不大于第二半径阈值。In conjunction with the first implementation of the first aspect, in a third implementation manner of the first aspect, the determining the target group in the at least one first location point group includes: in the three-dimensional image coordinate system, a center of gravity of each of the at least two first location point groups is a spherical target group; if the radius of each target group in the target group is a first radius threshold, If the number of location points in each target group is not less than a quantity threshold, the radius of each target group is set as the first radius threshold; if the radius of each target group in the target group is the first a radius threshold, the number of location points in each target group is less than the number threshold, and the radius of each target group is increased until the number of location points in each target group is not Less than the number threshold, the increased radius is not greater than the second radius threshold.
结合第一方面的第三种实现方式,在第一方面的第四种实现方式中,所述第一半径阈值R min=(1/5)*D,所述第二半径阈值R max=D,其中,D为在R/G与B/G的二维坐标系中D65标准光源下得到的灰卡图像的色彩信息对应的点与D50标准光源下得到的灰卡图像的色彩信息对应的点之间的距离。 In conjunction with the third implementation of the first aspect, in a fourth implementation of the first aspect, the first radius threshold R min = (1/5) * D, the second radius threshold R max = D Where D is the point corresponding to the color information of the gray card image obtained under the D65 standard light source in the two-dimensional coordinate system of R/G and B/G and the color information of the gray card image obtained under the D50 standard light source the distance between.
结合第一方面,第一方面的第一种至第四种的实现方式中任一种实现方式,在第一方面的第五种实现方式中,所述使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值包括:使用至少两个补偿表分别对每个区块群中各个区块进行预补偿以得到每个区块群中各个区块的第二R/G值以及第二B/G值;根据所述每个区块群中各个区块的第二R/G值确定所述每个区块群的R/G差异值,根据所述每个区块群中各个区块的第二B/G值确定所述每个区块群的B/G差异值;根据所述每个区块群的R/G差异值以及B/G差异值,确定所述每个预补偿表对应的色彩差异值,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的平均值与所有区块群的B/G差异值的平均值 之和。With reference to the first aspect, any one of the first to fourth implementation manners of the first aspect, in a fifth implementation manner of the first aspect, the using at least two compensation tables respectively Performing pre-compensation of at least one block group to obtain a color difference value corresponding to each compensation table includes: pre-compensating each block in each block group by using at least two compensation tables to obtain each block group a second R/G value of the block and a second B/G value; determining an R/G difference value of each block group according to a second R/G value of each block in each block group Determining, according to the second B/G value of each block in each block group, a B/G difference value of each block group; according to the R/G difference value of each block group and a B/G difference value, the color difference value corresponding to each of the pre-compensation tables is determined, and the color difference value corresponding to each pre-compensation table is an average value of all R/G difference values of all block groups and all blocks The sum of the average values of the B/G difference values of the group.
结合第一方面的第五种实现方式,在第一方面的第六种实现方式中,所述R/G差异值的表达式为:With reference to the fifth implementation manner of the first aspect, in the sixth implementation manner of the first aspect, the expression of the R/G difference value is:
R/G_DV j=(|C_R/G 1-Avg_C_R/G|+|C_R/G 2-Avg_C_R/G|+…+|C_R/G P-Avg_C_R/G|)/P R/G_DV j =(|C_R/G 1 -Avg_C_R/G|+|C_R/G 2 -Avg_C_R/G|+...+|C_R/G P -Avg_C_R/G|)/P
其中,R/G_DV j为所有区块群中第j个区块群的R/G差异值,C_R/G i为所述第j个区块群中第i个区块的第二R/G值,P为所述第j个区块群中区块的个数,Avg_C_R/G为所述第j个区块群中所有区块的第二R/G值的平均值; Where R/G_DV j is the R/G difference value of the j-th block group in all block groups, and C_R/G i is the second R/G of the i-th block in the j-th block group. a value, P is the number of blocks in the j-th block group, and Avg_C_R/G is an average value of second R/G values of all blocks in the j-th block group;
所述B/G差异值的表达式为:The expression of the B/G difference value is:
B/G_DV j=(|C_B/G 1-Avg_C_B/G|+|C_B/G 2-Avg_C_B/G|+…+|C_B/G P-Avg_C_B/G|)/P B/G_DV j =(|C_B/G 1 -Avg_C_B/G|+|C_B/G 2 -Avg_C_B/G|+...+|C_B/G P -Avg_C_B/G|)/P
其中,B/G_DV j为所有区块群中第j个区块群的B/G差异值,C_B/G i为所述第j个区块群中第i个区块的第二B/G值,Avg_C_B/G为所述第j个区块群中所有区块的第二R/G值的平均值。 Where B/G_DV j is the B/G difference value of the j-th block group in all block groups, and C_B/G i is the second B/G of the i-th block in the j-th block group The value, Avg_C_B/G, is the average of the second R/G values of all the blocks in the j-th block group.
结合第一方面的第五种实现方式,在第一方面的第七种实现方式中,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的加权平均值与所有区块群的B/G差异值的加权平均值之和;With reference to the fifth implementation manner of the first aspect, in a seventh implementation manner of the first aspect, the color difference value corresponding to each pre-compensation table is a weighted average value of R/G difference values of all block groups. The sum of the weighted average of the B/G difference values for all block groups;
所有区块群的R/G差异值的加权平均值的表达式为:The expression for the weighted average of the R/G difference values for all block groups is:
R/G_TDV=(R/G_DV 1*V 1/N 1+R/G_DV 2*V 2/N 2+…+R/G_DV K*V K/N K)/K R/G_TDV=(R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
其中,R/G_TDV表示所有区块群的R/G差异值的加权平均值,R/G_DV j为所有区块群中第j个区块群的R/G差异值,V j为所述第j个区块群对应的目标群的空间大小值,N j为所述第j个区块群中区块的个数,K为所有区块群的个数; Where R/G_TDV represents the weighted average of the R/G difference values of all block groups, and R/G_DV j is the R/G difference value of the jth block group in all block groups, and V j is the said The spatial size value of the target group corresponding to the j block groups, N j is the number of blocks in the jth block group, and K is the number of all block groups;
所有区块群的B/G差异值的加权平均值的表达式为:The expression for the weighted average of the B/G difference values for all block groups is:
B/G_TDV=(B/G_DV 1*V 1/N 1+B/G_DV 2*V 2/N 2+…+B/G_DV K*V K/N K)/K B/G_TDV=(B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
其中,B/G_TDV表示所有区块群的B/G差异值的加权平均值,B/G_DV j为所有区块群中第j个区块群的B/G差异值。 Where B/G_TDV represents the weighted average of the B/G difference values of all block groups, and B/G_DV j is the B/G difference value of the jth block group in all block groups.
在该实现方式中,通过使用所有区块群的R/G差异值的加权平均值与所有区块群的B/G差异值的加权平均值之和表示补偿表对应的色彩差异值,能够更加全面地评估各个补偿表的补偿效果,从而提高选取目标补偿表的准确性。In this implementation, it is possible to represent the color difference value corresponding to the compensation table by using the weighted average of the R/G difference values of all the block groups and the weighted average of the B/G difference values of all the block groups. Comprehensively evaluate the compensation effect of each compensation table, thereby improving the accuracy of selecting the target compensation table.
第二方面,本申请还提供了一种图像处理装置,该装置可以配置在拍照设备中或为拍照设备本身,该装置包括:划分单元,用于将目标图像划分为至少两个区块;第一确定单元,用于从所述至少两个区块中确定至少一个区块群,所述至少一个区块群中每个区块群中各个区块所展示的物体材质均相同;第二确定单元,用于使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表;补偿单元,用于根据所述目标补偿表对所述目标图像进行色彩补偿。In a second aspect, the present application further provides an image processing apparatus, which may be configured in a photographing apparatus or a photographing apparatus itself, the apparatus comprising: a dividing unit, configured to divide the target image into at least two blocks; a determining unit, configured to determine at least one block group from the at least two blocks, wherein each of the block groups in the at least one block group exhibits the same material material; the second determination a unit, configured to pre-compensate the at least one block group by using at least two compensation tables to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as a target compensation table; And performing color compensation on the target image according to the target compensation table.
结合第二方面,在第二方面的第一种实现方式中,所述第一确定单元具体用于:确定每个区块在三维图像坐标系中的位置点,所述位置点的坐标值分别为每个区块的第一R/G值、第一B/G值以及亮度值;在所述三维图像坐标系中确定至少两个基准点,并将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置 点群,所述至少两个基准点中每个基准点为所述每个基准点所属的第一位置点群中所有位置点的重心;在至少一个第一位置点群中确定目标群,所述每个第一位置点群的重心位于所述每个第一位置点群中的目标群内,所述目标群中每个目标群中各个位置点距离所述每个目标群所属的第一位置点群的重心不大于距离阈值;确定所述每个目标群对应的区块群,所述每个目标群对应的每个区块群包括所述每个目标群中至少一个位置点对应的区块。With reference to the second aspect, in a first implementation manner of the second aspect, the first determining unit is specifically configured to: determine a location point of each block in a three-dimensional image coordinate system, where coordinate values of the location points are respectively a first R/G value, a first B/G value, and a brightness value for each block; determining at least two reference points in the three-dimensional image coordinate system, and assigning a position point of each block to the location Deriving a group to which one of the at least two reference points belongs to obtain at least two first location point groups, each of the at least two reference points being a first location point to which each reference point belongs a center of gravity of all the location points in the group; determining a target group in the at least one first location point group, the center of gravity of each of the first location point groups being located in the target group in each of the first location point groups, Each of the target points in each target group in the target group is not greater than a distance threshold from a first location point group to which each target group belongs; determining a block group corresponding to each target group, each of the targets Each block group corresponding to the group includes each of the target groups A block corresponding to at least one location point.
结合第二方面的第一种实现方式,在第二方面的第二种实现方式中,所述第一确定单元还具体用于:将每个区块的位置点归入距离所述每个区块的位置点最近的一个基准点所属的群中以得到至少两个第二位置点群;如果所述至少两个第二位置点群中每个第二位置点群的重心均与所述每个第二位置点群中的基准点重合,则确定所述每个第二位置点群为第一位置点群;如果所述至少两个第二位置点群中任一第二位置点群的重心与所述任一第二位置点群中的基准点不重合,则以所述每个第二位置点群的重心作为新的基准点,利用所述新的基准点对各个所述位置点进行分群,以得到所述第一位置点群。With reference to the first implementation of the second aspect, in a second implementation manner of the second aspect, the first determining unit is further configured to: locate a location point of each block into each of the regions The position point of the block belongs to the group to which the nearest reference point belongs to obtain at least two second location point groups; if the center of gravity of each of the at least two second location point groups is equal to each of the If the reference points in the second location point group coincide, determining that each of the second location point groups is the first location point group; if any of the at least two second location point groups is in the second location point group If the center of gravity does not coincide with the reference point in any of the second location point groups, then the center of gravity of each of the second location point groups is used as a new reference point, and each of the location points is used by the new reference point. Grouping is performed to obtain the first location point group.
结合第二方面的第一种实现方式,在第二方面的第三种实现方式中,所述第一确定单元还具体用于:在所述三维图像坐标系中,以所述至少两个第一位置点群中每个第一位置点群的重心为中心建立球形的目标群;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数不小于数量阈值,则将所述每个目标群的半径设置为所述第一半径阈值;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数小于所述数量阈值,则增大所述每个目标群的半径直至所述每个目标群中的位置点的个数不小于所述数量阈值,增大后的所述半径不大于第二半径阈值;其中,所述第一半径阈值R min=(1/5)*D,所述第二半径阈值R max=D,其中,D为在R/G与B/G的二维坐标系中D65标准光源下得到的灰卡图像的色彩信息对应的点与D50标准光源下得到的灰卡图像的色彩信息对应的点之间的距离。 With reference to the first implementation of the second aspect, in a third implementation manner of the second aspect, the first determining unit is further configured to: in the three-dimensional image coordinate system, the at least two a target group of a spherical shape centered on a center of gravity of each of the first location point groups in a location point group; and if each of the target group groups has a radius of the first radius threshold, the target group is If the number of the location points is not less than the quantity threshold, the radius of each target group is set as the first radius threshold; if the radius of each target group in the target group is the first radius threshold, If the number of the location points in each target group is less than the quantity threshold, the radius of each target group is increased until the number of location points in each target group is not less than the quantity threshold. The increased radius is not greater than a second radius threshold; wherein the first radius threshold R min = (1/5) * D, the second radius threshold R max = D, where D is at R Gray card image obtained under D65 standard light source in /G and B/G two-dimensional coordinate system The distance between the point corresponding to the color information of gray card image obtained with the D50 standard light color point information corresponding to the next.
结合第二方面,第二方面的第一种至第三种的实现方式中任一种实现方式,在第一方面的第四种实现方式中,所述第二确定单元具体用于:使用至少两个补偿表分别对每个区块群中各个区块进行预补偿以得到每个区块群中各个区块的第二R/G值以及第二B/G值;根据所述每个区块群中各个区块的第二R/G值确定所述每个区块群的R/G差异值,根据所述每个区块群中各个区块的第二B/G值确定所述每个区块群的B/G差异值;根据所述每个区块群的R/G差异值以及B/G差异值,确定所述每个预补偿表对应的色彩差异值,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的平均值与所有区块群的B/G差异值的平均值之和。With reference to the second aspect, any one of the first to third implementation manners of the second aspect, in the fourth implementation manner of the first aspect, the second determining unit is specifically configured to: use at least Two compensation tables respectively pre-compensate each block in each block group to obtain a second R/G value and a second B/G value of each block in each block group; according to each of the blocks The second R/G value of each block in the block group determines an R/G difference value of each block group, and determines the second B/G value according to each block in each block group a B/G difference value of each block group; determining, according to the R/G difference value and the B/G difference value of each block group, a color difference value corresponding to each of the pre-compensation tables, wherein each The color difference values corresponding to the pre-compensation tables are the sum of the average of the R/G difference values of all the block groups and the average value of the B/G difference values of all the block groups.
结合第二方面的第四种实现方式,在第二方面的第五种实现方式中,所述R/G差异值的表达式为:With reference to the fourth implementation manner of the second aspect, in a fifth implementation manner of the second aspect, the expression of the R/G difference value is:
R/G_DV j=(|C_R/G 1-Avg_C_R/G|+|C_R/G 2-Avg_C_R/G|+…+|C_R/G P-Avg_C_R/G|)/P R/G_DV j =(|C_R/G 1 -Avg_C_R/G|+|C_R/G 2 -Avg_C_R/G|+...+|C_R/G P -Avg_C_R/G|)/P
其中,R/G_DV j为所有区块群中第j个区块群的R/G差异值,C_R/G i为所述第j个区块群中第i个区块的第二R/G值,P为所述第j个区块群中区块的个数,Avg_C_R/G为所述第j个区块群中所有区块的第二R/G值的平均值; Where R/G_DV j is the R/G difference value of the j-th block group in all block groups, and C_R/G i is the second R/G of the i-th block in the j-th block group. a value, P is the number of blocks in the j-th block group, and Avg_C_R/G is an average value of second R/G values of all blocks in the j-th block group;
所述B/G差异值的表达式为:The expression of the B/G difference value is:
B/G_DV j=(|C_B/G 1-Avg_C_B/G|+|C_B/G 2-Avg_C_B/G|+…+|C_B/G P-Avg_C_B/G|)/P B/G_DV j =(|C_B/G 1 -Avg_C_B/G|+|C_B/G 2 -Avg_C_B/G|+...+|C_B/G P -Avg_C_B/G|)/P
其中,B/G_DV j为所有区块群中第j个区块群的B/G差异值,C_B/G i为所述第j 个区块群中第i个区块的第二B/G值,Avg_C_B/G为所述第j个区块群中所有区块的第二R/G值的平均值。 Where B/G_DV j is the B/G difference value of the jth block group in all block groups, and C_B/G i is the second B/G of the i th block in the j th block group The value, Avg_C_B/G, is the average of the second R/G values of all the blocks in the j-th block group.
结合第二方面的第四种实现方式,在第二方面的第六种实现方式中,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的加权平均值与所有区块群的B/G差异值的加权平均值之和;With reference to the fourth implementation manner of the second aspect, in a sixth implementation manner of the second aspect, the color difference value corresponding to each pre-compensation table is a weighted average value of R/G difference values of all the block groups. The sum of the weighted average of the B/G difference values for all block groups;
所有区块群的R/G差异值的加权平均值的表达式为:The expression for the weighted average of the R/G difference values for all block groups is:
R/G_TDV=(R/G_DV 1*V 1/N 1+R/G_DV 2*V 2/N 2+…+R/G_DV K*V K/N K)/K R/G_TDV=(R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
其中,R/G_TDV表示所有区块群的R/G差异值的加权平均值,R/G_DV j为所有区块群中第j个区块群的R/G差异值,V j为所述第j个区块群对应的目标群的空间大小值,N j为所述第j个区块群中区块的个数,K为所有区块群的个数; Where R/G_TDV represents the weighted average of the R/G difference values of all block groups, and R/G_DV j is the R/G difference value of the jth block group in all block groups, and V j is the said The spatial size value of the target group corresponding to the j block groups, N j is the number of blocks in the jth block group, and K is the number of all block groups;
所有区块群的B/G差异值的加权平均值的表达式为:The expression for the weighted average of the B/G difference values for all block groups is:
B/G_TDV=(B/G_DV 1*V 1/N 1+B/G_DV 2*V 2/N 2+…+B/G_DV K*V K/N K)/K B/G_TDV=(B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
其中,B/G_TDV表示所有区块群的B/G差异值的加权平均值,B/G_DV j为所有区块群中第j个区块群的B/G差异值。 Where B/G_TDV represents the weighted average of the B/G difference values of all block groups, and B/G_DV j is the B/G difference value of the jth block group in all block groups.
第三方面,本申请还提供了一种图像处理装置,该装置包括处理器、存储器和总线系统。其中,处理器和存储器通过总线系统相连,该存储器用于存储指令,该处理器用于执行该存储器存储的指令,以实现第一方面以及第一方面的各种实现方式所述的图像处理方法。In a third aspect, the present application also provides an image processing apparatus including a processor, a memory, and a bus system. Wherein the processor and the memory are connected by a bus system for storing instructions for executing the instructions stored by the memory to implement the image processing method of the first aspect and various implementations of the first aspect.
由于本申请提供的装置能够实现第一方面以及第一方面的各种实现方式所述的图像处理方法,所以本申请提供的装置具有的有益效果与第一方面所述的图像处理方法具有的有益效果相同,在此不再赘述。Since the apparatus provided by the present application can implement the image processing method of the first aspect and the various implementation manners of the first aspect, the apparatus provided by the present application has the beneficial effects and the image processing method of the first aspect. The effect is the same and will not be described here.
第三方面,本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机执行上述第一方面所述的图像处理方法。In a third aspect, the present application further provides a computer readable storage medium having instructions stored therein, when executed on a computer, causing a computer to execute the image processing method described in the above first aspect .
第四方方面,本申请还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面所述的图像处理方法。In a fourth aspect, the present application also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the image processing method of the first aspect described above.
第五方方面,本申请还提供了一种芯片,所述芯片包括处理器和/或程序指令,当所述芯片运行时,实现本申请第一方面所述的图像处理方法。In a fifth aspect, the present application also provides a chip, the chip including a processor and/or program instructions, when the chip is running, implementing the image processing method of the first aspect of the present application.
附图说明DRAWINGS
图1为本申请提供的一种图像处理方法的一个实施例的流程图;FIG. 1 is a flowchart of an embodiment of an image processing method provided by the present application;
图2为本申请提供的由R/G值、B/G值以及亮度值相似的区块组成为区块群的效果图;2 is an effect diagram of a block group composed of R/G values, B/G values, and luminance values similar to that provided by the present application;
图3为本申请提供的一种确定区块群的方法的一个实施例的流程图;FIG. 3 is a flowchart of an embodiment of a method for determining a block group according to the present application; FIG.
图4为本申请提供的对位置点进行分群后的效果图;4 is an effect diagram of grouping position points according to the present application;
图5为本申请提供的标准光源点以及区块点在R/G与B/G的二维坐标系中的分布示意图;5 is a schematic diagram of distribution of standard light source points and block points in a two-dimensional coordinate system of R/G and B/G provided by the present application;
图6为本申请提供的一种确定补偿表对应的色彩差异值的方法的一个实施例的流程图;FIG. 6 is a flowchart of an embodiment of a method for determining a color difference value corresponding to a compensation table according to the present application; FIG.
图7为本申请提供的一种图像处理装置的一个实施例的结构框图;FIG. 7 is a structural block diagram of an embodiment of an image processing apparatus provided by the present application; FIG.
图8为本申请提供的一种图像处理装置的另一个实施例的结构框图。FIG. 8 is a structural block diagram of another embodiment of an image processing apparatus provided by the present application.
具体实施方式Detailed ways
本申请提供的图像处理方法可以应用于拍照设备中,可以防止拍摄出图像出现color shading现象。该拍照设备可以为任一设置有摄像头的设备,例如照相机、手机、摄像机等。本申请中的目标图像可以是镜头中的预览图像,也可以是拍摄后的图像,本申请在此不做具体限制。The image processing method provided by the present application can be applied to a photographing device, and can prevent the color shading phenomenon from occurring in the photographed image. The photographing device can be any device equipped with a camera, such as a camera, a mobile phone, a video camera or the like. The target image in the present application may be a preview image in the lens or an image after the shooting, and the present application is not specifically limited herein.
本申请的发明构思为首先将目标图像分割为多个区块,利用各个区块的R/G值、B/G值以及亮度值确定图像中材质相同物体所在的区域,该区域中的各个区块的R/G值相近,B/G值相近,亮度值相似,然后利用各个补偿表分别对该区域中各个区块进行预补偿,以得到补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表,用以对目标图像进行色彩补偿。由于每个补偿表对应的色彩差异值能够反映出每个补偿表对目标图像进行色彩补偿后的效果,从而能够较准确地选出拍照环境下的光源色温对应的目标补偿表,以用于准确修正具有color shading现象的图像。The inventive concept of the present application is to first divide a target image into a plurality of blocks, and use the R/G value, the B/G value, and the brightness value of each block to determine an area in which the same material of the image is located, and each area in the area. The R/G values of the blocks are similar, the B/G values are similar, and the luminance values are similar. Then, each block in the region is pre-compensated by using each compensation table to obtain the color difference value corresponding to the compensation table, and the color difference value is minimized. The compensation table is determined as a target compensation table for color compensation of the target image. Since the color difference value corresponding to each compensation table can reflect the effect of each compensation table on the color compensation of the target image, the target compensation table corresponding to the color temperature of the light source in the photographing environment can be accurately selected for accurate use. Fix images with color shading.
光源的色温由高到低可以分为:D75光源,色温为7500°K;D65光源,色温为6500°K;D55光源,色温为5500°K;D50光源,色温为5000°K;CWF光源,色温为4100°K;TL84光源,色温为4000°K;U30光源,色温为3000°K;A光源,色温为2850°K;H光源,色温为2300°K。这九个光源可以称为标准光源,其中,D75光源、D65光源、D55光源及D50光源可以归为高色温光源,CWF光源、TL84光源及U30光源可以归为中色温光源,A光源与H光源可以归为低色温光源。The color temperature of the light source can be divided into: D75 light source, color temperature is 7500 °K; D65 light source, color temperature is 6500 °K; D55 light source, color temperature is 5500 °K; D50 light source, color temperature is 5000 °K; CWF light source, The color temperature is 4100°K; the TL84 light source has a color temperature of 4000°K; the U30 light source has a color temperature of 3000°K; the A light source has a color temperature of 2850°K; and the H light source has a color temperature of 2300°K. The nine light sources can be called standard light sources. Among them, D75 light source, D65 light source, D55 light source and D50 light source can be classified as high color temperature light source, CWF light source, TL84 light source and U30 light source can be classified as medium color temperature light source, A light source and H light source. Can be classified as a low color temperature source.
不同色温的光源中的红色光强度不同,会导致不同程度的color shading,但是由于在相同色温的光源下,不同材质的物体对红色光的反射强度不同,所以材质相同物体所在的图像区域的色彩差异程度才能较准确地反应出一定光源色温下图像的color shading程度,再利用各个补偿表对图像中材质相同物体所在的区域进行预补偿,通过评价各个补偿表的补偿效果,选出补偿效果较好的补偿表,从而可以提高选取目标补偿表的准确性。Different red light in different color temperature sources will result in different levels of color shading, but the color of the image area where the material is the same is different because the reflection intensity of the red light is different under different light sources. The degree of difference can accurately reflect the color shading degree of the image under the color temperature of a certain light source, and then use each compensation table to pre-compensate the area where the same material in the image is located. By evaluating the compensation effect of each compensation table, the compensation effect is selected. A good compensation table can improve the accuracy of the selection target compensation table.
像素点的R/G值为像素点的红色R值与绿色G值的比值,B/G值为像素点的蓝色B值与绿色G值,R值、B值、及G值的取值范围可以为0至255。RGB颜色空间可以转换为YCbCr颜色空间或YUV颜色空间,其中,Y可以表示像素点的亮度值,亮度值的表达式可以为Y=0.299*R+0.578*G+0.114*B。需要说明的是,本申请中的色彩信息可以利用R/G值以及B/G值进行表示,也可以利用YCbCr颜色空间中的Cb以及Cr进行表示,或者利用YUV颜色空间中的U以及V进行表示,本申请不对色彩信息的表示方式进行具体限定。The R/G value of the pixel is the ratio of the red R value of the pixel to the green G value, and the B/G value is the blue B value and the green G value of the pixel, and the values of the R value, the B value, and the G value. The range can be from 0 to 255. The RGB color space can be converted into a YCbCr color space or a YUV color space, where Y can represent the brightness value of the pixel point, and the expression of the brightness value can be Y=0.299*R+0.578*G+0.114*B. It should be noted that the color information in the present application may be represented by R/G value and B/G value, or may be represented by Cb and Cr in the YCbCr color space, or by using U and V in the YUV color space. It is indicated that this application does not specifically limit the manner in which color information is represented.
需要说明的是,本申请中的各个阈值可以根据本申请的说明,在无需付出任何创造性劳动的情况下即可进行确定,并且同一个阈值可以为不同的数值,以解决本申请要解决的技术问题,所以本申请不对各个阈值的取值进行具体限定。It should be noted that each threshold in the present application may be determined according to the description of the present application without any creative work, and the same threshold may be different values to solve the technology to be solved by the present application. The problem is that the present application does not specifically limit the value of each threshold.
参考图1,为本申请提供的一种图像处理方法的一个实施例的流程图,该方法具体可以包括以下步骤。1 is a flowchart of an embodiment of an image processing method provided by the present application, and the method may specifically include the following steps.
步骤101,将目标图像划分为至少两个区块。In step 101, the target image is divided into at least two blocks.
在具体实现中,可以将目标图像划分为n*m个区块,其中n可以表示区块的行数,m可以表示区块的列数,每个区块包括至少一个像素点。In a specific implementation, the target image may be divided into n*m blocks, where n may represent the number of rows of the block, m may represent the number of columns of the block, and each block includes at least one pixel.
步骤102,从所述至少两个区块中确定至少一个区块群,所述至少一个区块群中每个区块群中各个区块所展示的物体材质均相同。Step 102: Determine at least one block group from the at least two blocks, and each of the block groups in the at least one block group displays materials of the same material.
图像中材质相同物体所在的区域中的各个像素点的R/G值相似,B/G值相似,亮度值相似,所以可以根据各个区块的R/G值、B/G值以及亮度值确定材质相同物体所在的区域以得到区块群。例如,在图2所示的区块群的效果图中,显示了两个区块群(图2中的不同的区块群中的区块使用不同灰度的线框进行表示),每个区块群中各个区块所展示的物体材质均相同。同一个区块群中的各个区块可以不相邻,并且同一个区块可以属于不同的区块群。The R/G values of the pixels in the area where the material is the same in the image are similar, the B/G values are similar, and the brightness values are similar, so it can be determined according to the R/G value, B/G value and brightness value of each block. The area where the same object is located to get the block group. For example, in the effect diagram of the block group shown in FIG. 2, two block groups are displayed (blocks in different block groups in FIG. 2 are represented by wire frames of different gray scales), each The objects displayed in each block in the block group are the same material. Each block in the same block group may not be adjacent, and the same block may belong to different block groups.
每个区块的R/G值为该区块的R值与G值的比值,每个区块的B/G值为该区块的B值与G值的比值。每个区块的R值为该区块所包含的像素点的R值的平均值,每个区块的B值为该区块所包含的像素点的B值的平均值,每个区块的亮度值为该区块所包含的像素点的亮度值的平均值。The R/G value of each block is the ratio of the R value to the G value of the block, and the B/G value of each block is the ratio of the B value to the G value of the block. The R value of each block is the average of the R values of the pixels included in the block, and the B value of each block is the average of the B values of the pixels included in the block, and each block The luminance value is the average of the luminance values of the pixels included in the block.
如图3所示,确定区块群的具体过程可以包括以下子步骤。As shown in FIG. 3, the specific process of determining a block group may include the following sub-steps.
子步骤11,确定每个区块在三维图像坐标系中的位置点,所述位置点的坐标值分别为每个区块的第一R/G值、第一B/G值以及亮度值。Sub-step 11, determining a position point of each block in a three-dimensional image coordinate system, the coordinate values of the position points are a first R/G value, a first B/G value, and a brightness value of each block, respectively.
为确定R/G值、B/G值以及亮度值相近的区块,可以在坐标轴分别为R/G值轴,B/G值轴以及亮度值轴的三维图像坐标系中确定每个区块的位置点,基于各个位置点之间的距离即可确定R/G值、B/G值以及亮度值均分别相近的区块。In order to determine the R/G value, the B/G value, and the block with the same brightness value, each area can be determined in the three-dimensional image coordinate system whose coordinate axes are the R/G value axis, the B/G value axis, and the brightness value axis, respectively. The position point of the block can be determined based on the distance between the respective position points to determine the R/G value, the B/G value, and the block whose luminance values are respectively close.
由于各个区块的R/G值和B/G值的数值较小,而亮度值的数值可能较大,例如R/G值和B/G值的数值范围是0-5,而亮度值可能为上百的数值,所以可以将亮度值进行归一化处理,将亮度值限制在R/G值和B/G值所在的范围内,以提高数据处理的准确度。Since the values of the R/G value and the B/G value of each block are small, the value of the brightness value may be large, for example, the value range of the R/G value and the B/G value is 0-5, and the brightness value may be It is a hundred values, so the brightness value can be normalized, and the brightness value is limited to the range of R/G value and B/G value to improve the accuracy of data processing.
子步骤12,在所述三维图像坐标系中确定至少两个基准点,并将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置点群,所述至少两个基准点中每个基准点为所述每个基准点所属的第一位置点群中所有位置点的重心。Sub-step 12, determining at least two reference points in the three-dimensional image coordinate system, and classifying the position points of each block into a group to which one of the at least two reference points belongs to obtain at least two a first location point group, wherein each of the at least two reference points is a center of gravity of all the location points in the first location point group to which each reference point belongs.
该第一位置点群的个数可以预先设置,例如可以为1、2、3等数值。为得到预设数量的第一位置点群,可以先确定用于分群的基准点的个数,基准点的个数与第一位置点群的个数相同。每个第一位置点群的重心的R/G值为该第一位置点群所包含的位置点的R/G值的平均值,每个第一位置点群的重心的B/G值为该第一位置点群所包含的位置点的B/G值的平均值,每个第一位置点群的重心的亮度值为该第一位置点群所包含的位置点的亮度值的平均值,The number of the first location point groups may be set in advance, and may be, for example, a value of 1, 2, or 3. In order to obtain a preset number of first location point groups, the number of reference points used for grouping may be determined first, and the number of reference points is the same as the number of the first location point groups. The R/G value of the center of gravity of each first location point group is an average value of the R/G values of the location points included in the first location point group, and the B/G value of the center of gravity of each first location point group is The average value of the B/G values of the position points included in the first position point group, and the brightness value of the center of gravity of each of the first position point groups is the average value of the brightness values of the position points included in the first position point group. ,
本申请可以利用k-means聚类算法、k-modes聚类算法、使用连接的鲁棒聚类(robust clustering using links,ROCK)算法等算法确定第一位置点群,其中利用k-means聚类算法对所述位置点进行分群以得到至少两个第一位置点群的过程具体可以包括:在所述三维图像坐标系中,随机选取至少两个基准点;将每个区块的位置点归入距离所述每个区块的位置点最近的一个基准点所属的群中以得到至少两个第二位置点群;如果所述至少两个第二位置点群中每个第二位置点群的重心均与所述每个第二位置点群中的基准点重合,则确定所述每个第二位置点群为第一位置点群;如果所述至少两个第二位置点群中任一第二位置点群的重心与所述任一第二位置点群中的基准点不重合,则以所述每个第二位置点群的重心作为新的基准点,利用所述新的基准点对各个所述位置点进行分群,以得到所述第一位置点群。The application can determine the first location point group by using k-means clustering algorithm, k-modes clustering algorithm, and robust clustering using links (ROCK) algorithm, wherein k-means clustering is used. The process of grouping the location points to obtain at least two first location point groups may include: randomly selecting at least two reference points in the three-dimensional image coordinate system; and locating the location of each block Entering into a group to which a reference point closest to the position point of each block belongs to obtain at least two second location point groups; if each of the at least two second location point groups is in a second position point group The center of gravity coincides with the reference point in each of the second location point groups, and then the each second location point group is determined to be the first location point group; if the at least two second location point groups are any If the center of gravity of the second location point group does not coincide with the reference point of any of the second location point groups, the center of gravity of each of the second location point groups is used as a new reference point, and the new reference is utilized. Pointing each of the location points into groups To obtain a first position of the point group.
例如,可以先在三维图像坐标系中随机选取两个基准点,分别为基准点a和基准点b, 将距离基准点a较近的位置点归入第二位置点群A中,将距离基准点b较近的位置点归入第二位置点群B中,然后确定第二位置点群A的重心以及第二位置点群B的重心,如果第二位置点群A的重心与基准点a不重合或第二位置点群B的重心与基准点b不重合,则将第二位置点群A的重心以及第二位置点群B的重心作为新的基准点,重新分群,直至每个第二位置点群的重心与所述每个第二位置点群的基准点重合,此时得到的两个第二位置点群即为欲确定的第一位置点群,以图4所示的对位置点进行分群后的效果图为例进行说明,图4中的G1以及G2即为得到的两个第一位置点群。For example, two reference points may be randomly selected in the three-dimensional image coordinate system, respectively, as the reference point a and the reference point b, and the position closer to the reference point a is classified into the second position point group A, and the distance reference is used. The position point closer to the point b is classified into the second position point group B, and then the center of gravity of the second position point group A and the center of gravity of the second position point group B are determined, if the center of gravity of the second position point group A and the reference point a If the center of gravity of the second position point group A does not coincide with the reference point b, the center of gravity of the second position point group A and the center of gravity of the second position point group B are re-grouped as a new reference point until each The center of gravity of the two-position point group coincides with the reference point of each of the second position point groups, and the two second position point groups obtained at this time are the first position point group to be determined, and the pair shown in FIG. The effect map after the grouping is performed is described as an example. G1 and G2 in FIG. 4 are the obtained two first position point groups.
需要说明的是,本申请的第一位置点群的个数也可以设置为一,在该种情况下可以将所有的位置点归入该第一位置点群中,该第一位置点群的重心即为目标图像内所有位置点的重心,本申请不对第一位置点群的个数进行具体限定。It should be noted that the number of the first location point groups in the present application may also be set to one. In this case, all the location points may be classified into the first location point group, and the first location point group may be The center of gravity is the center of gravity of all the points in the target image. This application does not specifically limit the number of points in the first position.
在每个第一位置点群中,距离该第一位置点群的重心较近的各个位置点的R/G值较接近、B/G值较接近、亮度值较接近,这些位置点对应的区块所展示的物体材质相同的概率较大,所以可以在该第一位置点群的重心附近确定目标群,该目标群所包含的位置点对应的区块所展示的物体材质相同。确定目标群的过程具体如下所述。In each of the first position point groups, the R/G values of the respective position points closer to the center of gravity of the first position point group are closer, the B/G values are closer, and the brightness values are closer, and the position points correspond to The object displayed on the block has the same probability of the same material, so the target group can be determined near the center of gravity of the first point group, and the object corresponding to the position point included in the target group has the same material. The process of determining the target group is as follows.
子步骤13,在至少一个第一位置点群中确定目标群,所述每个第一位置点群的重心位于所述每个第一位置点群中的目标群内,所述目标群中每个目标群中各个位置点距离所述每个目标群所属的第一位置点群的重心不大于距离阈值。Sub-step 13, determining a target group in the at least one first location point group, wherein a center of gravity of each of the first location point groups is located in a target group in each of the first location point groups, each of the target groups The position centers of the plurality of location points in the target group are not greater than the distance threshold from the first location point group to which each of the target groups belongs.
当得到多个第一位置点群时,可以在每个第一位置点群中分别确定一个目标群以得到多个目标群,也可以任选一个第一位置点群,在这一个第一位置点群中确定一个目标群以得到一个目标群,本申请不对得到的目标群的数量进行具体限定。When a plurality of first location point groups are obtained, one target group may be separately determined in each first location point group to obtain a plurality of target groups, or one first location point group may be selected, in the first location. A target group is determined in the point group to obtain a target group. This application does not specifically limit the number of target groups obtained.
在确定目标群时,可以在所述三维图像坐标系中,以所述至少两个第一位置点群中每个第一位置点群的重心为中心建立球形的目标群;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数不小于数量阈值,则将所述每个目标群的半径设置为所述第一半径阈值;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数小于所述数量阈值,则增大所述每个目标群的半径直至所述每个目标群中的位置点的个数不小于所述数量阈值,增大后的所述半径不大于第二半径阈值。如果目标群的半径增大至第二半径阈值,该目标群中的位置点的个数依旧小于所述数量阈值,则放弃使用该目标群进行目标补偿表的选取。目标群内的位置点不小于数量阈值,是为了保证区块群的区域足够大以表征该区域的color shading程度,以及表征对color shading的补偿效果,该数量阈值N th可以为N th=(n*m)/30。 In determining the target group, a spherical target group may be established centering on a center of gravity of each of the at least two first location point groups in the three-dimensional image coordinate system; if the target is When the radius of each target group in the group is the first radius threshold, the number of the location points in each target group is not less than the quantity threshold, and the radius of each target group is set as the first radius a threshold; if the number of location points in each target group is less than the number threshold when the radius of each target group in the target group is a first radius threshold, then each target group is increased The radius until the number of position points in each target group is not less than the number threshold, and the increased radius is not greater than the second radius threshold. If the radius of the target group increases to the second radius threshold, the number of location points in the target group is still less than the number threshold, then the target group is discarded to select the target compensation table. Position of a point within the target group is not less than the threshold number, in order to ensure regional block group is large enough to characterize color degree of shading the region, and characterization compensation effect of color shading, which threshold number N th may be a N th = ( n*m)/30.
所述第一半径阈值R min可以为R min=(1/5)*D,所述第二半径阈值R max可以为R max=D,其中,D为在R/G与B/G的二维坐标系中D65标准光源下得到的灰卡图像的色彩信息对应的点与D50标准光源下得到的灰卡图像的色彩信息对应的点之间的距离。每个灰卡图像为在每个标准光源下对没有颜色的灰卡进行拍照得到的图像。每个灰卡图像的色彩信息包括R/G值以及B/G值,用于计算该R/G值以及B/G值的R值、B值以及G值可以分别为每个灰卡图像所包含的像素点的R值的平均值、B值的平均值以及G值的平均值。 The first radius threshold R min may be R min = (1/5) * D, and the second radius threshold R max may be R max = D, where D is two in R / G and B / G The distance between the point corresponding to the color information of the gray card image obtained under the D65 standard light source in the dimensional coordinate system and the point corresponding to the color information of the gray card image obtained under the D50 standard light source. Each gray card image is an image obtained by photographing a gray card having no color under each standard light source. The color information of each gray card image includes an R/G value and a B/G value, and the R value, the B value, and the G value used to calculate the R/G value and the B/G value may be respectively for each gray card image. The average value of the R values of the included pixel points, the average value of the B values, and the average value of the G values.
以图4所示的示意图为例进行说明,图4中C1以及C2所示的两个球形表示得到的俩个目标群。如图4所示,各个目标群内的位置点比较集中,各个位置点之间的距离较短,各个位置点的R/G值、B/G值以及亮度值都比较相近,所以各个目标群内的位置点对应的 区块可以组成相应的区块群。Taking the schematic diagram shown in FIG. 4 as an example, the two spheres shown by C1 and C2 in FIG. 4 represent the two target groups obtained. As shown in FIG. 4, the position points in each target group are concentrated, the distance between each position point is short, and the R/G value, B/G value, and brightness value of each position point are relatively similar, so each target group is The blocks corresponding to the location points within can form a corresponding block group.
当目标群的形状为球形时,该距离阈值可以为第二半径阈值。需要说明的是,该目标群的形状可以为正方形、长方形、圆柱形等,在此不对目标群的形状做具体限定。When the shape of the target group is spherical, the distance threshold may be a second radius threshold. It should be noted that the shape of the target group may be a square, a rectangle, a cylinder, or the like, and the shape of the target group is not specifically limited herein.
子步骤14,确定所述每个目标群对应的区块群,所述每个目标群对应的每个区块群包括所述每个目标群中至少一个位置点对应的区块。Sub-step 14, the block group corresponding to each target group is determined, and each block group corresponding to each target group includes a block corresponding to at least one position point in each target group.
在具体实施中,为保证区块群的区域足够大以表征该区域的color shading程度,以及表征对color shading的补偿效果,可以利用每个目标群中全部的位置点对应的区块组成区块群。In a specific implementation, in order to ensure that the area of the block group is large enough to characterize the color shading degree of the area and to represent the compensation effect on the color shading, the block corresponding to all the position points in each target group may be used to form the block. group.
目标图像可能会包括色彩较强烈(色彩较深)的区块,所以可能会由色彩较强烈的区块组成色彩较强烈的区块群,而色彩较强烈的区块群可能会影响对补偿效果的判断,进而影响目标补偿表的选取,所以在子步骤11,确定每个区块在三维图像坐标系中的位置点,所述位置点的坐标值分别为每个区块的第一R/G值、第一B/G值以及亮度值之前,可以先确定用于组成区块群的色彩较接近白色的区块,即有效区块。确定有效区块的具体步骤可以包括:在R/G与B/G的二维坐标系中确定各个标准光源的标准光源点以及各个区块的区块点;确定每个区块点距离各个标准光源点的距离;确定有效区块,所述有效区块的区块点距离至少一个标准光源点的距离不大于预设距离值。The target image may include blocks with a strong color (dark color), so a block with a stronger color may be composed of blocks with stronger color, and a block with a stronger color may affect the compensation effect. The determination, in turn, affects the selection of the target compensation table, so in sub-step 11, the position of each block in the three-dimensional image coordinate system is determined, and the coordinate values of the position points are the first R/ of each block respectively. Before the G value, the first B/G value, and the luminance value, the block that is used to form the block group to be closer to white, that is, the effective block, may be determined. The specific steps of determining the effective block may include: determining a standard light source point of each standard light source and a block point of each block in a two-dimensional coordinate system of R/G and B/G; determining each block point distance from each standard The distance of the light source point; determining the effective block, the distance of the block point of the effective block from the at least one standard light source point is not greater than the preset distance value.
确定每个标准光源的标准光源点的过程可以为:首先计算每个标准光源下得到的灰卡图像所包含的像素点的R值的平均值、G值的平均值、B值的平均值,每个标准光源点的R/G值为该R值的平均值与G值的平均值的比值,每个标准光源点的B/G值为该B值的平均值与G值的平均值的比值,然后在R/G与B/G的二维坐标系中确定每个标准光源点的位置。The process of determining the standard light source point of each standard light source may be: first calculating the average value of the R value of the pixel points included in the gray card image obtained under each standard light source, the average value of the G value, and the average value of the B value. The R/G value of each standard light source point is the ratio of the average value of the R value to the average value of the G value, and the B/G value of each standard light source point is the average of the B value and the average value of the G value. The ratio is then determined in the two-dimensional coordinate system of R/G and B/G to determine the position of each standard source point.
图5为本申请提供的标准光源点以及区块点在R/G与B/G的二维坐标系中的分布示意图。图5中较大的点表示九个标准光源点,较小的点表示各个区块点。虚线范围内的区块点距离至少一个标准光源点的距离不大于预设距离值,所以可以从虚线范围内的区块点对应的区块,即有效区块中确定区块群。从有效区块中确定区块群的过程与上述子步骤11至子步骤14所描述的过程类似,在此不再赘述。FIG. 5 is a schematic diagram of the distribution of standard light source points and block points in a two-dimensional coordinate system of R/G and B/G provided by the present application. The larger dots in Figure 5 represent nine standard source points, and the smaller points represent individual block points. The distance between the block points in the dotted line range and the at least one standard light source point is not greater than the preset distance value, so the block group can be determined from the block corresponding to the block point within the dotted line range, that is, the effective block. The process of determining the block group from the effective block is similar to the process described in the above sub-step 11 to sub-step 14, and details are not described herein again.
步骤103,使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表。Step 103: Perform pre-compensation on the at least one block group by using at least two compensation tables to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as the target compensation table.
在本申请中,可以预先针对不同色温的光源设置相应的补偿表,在选取目标补偿表时,可以先将各个补偿表对图像进行预补偿,再利用预补偿后的图像的色彩差异程度评估各个补偿表的补偿效果,从而将补偿效果较好,即预补偿后的图像的色彩差异程度较低的补偿表确定为目标补偿表,以用于调整具有color shading现象的图像。In the present application, a corresponding compensation table may be set in advance for the light sources of different color temperatures. When the target compensation table is selected, each compensation table may be pre-compensated, and then the color difference degree of the pre-compensated image is used to evaluate each The compensation effect of the compensation table is obtained, so that the compensation effect is better, that is, the compensation table with a lower degree of color difference of the pre-compensated image is determined as the target compensation table for adjusting the image with color shading phenomenon.
预先设置补偿表的具体过程可以为:首先将预设的光源色温下的灰卡图像划分为多个区块,对该灰卡图像划分区块方式与对目标图像划分区块的方式相同,也是将灰卡图像划分为n*m个区块,灰卡图像中的各个区块与目标图像中的各个区块可以一一对应;计算灰卡图像中每个区块的R值、B值以及G值,灰卡图像中每个区块的R值可以为该区块所包含的像素点的R值的平均值,每个区块的G值可以为该区块所包含的像素点的G值的平均值,每个区块的B值可以为该区块所包含的像素点的B值的平均值;根据每个区块的R值、G值以及B值确定每个区块的红色通道增益(R-gain)、绿色通道增益(G-gain)以及蓝色 通道增益(B-gain),以得到补偿表,所述补偿表中的信息包括该灰卡图像中的各个区块的R-gain、G-gain以及B-gain。当G-gain为1时,R-gain为区块的G值与R值的比值,B-gain为区块的G值与B值的比值。当确定补偿表后,在具体的预补偿过程中,可以利用多个相应的区块的R-gain计算得到目标图像中每个像素点的R补偿值,将该像素点的红色R值乘以该R补偿值,得到预补偿后的像素点的R值。得到预补偿后的像素点的G值以及B值的过程与得到预补偿后的像素点的R值的过程类似,在此不再赘述。The specific process of setting the compensation table in advance may be: firstly, the gray card image under the preset color temperature of the light source is divided into a plurality of blocks, and the method of dividing the gray card image into the block is the same as the method of dividing the block into the target image. The gray card image is divided into n*m blocks, and each block in the gray card image can correspond to each block in the target image; calculating the R value and the B value of each block in the gray card image and The value of G, the R value of each block in the gray card image may be an average value of the R values of the pixels included in the block, and the G value of each block may be the G of the pixel included in the block. The average value of the value, the B value of each block may be the average value of the B values of the pixel points included in the block; the red color of each block is determined according to the R value, the G value and the B value of each block Channel gain (R-gain), green channel gain (G-gain), and blue channel gain (B-gain) to obtain a compensation table, the information in the compensation table including each block in the gray card image R-gain, G-gain, and B-gain. When G-gain is 1, R-gain is the ratio of the G value of the block to the R value, and B-gain is the ratio of the G value of the block to the B value. After determining the compensation table, in a specific pre-compensation process, the R compensation value of each pixel in the target image may be calculated by using R-gain of a plurality of corresponding blocks, and the red R value of the pixel point is multiplied by The R compensation value gives the R value of the pre-compensated pixel. The process of obtaining the G value and the B value of the pre-compensated pixel is similar to the process of obtaining the R value of the pre-compensated pixel, and will not be described herein.
如图6所示,使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值的过程可以包括以下子步骤。As shown in FIG. 6, the process of separately compensating the at least one block group using at least two compensation tables to obtain a color difference value corresponding to each compensation table may include the following sub-steps.
子步骤21,使用至少两个补偿表分别对每个区块群中各个区块进行预补偿以得到每个区块群中各个区块的第二R/G值以及第二B/G值。Sub-step 21, pre-compensating each block in each block group with at least two compensation tables to obtain a second R/G value and a second B/G value of each block in each block group.
所述第二R/G值可以为预补偿后的区块的R值与G值的比值,所述第二B/G值可以为预补偿后的区块的B值与G值的比值。The second R/G value may be a ratio of the R value of the pre-compensated block to the G value, and the second B/G value may be a ratio of the B value to the G value of the pre-compensated block.
子步骤22,根据所述每个区块群中各个区块的第二R/G值确定所述每个区块群的R/G差异值,根据所述每个区块群中各个区块的第二B/G值确定所述每个区块群的B/G差异值。Sub-step 22, determining an R/G difference value of each block group according to a second R/G value of each block in each block group, according to each block in each block group The second B/G value determines the B/G difference value for each of the block groups.
所述R/G差异值的表达式可以为:The expression of the R/G difference value may be:
R/G_DV j=(|C_R/G 1-Avg_C_R/G|+|C_R/G 2-Avg_C_R/G|+…+|C_R/G P-Avg_C_R/G|)/P R/G_DV j =(|C_R/G 1 -Avg_C_R/G|+|C_R/G 2 -Avg_C_R/G|+...+|C_R/G P -Avg_C_R/G|)/P
其中,R/G_DV j为所有区块群中第j个区块群的R/G差异值,C_R/G i为所述第j个区块群中第i个区块的第二R/G值,P为所述第j个区块群中区块的个数,Avg_C_R/G为所述第j个区块群中所有区块的第二R/G值的平均值。 Where R/G_DV j is the R/G difference value of the j-th block group in all block groups, and C_R/G i is the second R/G of the i-th block in the j-th block group. The value, P is the number of blocks in the j-th block group, and Avg_C_R/G is the average value of the second R/G values of all the blocks in the j-th block group.
所述B/G差异值的表达式可以为:The expression of the B/G difference value may be:
B/G_DV j=(|C_B/G 1-Avg_C_B/G|+|C_B/G 2-Avg_C_B/G|+…+|C_B/G P-Avg_C_B/G|)/P B/G_DV j =(|C_B/G 1 -Avg_C_B/G|+|C_B/G 2 -Avg_C_B/G|+...+|C_B/G P -Avg_C_B/G|)/P
其中,B/G_DV j为所有区块群中第j个区块群的B/G差异值,C_B/G i为所述第j个区块群中第i个区块的第二B/G值,Avg_C_B/G为所述第j个区块群中所有区块的第二R/G值的平均值。 Where B/G_DV j is the B/G difference value of the j-th block group in all block groups, and C_B/G i is the second B/G of the i-th block in the j-th block group The value, Avg_C_B/G, is the average of the second R/G values of all the blocks in the j-th block group.
子步骤23,根据所述每个区块群的R/G差异值以及B/G差异值,确定所述每个预补偿表对应的色彩差异值,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的平均值与所有区块群的B/G差异值的平均值之和。Sub-step 23, determining, according to the R/G difference value and the B/G difference value of each block group, a color difference value corresponding to each pre-compensation table, and a color difference corresponding to each pre-compensation table The value is the sum of the average of the R/G difference values of all block groups and the average of the B/G difference values of all block groups.
由于每个区块群内的区块个数以及目标群的空间大小可能都不同,区块个数越多,表示材质相同物体所在的区域面积越大,越有代表性,但目标群的空间大小越大,表示区块之间的R/G值、B/G值及亮度值的差异性越大,越无法代表是同一材质,所以每个预补偿表对应的色彩差异值可以为所有区块群的R/G差异值的加权平均值与所有区块群的B/G差异值的加权平均值之和。Since the number of blocks in each block group and the space size of the target group may be different, the larger the number of blocks, the larger the area of the area where the same material is located, the more representative, but the space of the target group. The larger the size, the greater the difference between the R/G value, the B/G value and the brightness value between the blocks, and the less the representative is the same material, so the color difference value corresponding to each pre-compensation table can be all areas. The weighted average of the R/G difference values of the block group and the weighted average of the B/G difference values of all block groups.
所有区块群的R/G差异值的加权平均值的表达式为:The expression for the weighted average of the R/G difference values for all block groups is:
R/G_TDV=(R/G_DV 1*V 1/N 1+R/G_DV 2*V 2/N 2+…+R/G_DV K*V K/N K)/K R/G_TDV=(R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
其中,其中,R/G_TDV表示所有区块群的R/G差异值的加权平均值,R/G_DV j为所有区块群中第j个区块群的R/G差异值,V j为所述第j个区块群对应的目标群的空间大小值,N j为所述第j个区块群中区块的个数,K为所有区块群的个数。 Where R/G_TDV represents the weighted average of the R/G difference values of all block groups, and R/G_DV j is the R/G difference value of the jth block group in all block groups, and V j is The spatial size value of the target group corresponding to the jth block group, N j is the number of blocks in the jth block group, and K is the number of all block groups.
所有区块群的B/G差异值的加权平均值的表达式为:The expression for the weighted average of the B/G difference values for all block groups is:
B/G_TDV=(B/G_DV 1*V 1/N 1+B/G_DV 2*V 2/N 2+…+B/G_DV K*V K/N K)/K B/G_TDV=(B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
其中,B/G_TDV表示所有区块群的B/G差异值的加权平均值,B/G_DV j为所有区块群中第j个区块群的B/G差异值。 Where B/G_TDV represents the weighted average of the B/G difference values of all block groups, and B/G_DV j is the B/G difference value of the jth block group in all block groups.
通过使用所有区块群的R/G差异值的加权平均值与所有区块群的B/G差异值的加权平均值之和表示补偿表对应的色彩差异值,能够更加全面地评估各个补偿表的补偿效果,从而提高选取目标补偿表的准确性。The compensation table can be more comprehensively evaluated by using the weighted average of the R/G difference values of all the block groups and the weighted average of the B/G difference values of all the block groups to represent the color difference values corresponding to the compensation table. The compensation effect improves the accuracy of the selected target compensation table.
以任一个补偿表为例,对确定该补偿表对应的色彩差异值的过程进行概括说明:利用该补偿表对目标图像中每个区块群的各个区块的RGB值进行预补偿,确定各个区块的第二R/G值;根据上述R/G差异值的表达式,计算得到每个区块群的R/G差异值;根据上述所有区块群的R/G差异值的加权平均值的表达式,计算得到所有区块群的R/G差异值的加权平均值;以计算所有区块群的R/G差异值的加权平均值相似的过程计算得到所有区块群的B/G差异值的加权平均值;确定该补偿表对应的色彩差异值,该补偿表对应的色彩差异值为所有区块群的R/G差异值的平均值与所有区块群的B/G差异值的平均值之和。Taking any compensation table as an example, the process of determining the color difference value corresponding to the compensation table is generally described: the compensation table is used to pre-compensate the RGB values of each block of each block group in the target image to determine each The second R/G value of the block; the R/G difference value of each block group is calculated according to the expression of the R/G difference value; the weighted average of the R/G difference values of all the block groups described above The expression of the value, the weighted average of the R/G difference values of all the block groups is calculated; the B/ of all the block groups is calculated by calculating the weighted average of the R/G difference values of all the block groups. A weighted average of the G difference values; determining a color difference value corresponding to the compensation table, the color difference value corresponding to the compensation table is an average of the R/G difference values of all the block groups and a B/G difference of all the block groups The sum of the average values of the values.
步骤104,根据所述目标补偿表对所述目标图像进行色彩补偿。Step 104: Perform color compensation on the target image according to the target compensation table.
在根据目标补偿表对目标图像进行色彩补偿时,可以先根据目标补偿表中的信息确定目标图像中各个像素点需要调整到的R值、B值以及G值,确定各个像素点需要调整到的R值、B值以及G值的过程与上述预补偿的过程类似,在此不再赘述。最后将目标图像中各个像素点的R值、B值以及G值进行相应地调整,完成对目标图像的色彩补偿。When color compensation is performed on the target image according to the target compensation table, the R value, the B value, and the G value that need to be adjusted for each pixel in the target image may be determined according to the information in the target compensation table, and it is determined that each pixel needs to be adjusted. The process of the R value, the B value, and the G value is similar to the process of the above precompensation, and will not be described herein. Finally, the R value, the B value and the G value of each pixel in the target image are adjusted accordingly to complete the color compensation of the target image.
补偿表对应的色彩差异值越小,说明利用该补偿表对图像进行色彩补偿后的效果会越好,本申请通过使用各个补偿表对图像中物体材质相同的区块群进行预补偿,得到各个补偿表对应的色彩差异值,能够较准确地选出拍照环境下的光源色温对应的目标补偿表,以用于准确修正具有color shading现象的图像。The smaller the color difference value corresponding to the compensation table, the better the effect of using the compensation table to color compensate the image. This application uses the compensation table to pre-compensate the same block of objects in the image. The color difference value corresponding to the compensation table can accurately select the target compensation table corresponding to the color temperature of the light source in the photographing environment, so as to accurately correct the image with color shading phenomenon.
本申请还可以根据目标补偿表确定拍照环境下的光源色温,该光源色温信息可以用于对利用AWB算法计算出的白点位置进行调整,从而使依据该白点位置进行的图像处理更加准确。The application can also determine the color temperature of the light source in the photographing environment according to the target compensation table, and the color temperature information of the light source can be used to adjust the position of the white point calculated by the AWB algorithm, so that the image processing according to the white point position is more accurate.
参考图7,为本申请提供的一种图像处理装置的一个实施例的结构框图,该装置可以配置在拍照设备中或为拍照设备本身,该装置可以包括:划分单元701,第一确定单元702,第二确定单元703,补偿单元704。FIG. 7 is a structural block diagram of an embodiment of an image processing apparatus provided by the present application. The apparatus may be configured in a photographing device or a photographing device itself. The device may include: a dividing unit 701, and a first determining unit 702. The second determining unit 703 is a compensation unit 704.
其中,划分单元701,用于将目标图像划分为至少两个区块。The dividing unit 701 is configured to divide the target image into at least two blocks.
第一确定单元702,用于从所述至少两个区块中确定至少一个区块群,所述至少一个区块群中每个区块群中各个区块所展示的物体材质均相同。The first determining unit 702 is configured to determine, from the at least two blocks, at least one block group, and each of the block groups in the at least one block group exhibits the same material material.
第二确定单元703,用于使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表。The second determining unit 703 is configured to pre-compensate the at least one block group with at least two compensation tables to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as a target compensation. table.
补偿单元704,用于根据所述目标补偿表对所述目标图像进行色彩补偿。The compensation unit 704 is configured to perform color compensation on the target image according to the target compensation table.
优选地,第一确定单元702具体可以用于:确定每个区块在三维图像坐标系中的位置点,所述位置点的坐标值分别为每个区块的第一R/G值、第一B/G值以及亮度值;在所述三维图像坐标系中确定至少两个基准点,并将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置点群,所述至少两个基准点中每个基准点为所述每个基准点所属的第一位置点群中所有位置点的重心;在至少一个第一位置点群 中确定目标群,所述每个第一位置点群的重心位于所述每个第一位置点群中的目标群内,所述目标群中每个目标群中各个位置点距离所述每个目标群所属的第一位置点群的重心不大于距离阈值;确定所述每个目标群对应的区块群,所述每个目标群对应的每个区块群包括所述每个目标群中至少一个位置点对应的区块。Preferably, the first determining unit 702 is specifically configured to: determine a location point of each block in a three-dimensional image coordinate system, where the coordinate value of the location point is a first R/G value of each block, respectively a B/G value and a brightness value; determining at least two reference points in the three-dimensional image coordinate system, and classifying a position point of each block into a group to which one of the at least two reference points belongs Obtaining at least two first location point groups, each of the at least two reference points being a center of gravity of all location points in the first location point group to which each reference point belongs; in at least one first location Determining a target group in a point group, wherein a center of gravity of each of the first location point groups is located in a target group in each of the first location point groups, and each of the target groups in the target group is distance from the target point The center of gravity of the first location point group to which each target group belongs is not greater than the distance threshold; the block group corresponding to each target group is determined, and each block group corresponding to each target group includes each of the targets A block corresponding to at least one location point in the group.
优选地,第一确定单元702还具体可以用于:将每个区块的位置点归入距离所述每个区块的位置点最近的一个基准点所属的群中以得到至少两个第二位置点群;如果所述至少两个第二位置点群中每个第二位置点群的重心均与所述每个第二位置点群中的基准点重合,则确定所述每个第二位置点群为第一位置点群;如果所述至少两个第二位置点群中任一第二位置点群的重心与所述任一第二位置点群中的基准点不重合,则以所述每个第二位置点群的重心作为新的基准点,利用所述新的基准点对各个所述位置点进行分群,以得到所述第一位置点群。Preferably, the first determining unit 702 is further configured to: classify a location point of each block into a group to which a reference point closest to the location point of each block belongs to obtain at least two second a location point group; if each of the at least two second location point groups has a center of gravity coincident with a reference point in each of the second location point groups, determining each of the second The location point group is a first location point group; if the center of gravity of any of the at least two second location point groups does not coincide with the reference point in any of the second location point groups, The center of gravity of each of the second location point groups is used as a new reference point, and each of the location points is grouped by the new reference point to obtain the first location point group.
优选地,第一确定单元702还具体可以用于:在所述三维图像坐标系中,以所述至少两个第一位置点群中每个第一位置点群的重心为中心建立球形的目标群;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数不小于数量阈值,则将所述每个目标群的半径设置为所述第一半径阈值;如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数小于所述数量阈值,则增大所述每个目标群的半径直至所述每个目标群中的位置点的个数不小于所述数量阈值,增大后的所述半径不大于第二半径阈值;其中,所述第一半径阈值R min=(1/5)*D,所述第二半径阈值R max=D,其中,D为在R/G与B/G的二维坐标系中D65标准光源下得到的灰卡图像的色彩信息对应的点与D50标准光源下得到的灰卡图像的色彩信息对应的点之间的距离。 Preferably, the first determining unit 702 is further configured to: establish, in the three-dimensional image coordinate system, a spherical target centering on a center of gravity of each of the at least two first location point groups a group; if the radius of each target group in the target group is a first radius threshold, the number of location points in each target group is not less than a quantity threshold, then the radius of each target group Set to the first radius threshold; if the radius of each target group in the target group is the first radius threshold, the number of the location points in each target group is less than the quantity threshold, then increase The radius of each target group is large until the number of position points in each target group is not less than the quantity threshold, and the increased radius is not greater than a second radius threshold; wherein the first Radius threshold R min = (1/5) * D, the second radius threshold R max = D, where D is the gray card obtained under the D65 standard light source in the two-dimensional coordinate system of R/G and B/G The color corresponding to the color information of the image and the color of the gray card image obtained under the D50 standard light source Information corresponding to the distance between the points.
优选地,第二确定单元703具体可以用于:使用至少两个补偿表分别对每个区块群中各个区块进行预补偿以得到每个区块群中各个区块的第二R/G值以及第二B/G值;根据所述每个区块群中各个区块的第二R/G值确定所述每个区块群的R/G差异值,根据所述每个区块群中各个区块的第二B/G值确定所述每个区块群的B/G差异值;根据所述每个区块群的R/G差异值以及B/G差异值,确定所述每个预补偿表对应的色彩差异值,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的平均值与所有区块群的B/G差异值的平均值之和。Preferably, the second determining unit 703 is specifically configured to: pre-compensate each block in each block group by using at least two compensation tables to obtain a second R/G of each block in each block group. And a second B/G value; determining an R/G difference value of each block group according to a second R/G value of each block in each block group, according to each block The second B/G value of each block in the group determines a B/G difference value of each block group; determining the location according to the R/G difference value and the B/G difference value of each block group a color difference value corresponding to each pre-compensation table, wherein the color difference value corresponding to each pre-compensation table is an average value of R/G difference values of all block groups and a B/G difference value of all block groups. The sum of the averages.
其中,所述R/G差异值的表达式为:Wherein, the expression of the R/G difference value is:
R/G_DV j=(|C_R/G 1-Avg_C_R/G|+|C_R/G 2-Avg_C_R/G|+…+|C_R/G P-Avg_C_R/G|)/P R/G_DV j =(|C_R/G 1 -Avg_C_R/G|+|C_R/G 2 -Avg_C_R/G|+...+|C_R/G P -Avg_C_R/G|)/P
其中,R/G_DV j为所有区块群中第j个区块群的R/G差异值,C_R/G i为所述第j个区块群中第i个区块的第二R/G值,P为所述第j个区块群中区块的个数,Avg_C_R/G为所述第j个区块群中所有区块的第二R/G值的平均值。 Where R/G_DV j is the R/G difference value of the j-th block group in all block groups, and C_R/G i is the second R/G of the i-th block in the j-th block group. The value, P is the number of blocks in the j-th block group, and Avg_C_R/G is the average value of the second R/G values of all the blocks in the j-th block group.
所述B/G差异值的表达式为:The expression of the B/G difference value is:
B/G_DV j=(|C_B/G 1-Avg_C_B/G|+|C_B/G 2-Avg_C_B/G|+…+|C_B/G P-Avg_C_B/G|)/P B/G_DV j =(|C_B/G 1 -Avg_C_B/G|+|C_B/G 2 -Avg_C_B/G|+...+|C_B/G P -Avg_C_B/G|)/P
其中,B/G_DV j为所有区块群中第j个区块群的B/G差异值,C_B/G i为所述第j个区块群中第i个区块的第二B/G值,Avg_C_B/G为所述第j个区块群中所有区块的第二R/G值的平均值。 Where B/G_DV j is the B/G difference value of the j-th block group in all block groups, and C_B/G i is the second B/G of the i-th block in the j-th block group The value, Avg_C_B/G, is the average of the second R/G values of all the blocks in the j-th block group.
优选地,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的加权平均 值与所有区块群的B/G差异值的加权平均值之和。Preferably, the color difference value corresponding to each of the pre-compensation tables is a sum of a weighted average value of R/G difference values of all block groups and a weighted average value of B/G difference values of all block groups.
所有区块群的R/G差异值的加权平均值的表达式为:The expression for the weighted average of the R/G difference values for all block groups is:
R/G_TDV=(R/G_DV 1*V 1/N 1+R/G_DV 2*V 2/N 2+…+R/G_DV K*V K/N K)/K R/G_TDV=(R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
其中,R/G_TDV表示所有区块群的R/G差异值的加权平均值,R/G_DV j为所有区块群中第j个区块群的R/G差异值,V j为所述第j个区块群对应的目标群的空间大小值,N j为所述第j个区块群中区块的个数,K为所有区块群的个数; Where R/G_TDV represents the weighted average of the R/G difference values of all block groups, and R/G_DV j is the R/G difference value of the jth block group in all block groups, and V j is the said The spatial size value of the target group corresponding to the j block groups, N j is the number of blocks in the jth block group, and K is the number of all block groups;
所有区块群的B/G差异值的加权平均值的表达式为:The expression for the weighted average of the B/G difference values for all block groups is:
B/G_TDV=(B/G_DV 1*V 1/N 1+B/G_DV 2*V 2/N 2+…+B/G_DV K*V K/N K)/K B/G_TDV=(B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
其中,B/G_TDV表示所有区块群的B/G差异值的加权平均值,B/G_DV j为所有区块群中第j个区块群的B/G差异值。 Where B/G_TDV represents the weighted average of the B/G difference values of all block groups, and B/G_DV j is the B/G difference value of the jth block group in all block groups.
因此,该图像处理装置通过使用各个补偿表对图像中物体材质相同的区块群进行预补偿,得到各个补偿表对应的色彩差异值,能够较准确地选出拍照环境下的光源色温对应的目标补偿表,以用于准确修正具有color shading现象的图像。Therefore, the image processing apparatus pre-compensates the block group having the same object material in the image by using each compensation table, and obtains the color difference value corresponding to each compensation table, so that the target corresponding to the color temperature of the light source in the photographing environment can be accurately selected. A compensation table for accurately correcting images with color shading.
参考图8,为本申请提供的一种图像处理装置的另一个实施例的结构框图,该装置包括处理器801、存储器802和总线系统803。其中,处理器801和存储器802通过总线系统803相连,该存储器802用于存储指令,该处理器801用于执行该存储器802存储的指令。该图像处理装置的存储器802存储程序代码,且处理器801可以调用存储器802中存储的程序代码执行以下操作:将目标图像划分为至少两个区块;从所述至少两个区块中确定至少一个区块群,所述至少一个区块群中每个区块群中各个区块所展示的物体材质均相同;使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表;根据所述目标补偿表对所述目标图像进行色彩补偿。8 is a structural block diagram of another embodiment of an image processing apparatus provided by the present application, which includes a processor 801, a memory 802, and a bus system 803. The processor 801 and the memory 802 are connected by a bus system 803 for storing instructions for executing instructions stored by the memory 802. The memory 802 of the image processing apparatus stores the program code, and the processor 801 can call the program code stored in the memory 802 to perform the following operations: dividing the target image into at least two blocks; determining at least from the at least two blocks a block group, wherein each of the block groups in the at least one block group exhibits the same material material; and the at least one block group is pre-compensated using at least two compensation tables to obtain a color difference value corresponding to each compensation table, a compensation table that minimizes the color difference value is determined as a target compensation table; and the target image is color-compensated according to the target compensation table.
因此,该图像处理装置通过使用各个补偿表对图像中物体材质相同的区块群进行预补偿,得到各个补偿表对应的色彩差异值,能够较准确地选出拍照环境下的光源色温对应的目标补偿表,以用于准确修正具有color shading现象的图像。Therefore, the image processing apparatus pre-compensates the block group having the same object material in the image by using each compensation table, and obtains the color difference value corresponding to each compensation table, so that the target corresponding to the color temperature of the light source in the photographing environment can be accurately selected. A compensation table for accurately correcting images with color shading.
应理解,在本申请中,该处理器801可以是中央处理单元(Central Processing Unit,简称为“CPU”),该处理器801还可以是其他通用处理器、数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in this application, the processor 801 may be a central processing unit ("CPU"), and the processor 801 may also be other general-purpose processors, digital signal processors (DSPs), dedicated Integrated circuit (ASIC), off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like.
该存储器802可以包括只读存储器和随机存取存储器,并向处理器801提供指令和数据。存储器802的一部分还可以包括非易失性随机存取存储器。例如,存储器802还可以存储设备类型的信息。The memory 802 can include read only memory and random access memory and provides instructions and data to the processor 801. A portion of the memory 802 may also include a non-volatile random access memory. For example, the memory 802 can also store information of the device type.
该总线系统803除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。The bus system 803 may include a power bus, a control bus, a status signal bus, and the like in addition to the data bus.
在实现过程中,上述方法的各步骤可以通过处理器801中的硬件的集成逻辑电路或者软件形式的指令完成。结合本发明实施例所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存 储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器802,处理器801读取存储器802中的信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。In the implementation process, each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 801 or an instruction in a form of software. The steps of the method disclosed in the embodiments of the present invention may be directly implemented as a hardware processor, or may be performed by a combination of hardware and software modules in the processor. The software modules can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like. The storage medium is located in memory 802, and processor 801 reads the information in memory 802 and, in conjunction with its hardware, performs the steps of the above method. To avoid repetition, it will not be described in detail here.
本申请还提供了一种计算机可读存储介质,其中,该计算机可读存储介质可存储有指令,当其在计算机上运行时,使得计算机执行包括本发明提供的方法各实施例中的部分或全部步骤。所述的可读存储介质可为磁碟、光盘、只读存储记忆体(read-only memory,ROM)或随机存储记忆体(random access memory,RAM)等。The present application also provides a computer readable storage medium, wherein the computer readable storage medium can store instructions that, when executed on a computer, cause the computer to perform portions of the various embodiments of the method provided by the present invention or All steps. The readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
本申请还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述包括本发明提供的方法实施例中的部分或全部步骤。The present application also provides a computer program product comprising instructions which, when executed on a computer, cause the computer to perform some or all of the steps in the above-described embodiments of the method provided by the present invention.
本申请还提供了一种芯片,该芯片包括处理器和/或程序指令,当所述芯片运行时,实现本申请图1所示的实施例中的方法。The present application also provides a chip that includes a processor and/or program instructions that, when executed, implement the method of the embodiment illustrated in FIG. 1 of the present application.
本领域的技术人员可以清楚地了解到本申请中的技术可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本申请中的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。Those skilled in the art will clearly understand that the techniques in this application can be implemented by means of software plus the necessary general hardware platform. Based on such understanding, the technical solutions in the present application may be embodied in the form of software products in essence or in the form of software products, which may be stored in a storage medium such as ROM/RAM, magnetic Discs, optical discs, etc., include instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention or portions of the embodiments.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,例如上述装置或设备的描述可以参照对应的方法实施例。以上所述的本发明实施方式,并不构成对本发明保护范围的限定。The various embodiments in the present specification are described in a progressive manner, and the same similar parts between the various embodiments may be referred to each other. For example, the description of the above device or device may refer to the corresponding method embodiment. The embodiments of the invention described above are not intended to limit the scope of the invention.

Claims (18)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, comprising:
    将目标图像划分为至少两个区块;Dividing the target image into at least two blocks;
    从所述至少两个区块中确定至少一个区块群,所述至少一个区块群中每个区块群中各个区块所展示的物体材质均相同;Determining at least one block group from the at least two blocks, wherein each of the block groups in the at least one block group exhibits the same material material;
    使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表;And using at least two compensation tables to pre-compensate the at least one block group to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as a target compensation table;
    根据所述目标补偿表对所述目标图像进行色彩补偿。The target image is color compensated according to the target compensation table.
  2. 根据权利要求1所述的方法,其特征在于,所述从所述至少两个区块中确定至少一个区块群包括:The method according to claim 1, wherein said determining at least one block group from said at least two blocks comprises:
    确定每个区块在三维图像坐标系中的位置点,所述位置点的坐标值分别为每个区块的第一R/G值、第一B/G值以及亮度值;Determining a position point of each block in a three-dimensional image coordinate system, the coordinate values of the position points are respectively a first R/G value, a first B/G value, and a brightness value of each block;
    在所述三维图像坐标系中确定至少两个基准点,并将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置点群,所述至少两个基准点中每个基准点为所述每个基准点所属的第一位置点群中所有位置点的重心;Determining at least two reference points in the three-dimensional image coordinate system, and classifying a position point of each block into a group to which one of the at least two reference points belongs to obtain at least two first position points a group, each of the at least two reference points is a center of gravity of all position points in the first location point group to which each reference point belongs;
    在至少一个第一位置点群中确定目标群,所述每个第一位置点群的重心位于所述每个第一位置点群中的目标群内,所述目标群中每个目标群中各个位置点距离所述每个目标群所属的第一位置点群的重心不大于距离阈值;Determining a target group in at least one first location point group, wherein a center of gravity of each of the first location point groups is located in a target group in each of the first location point groups, wherein each target group in the target group Each of the location points is separated from the first location point group to which the target group belongs to a center of gravity that is not greater than a distance threshold;
    确定所述每个目标群对应的区块群,所述每个目标群对应的每个区块群包括所述每个目标群中至少一个位置点对应的区块。And determining, by the block group corresponding to each target group, each block group corresponding to each target group includes a block corresponding to at least one location point in each target group.
  3. 根据权利要求2所述的方法,其特征在于,所述将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置点群包括:The method according to claim 2, wherein the location point of each block is classified into a group to which one of the at least two reference points belongs to obtain at least two first location point groups include:
    将每个区块的位置点归入距离所述每个区块的位置点最近的一个基准点所属的群中以得到至少两个第二位置点群;Locating a location point of each block into a group to which a reference point closest to a location point of each of the blocks belongs to obtain at least two second location point groups;
    如果所述至少两个第二位置点群中每个第二位置点群的重心均与所述每个第二位置点群中的基准点重合,则确定所述每个第二位置点群为第一位置点群;If the center of gravity of each of the at least two second location point groups coincides with the reference point in each of the second location point groups, determining that each of the second location point groups is First location point group;
    如果所述至少两个第二位置点群中任一第二位置点群的重心与所述任一第二位置点群中的基准点不重合,则以所述每个第二位置点群的重心作为新的基准点,利用所述新的基准点对各个所述位置点进行分群,以得到所述第一位置点群。If the center of gravity of any one of the at least two second location point groups does not coincide with the reference point of the any second location point group, then each of the second location point groups The center of gravity is used as a new reference point, and each of the position points is grouped by the new reference point to obtain the first position point group.
  4. 根据权利要求2所述的方法,其特征在于,所述在至少一个第一位置点群中确定目标群,包括:The method of claim 2, wherein the determining the target group in the at least one first location point group comprises:
    在所述三维图像坐标系中,以所述至少两个第一位置点群中每个第一位置点群的重心为中心建立球形的目标群;In the three-dimensional image coordinate system, a spherical target group is established centering on a center of gravity of each of the at least two first location point groups;
    如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数不小于数量阈值,则将所述每个目标群的半径设置为所述第一半径阈值;If the radius of each target group in the target group is the first radius threshold, the number of the location points in each target group is not less than a quantity threshold, then the radius of each target group is set to The first radius threshold;
    如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数小于所述数量阈值,则增大所述每个目标群的半径直至所述每个目标群中的位置点的个数不小于所述数量阈值,增大后的所述半径不大于第二半径阈值。If the radius of each target group in the target group is the first radius threshold, the number of the location points in each target group is less than the number threshold, increasing the radius of each target group Until the number of position points in each target group is not less than the number threshold, the increased radius is not greater than the second radius threshold.
  5. 根据权利要求4所述的方法,其特征在于,所述第一半径阈值R min=(1/5)*D,所 述第二半径阈值R max=D,其中,D为在R/G与B/G的二维坐标系中D65标准光源下得到的灰卡图像的色彩信息对应的点与D50标准光源下得到的灰卡图像的色彩信息对应的点之间的距离。 The method according to claim 4, wherein said first radius threshold R min = (1/5) * D, said second radius threshold R max = D, wherein D is at R/G and The distance between the point corresponding to the color information of the gray card image obtained under the D65 standard light source in the two-dimensional coordinate system of the B/G and the point corresponding to the color information of the gray card image obtained under the D50 standard light source.
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值包括:The method according to any one of claims 1 to 5, wherein the at least one block group is pre-compensated using at least two compensation tables to obtain a color difference value corresponding to each compensation table. include:
    使用至少两个补偿表分别对每个区块群中各个区块进行预补偿以得到每个区块群中各个区块的第二R/G值以及第二B/G值;Pre-compensating each block in each block group with at least two compensation tables to obtain a second R/G value and a second B/G value of each block in each block group;
    根据所述每个区块群中各个区块的第二R/G值确定所述每个区块群的R/G差异值,根据所述每个区块群中各个区块的第二B/G值确定所述每个区块群的B/G差异值;Determining an R/G difference value of each block group according to a second R/G value of each block in each block group, according to a second B of each block in each block group a /G value determines a B/G difference value for each of the block groups;
    根据所述每个区块群的R/G差异值以及B/G差异值,确定所述每个预补偿表对应的色彩差异值,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的平均值与所有区块群的B/G差异值的平均值之和。Determining, according to the R/G difference value and the B/G difference value of each block group, a color difference value corresponding to each of the pre-compensation tables, and the color difference value corresponding to each pre-compensation table is all areas. The sum of the average of the R/G difference values of the block group and the average of the B/G difference values of all the block groups.
  7. 根据权利要求6所述的方法,其特征在于,The method of claim 6 wherein:
    所述R/G差异值的表达式为:The expression of the R/G difference value is:
    R/G_DV j=(|C_R/G 1-Avg_C_R/G|+|C_R/G 2-Avg_C_R/G|+…+|C_R/G P-Avg_C_R/G|)/P R/G_DV j =(|C_R/G 1 -Avg_C_R/G|+|C_R/G 2 -Avg_C_R/G|+...+|C_R/G P -Avg_C_R/G|)/P
    其中,R/G_DV j为所有区块群中第j个区块群的R/G差异值,C_R/G i为所述第j个区块群中第i个区块的第二R/G值,P为所述第j个区块群中区块的个数,Avg_C_R/G为所述第j个区块群中所有区块的第二R/G值的平均值; Where R/G_DV j is the R/G difference value of the j-th block group in all block groups, and C_R/G i is the second R/G of the i-th block in the j-th block group. a value, P is the number of blocks in the j-th block group, and Avg_C_R/G is an average value of second R/G values of all blocks in the j-th block group;
    所述B/G差异值的表达式为:The expression of the B/G difference value is:
    B/G_DV j=(|C_B/G 1-Avg_C_B/G|+|C_B/G 2-Avg_C_B/G|+…+|C_B/G P-Avg_C_B/G|)/P其中,B/G_DV j为所有区块群中第j个区块群的B/G差异值,C_B/G i为所述第j个区块群中第i个区块的第二B/G值,Avg_C_B/G为所述第j个区块群中所有区块的第二R/G值的平均值。 B/G_DV j =(|C_B/G 1 -Avg_C_B/G|+|C_B/G 2 -Avg_C_B/G|+...+|C_B/G P -Avg_C_B/G|)/P where B/G_DV j is The B/G difference value of the j-th block group in all block groups, C_B/G i is the second B/G value of the i-th block in the j-th block group, and Avg_C_B/G is the The average of the second R/G values of all the blocks in the jth block group.
  8. 根据权利要求6所述的方法,其特征在于,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的加权平均值与所有区块群的B/G差异值的加权平均值之和;The method according to claim 6, wherein the color difference value corresponding to each of the pre-compensation tables is a weighted average of R/G difference values of all block groups and a B/G difference of all block groups. The sum of the weighted averages of the values;
    所有区块群的R/G差异值的加权平均值的表达式为:The expression for the weighted average of the R/G difference values for all block groups is:
    R/G_TDV=(R/G_D V1*V 1/N 1+R/G_DV 2*V 2/N 2+…+R/G_DV K*V K/N K)/K R/G_TDV=(R/G_D V 1*V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
    其中,R/G_TDV表示所有区块群的R/G差异值的加权平均值,R/G_DV j为所有区块群中第j个区块群的R/G差异值,V j为所述第j个区块群对应的目标群的空间大小值,N j为所述第j个区块群中区块的个数,K为所有区块群的个数; Where R/G_TDV represents the weighted average of the R/G difference values of all block groups, and R/G_DV j is the R/G difference value of the jth block group in all block groups, and V j is the said The spatial size value of the target group corresponding to the j block groups, N j is the number of blocks in the jth block group, and K is the number of all block groups;
    所有区块群的B/G差异值的加权平均值的表达式为:The expression for the weighted average of the B/G difference values for all block groups is:
    B/G_TDV=(B/G_DV 1*V 1/N 1+B/G_DV 2*V 2/N 2+…+B/G_DV K*V K/N K)/K B/G_TDV=(B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
    其中,B/G_TDV表示所有区块群的B/G差异值的加权平均值,B/G_DV j为所有区块群中第j个区块群的B/G差异值。 Where B/G_TDV represents the weighted average of the B/G difference values of all block groups, and B/G_DV j is the B/G difference value of the jth block group in all block groups.
  9. 一种图像处理装置,其特征在于,包括:An image processing apparatus, comprising:
    划分单元,用于将目标图像划分为至少两个区块;a dividing unit, configured to divide the target image into at least two blocks;
    第一确定单元,用于从所述至少两个区块中确定至少一个区块群,所述至少一个区块群中每个区块群中各个区块所展示的物体材质均相同;a first determining unit, configured to determine at least one block group from the at least two blocks, wherein each of the block groups in the at least one block group displays materials of the same material;
    第二确定单元,用于使用至少两个补偿表分别对所述至少一个区块群进行预补偿以得到每个补偿表对应的色彩差异值,将色彩差异值最小的补偿表确定为目标补偿表;a second determining unit, configured to pre-compensate the at least one block group with at least two compensation tables to obtain a color difference value corresponding to each compensation table, and determine a compensation table with a minimum color difference value as a target compensation table. ;
    补偿单元,用于根据所述目标补偿表对所述目标图像进行色彩补偿。And a compensation unit, configured to perform color compensation on the target image according to the target compensation table.
  10. 根据权利要求9所述的装置,其特征在于,所述第一确定单元具体用于:The device according to claim 9, wherein the first determining unit is specifically configured to:
    确定每个区块在三维图像坐标系中的位置点,所述位置点的坐标值分别为每个区块的第一R/G值、第一B/G值以及亮度值;Determining a position point of each block in a three-dimensional image coordinate system, the coordinate values of the position points are respectively a first R/G value, a first B/G value, and a brightness value of each block;
    在所述三维图像坐标系中确定至少两个基准点,并将每个区块的位置点归入所述至少两个基准点中一个基准点所属的群中以得到至少两个第一位置点群,所述至少两个基准点中每个基准点为所述每个基准点所属的第一位置点群中所有位置点的重心;Determining at least two reference points in the three-dimensional image coordinate system, and classifying a position point of each block into a group to which one of the at least two reference points belongs to obtain at least two first position points a group, each of the at least two reference points is a center of gravity of all position points in the first location point group to which each reference point belongs;
    在至少一个第一位置点群中确定目标群,所述每个第一位置点群的重心位于所述每个第一位置点群中的目标群内,所述目标群中每个目标群中各个位置点距离所述每个目标群所属的第一位置点群的重心不大于距离阈值;Determining a target group in at least one first location point group, wherein a center of gravity of each of the first location point groups is located in a target group in each of the first location point groups, wherein each target group in the target group Each of the location points is separated from the first location point group to which the target group belongs to a center of gravity that is not greater than a distance threshold;
    确定所述每个目标群对应的区块群,所述每个目标群对应的每个区块群包括所述每个目标群中至少一个位置点对应的区块。And determining, by the block group corresponding to each target group, each block group corresponding to each target group includes a block corresponding to at least one location point in each target group.
  11. 根据权利要求10所述的装置,其特征在于,所述第一确定单元还具体用于:The device according to claim 10, wherein the first determining unit is further configured to:
    将每个区块的位置点归入距离所述每个区块的位置点最近的一个基准点所属的群中以得到至少两个第二位置点群;Locating a location point of each block into a group to which a reference point closest to a location point of each of the blocks belongs to obtain at least two second location point groups;
    如果所述至少两个第二位置点群中每个第二位置点群的重心均与所述每个第二位置点群中的基准点重合,则确定所述每个第二位置点群为第一位置点群;If the center of gravity of each of the at least two second location point groups coincides with the reference point in each of the second location point groups, determining that each of the second location point groups is First location point group;
    如果所述至少两个第二位置点群中任一第二位置点群的重心与所述任一第二位置点群中的基准点不重合,则以所述每个第二位置点群的重心作为新的基准点,利用所述新的基准点对各个所述位置点进行分群,以得到所述第一位置点群。If the center of gravity of any one of the at least two second location point groups does not coincide with the reference point of the any second location point group, then each of the second location point groups The center of gravity is used as a new reference point, and each of the position points is grouped by the new reference point to obtain the first position point group.
  12. 根据权利要求10所述的装置,其特征在于,所述第一确定单元还具体用于:The device according to claim 10, wherein the first determining unit is further configured to:
    在所述三维图像坐标系中,以所述至少两个第一位置点群中每个第一位置点群的重心为中心建立球形的目标群;In the three-dimensional image coordinate system, a spherical target group is established centering on a center of gravity of each of the at least two first location point groups;
    如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数不小于数量阈值,则将所述每个目标群的半径设置为所述第一半径阈值;If the radius of each target group in the target group is the first radius threshold, the number of the location points in each target group is not less than a quantity threshold, then the radius of each target group is set to The first radius threshold;
    如果当所述目标群中每个目标群的半径为第一半径阈值时,所述每个目标群中的位置点的个数小于所述数量阈值,则增大所述每个目标群的半径直至所述每个目标群中的位置点的个数不小于所述数量阈值,增大后的所述半径不大于第二半径阈值;其中,所述第一半径阈值R min=(1/5)*D,所述第二半径阈值R max=D,其中,D为在R/G与B/G的二维坐标系中D65标准光源下得到的灰卡图像的色彩信息对应的点与D50标准光源下得到的灰卡图像的色彩信息对应的点之间的距离。 If the radius of each target group in the target group is the first radius threshold, the number of the location points in each target group is less than the number threshold, increasing the radius of each target group Until the number of position points in each target group is not less than the quantity threshold, the increased radius is not greater than a second radius threshold; wherein the first radius threshold R min = (1/5 *D, the second radius threshold R max = D, where D is the point corresponding to the color information of the gray card image obtained under the D65 standard light source in the two-dimensional coordinate system of R/G and B/G and D50 The distance between the points corresponding to the color information of the gray card image obtained under the standard light source.
  13. 根据权利要求9-12中任一项所述的装置,其特征在于,所述第二确定单元具体用于:The device according to any one of claims 9 to 12, wherein the second determining unit is specifically configured to:
    使用至少两个补偿表分别对每个区块群中各个区块进行预补偿以得到每个区块群中各个区块的第二R/G值以及第二B/G值;Pre-compensating each block in each block group with at least two compensation tables to obtain a second R/G value and a second B/G value of each block in each block group;
    根据所述每个区块群中各个区块的第二R/G值确定所述每个区块群的R/G差异值,根据所述每个区块群中各个区块的第二B/G值确定所述每个区块群的B/G差异值;Determining an R/G difference value of each block group according to a second R/G value of each block in each block group, according to a second B of each block in each block group a /G value determines a B/G difference value for each of the block groups;
    根据所述每个区块群的R/G差异值以及B/G差异值,确定所述每个预补偿表对应的色彩差异值,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的平均值与所有区块群的B/G差异值的平均值之和。Determining, according to the R/G difference value and the B/G difference value of each block group, a color difference value corresponding to each of the pre-compensation tables, and the color difference value corresponding to each pre-compensation table is all areas. The sum of the average of the R/G difference values of the block group and the average of the B/G difference values of all the block groups.
  14. 根据权利要求13所述的装置,其特征在于,The device of claim 13 wherein:
    所述R/G差异值的表达式为:The expression of the R/G difference value is:
    R/G_DV j=(|C_R/G 1-Avg_C_R/G|+|C_R/G 2-Avg_C_R/G|+…+|C_R/G P-Avg_C_R/G|)/P R/G_DV j =(|C_R/G 1 -Avg_C_R/G|+|C_R/G 2 -Avg_C_R/G|+...+|C_R/G P -Avg_C_R/G|)/P
    其中,R/G_DV j为所有区块群中第j个区块群的R/G差异值,C_R/G i为所述第j个区块群中第i个区块的第二R/G值,P为所述第j个区块群中区块的个数,Avg_C_R/G为所述第j个区块群中所有区块的第二R/G值的平均值; Where R/G_DV j is the R/G difference value of the j-th block group in all block groups, and C_R/G i is the second R/G of the i-th block in the j-th block group. a value, P is the number of blocks in the j-th block group, and Avg_C_R/G is an average value of second R/G values of all blocks in the j-th block group;
    所述B/G差异值的表达式为:The expression of the B/G difference value is:
    B/G_DV j=(|C_B/G 1-Avg_C_B/G|+|C_B/G 2-Avg_C_B/G|+…+|C_B/G P-Avg_C_B/G|)/P其中,B/G_DV j为所有区块群中第j个区块群的B/G差异值,C_B/G i为所述第j个区块群中第i个区块的第二B/G值,Avg_C_B/G为所述第j个区块群中所有区块的第二R/G值的平均值。 B/G_DV j =(|C_B/G 1 -Avg_C_B/G|+|C_B/G 2 -Avg_C_B/G|+...+|C_B/G P -Avg_C_B/G|)/P where B/G_DV j is The B/G difference value of the j-th block group in all block groups, C_B/G i is the second B/G value of the i-th block in the j-th block group, and Avg_C_B/G is the The average of the second R/G values of all the blocks in the jth block group.
  15. 根据权利要求13所述的装置,其特征在于,所述每个预补偿表对应的色彩差异值为所有区块群的R/G差异值的加权平均值与所有区块群的B/G差异值的加权平均值之和;The apparatus according to claim 13, wherein the color difference value corresponding to each of the pre-compensation tables is a weighted average of R/G difference values of all block groups and a B/G difference of all block groups. The sum of the weighted averages of the values;
    所有区块群的R/G差异值的加权平均值的表达式为:The expression for the weighted average of the R/G difference values for all block groups is:
    R/G_TDV=(R/G_DV 1*V 1/N 1+R/G_DV 2*V 2/N 2+…+R/G_DV K*V K/N K)/K R/G_TDV=(R/G_DV 1 *V 1 /N 1 +R/G_DV 2 *V 2 /N 2 +...+R/G_DV K *V K /N K )/K
    其中,R/G_TDV表示所有区块群的R/G差异值的加权平均值,R/G_DV j为所有区块群中第j个区块群的R/G差异值,V j为所述第j个区块群对应的目标群的空间大小值,N j为所述第j个区块群中区块的个数,K为所有区块群的个数; Where R/G_TDV represents the weighted average of the R/G difference values of all block groups, and R/G_DV j is the R/G difference value of the jth block group in all block groups, and V j is the said The spatial size value of the target group corresponding to the j block groups, N j is the number of blocks in the jth block group, and K is the number of all block groups;
    所有区块群的B/G差异值的加权平均值的表达式为:The expression for the weighted average of the B/G difference values for all block groups is:
    B/G_TDV=(B/G_DV 1*V 1/N 1+B/G_DV 2*V 2/N 2+…+B/G_DV K*V K/N K)/K B/G_TDV=(B/G_DV 1 *V 1 /N 1 +B/G_DV 2 *V 2 /N 2 +...+B/G_DV K *V K /N K )/K
    其中,B/G_TDV表示所有区块群的B/G差异值的加权平均值,B/G_DV j为所有区块群中第j个区块群的B/G差异值。 Where B/G_TDV represents the weighted average of the B/G difference values of all block groups, and B/G_DV j is the B/G difference value of the jth block group in all block groups.
  16. 一种图像处理装置,其特征在于,包括:An image processing apparatus, comprising:
    存储器,用于存储程序;Memory for storing programs;
    处理器,用于读取所述存储器中的程序并执行权利要求1至8中任一项所述的图像处理方法。a processor for reading a program in the memory and performing the image processing method according to any one of claims 1 to 8.
  17. 一种计算机可读存储介质,其特征在于,包括指令,当其在计算机上运行时,使得计算机执行如权利要求1至8中任一项所述的方法。A computer readable storage medium, comprising instructions that, when run on a computer, cause the computer to perform the method of any one of claims 1-8.
  18. 一种计算机程序产品,其特征在于,当其在计算机上运行时,使得计算机执行如权利要求1至8中任一项所述的方法。A computer program product, characterized in that it, when run on a computer, causes the computer to perform the method of any one of claims 1 to 8.
PCT/CN2019/070980 2018-01-12 2019-01-09 Image processing method and device WO2019137396A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810031621.4A CN110033412B (en) 2018-01-12 2018-01-12 Image processing method and device
CN201810031621.4 2018-01-12

Publications (1)

Publication Number Publication Date
WO2019137396A1 true WO2019137396A1 (en) 2019-07-18

Family

ID=67219308

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/070980 WO2019137396A1 (en) 2018-01-12 2019-01-09 Image processing method and device

Country Status (2)

Country Link
CN (1) CN110033412B (en)
WO (1) WO2019137396A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111429534B (en) * 2020-02-17 2020-11-13 深圳市六六六国际旅行社有限公司 Image color cast correction method and device
CN115499631A (en) * 2022-09-09 2022-12-20 北京紫光展锐通信技术有限公司 Image processing method and device, chip and module equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007136234A1 (en) * 2006-05-24 2007-11-29 Mtekvision Co., Ltd. Apparatus and method for compensating color, and image processor, digital processing apparatus, recording medium using it
CN101815158A (en) * 2009-02-20 2010-08-25 华晶科技股份有限公司 Compensation method for improving color shadow in digital images
CN104683774A (en) * 2013-11-27 2015-06-03 英特尔公司 Techniques to reduce color artifacts in a digital image
CN106507081A (en) * 2016-10-12 2017-03-15 成都西纬科技有限公司 A kind of image processing method and device
CN106664351A (en) * 2014-09-26 2017-05-10 英特尔公司 Method and system of lens shading color correction using block matching

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103179322B (en) * 2011-12-20 2016-03-02 联想(北京)有限公司 A kind of image color correction method and electronic equipment
KR101920816B1 (en) * 2013-07-08 2018-11-21 한화테크윈 주식회사 White balance method for shading compensation, and apparatus applied to the same
EP3001668A1 (en) * 2014-09-24 2016-03-30 Thomson Licensing Method for compensating for color differences between different images of a same scene

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007136234A1 (en) * 2006-05-24 2007-11-29 Mtekvision Co., Ltd. Apparatus and method for compensating color, and image processor, digital processing apparatus, recording medium using it
CN101815158A (en) * 2009-02-20 2010-08-25 华晶科技股份有限公司 Compensation method for improving color shadow in digital images
CN104683774A (en) * 2013-11-27 2015-06-03 英特尔公司 Techniques to reduce color artifacts in a digital image
CN106664351A (en) * 2014-09-26 2017-05-10 英特尔公司 Method and system of lens shading color correction using block matching
CN106507081A (en) * 2016-10-12 2017-03-15 成都西纬科技有限公司 A kind of image processing method and device

Also Published As

Publication number Publication date
CN110033412A (en) 2019-07-19
CN110033412B (en) 2023-12-15

Similar Documents

Publication Publication Date Title
US10609352B2 (en) White balance processing method, electronic device and computer readable storage medium
US10616544B2 (en) White balance processing method, electronic device and computer readable storage medium
US9214010B2 (en) Image processing apparatus, image processing method, and program product
TWI660633B (en) White balance calibration method based on skin color data and image processing apparatus thereof
Peng et al. Image haze removal using airlight white correction, local light filter, and aerial perspective prior
JP2010220197A (en) Device and method for detecting shadow in image
CN113393540B (en) Method and device for determining color edge pixel points in image and computer equipment
WO2021218603A1 (en) Image processing method and projection system
CN113516939B (en) Brightness correction method and device, display equipment, computing equipment and storage medium
WO2019137396A1 (en) Image processing method and device
CN112788322B (en) Adaptive white balance processing method, device, medium, and electronic apparatus
CN111587573B (en) Image processing method and device and computer storage medium
WO2022036539A1 (en) Color consistency correction method and device for multiple cameras
JP2020102666A (en) Image processing device, imaging apparatus, image processing method, and program
JP2013085074A (en) Image processing apparatus, imaging apparatus, image processing method and image processing program
WO2018209984A1 (en) Image processing method and apparatus
CN113793291A (en) Image fusion method and device, electronic equipment and storage medium
CN116233381A (en) Color correction method and device, electronic equipment and storage medium
CN113709438A (en) Image white balance correction method and device, storage medium and equipment
CN116419076B (en) Image processing method and device, electronic equipment and chip
KR102315200B1 (en) Image processing apparatus for auto white balance and processing method therefor
CN114630095B (en) Automatic white balance method and device for target scene image and terminal
TWI685260B (en) Image adjustment method and associated image processing circuit
CN117499616A (en) Control method, system, equipment and medium for camera module lens shading correction
CN115170407A (en) Image processing method, image processing device, electronic equipment and computer readable 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: 19738849

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: 19738849

Country of ref document: EP

Kind code of ref document: A1