WO2018209984A1 - 图像处理方法和装置 - Google Patents
图像处理方法和装置 Download PDFInfo
- Publication number
- WO2018209984A1 WO2018209984A1 PCT/CN2018/071894 CN2018071894W WO2018209984A1 WO 2018209984 A1 WO2018209984 A1 WO 2018209984A1 CN 2018071894 W CN2018071894 W CN 2018071894W WO 2018209984 A1 WO2018209984 A1 WO 2018209984A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- color space
- white point
- gamut mapping
- image data
- component
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 21
- 238000013507 mapping Methods 0.000 claims abstract description 152
- 238000012545 processing Methods 0.000 claims abstract description 54
- 238000000034 method Methods 0.000 claims description 59
- 238000012937 correction Methods 0.000 claims description 33
- 238000006243 chemical reaction Methods 0.000 claims description 15
- 238000012512 characterization method Methods 0.000 claims description 2
- 230000006870 function Effects 0.000 description 9
- 239000011159 matrix material Substances 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 238000004590 computer program Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N9/00—Details of colour television systems
- H04N9/64—Circuits for processing colour signals
- H04N9/643—Hue control means, e.g. flesh tone control
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/70—Circuitry for compensating brightness variation in the scene
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/70—Circuitry for compensating brightness variation in the scene
- H04N23/71—Circuitry for evaluating the brightness variation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/70—Circuitry for compensating brightness variation in the scene
- H04N23/76—Circuitry for compensating brightness variation in the scene by influencing the image signals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/80—Camera processing pipelines; Components thereof
- H04N23/84—Camera processing pipelines; Components thereof for processing colour signals
- H04N23/88—Camera processing pipelines; Components thereof for processing colour signals for colour balance, e.g. white-balance circuits or colour temperature control
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/95—Computational photography systems, e.g. light-field imaging systems
Definitions
- the present disclosure relates to image processing techniques, for example, to an image processing method and apparatus.
- the same ambient light source usually adopts the same processing method. If the same ambient light source is used in different environments (for example, the same light source is used indoors and outdoors), the same image processing method is adopted, which may result in severe color cast of the processed image.
- An image processing method and apparatus are provided, which can reduce the color cast of an image processed by the same image processing method when the same ambient light source is used in different environments.
- An image processing method comprising:
- the performing the gamut mapping processing on the first image data according to the gamut mapping relationship comprises:
- the method further includes: determining a first ambient light source corresponding to the first image data;
- the method further includes: setting a first white point gain adjustment coefficient corresponding to the plurality of ambient light sources;
- the determining the gamut mapping relationship according to the multiple components of the white point in the color space and the preset first white point gain adjustment coefficient including:
- the color space when the color space is a red, green and blue RGB color space, the color is determined according to a value of a plurality of components of the white point in the color space and the second white point gain adjustment coefficient.
- Domain mapping relationships including:
- the determining the first ambient light source corresponding to the first image data comprises: determining a first ambient light source corresponding to the first image data by using a white balance algorithm.
- the gamut mapping relationship is used to characterize the correspondence between the blue chrominance Cb component of the YUV color space after the gamut mapping process and the Cb component of the YUV color space before the gamut mapping process, and the gamut mapping.
- the determining the white point of the first image data comprises: determining a white point in the first image data by using a white balance algorithm.
- An image processing apparatus includes an acquisition module, a first determination module, a second determination module, and a processing module; wherein
- the obtaining module is configured to acquire first image data
- the first determining module is configured to determine a white point in the first image data
- the second determining module is configured to determine a gamut mapping relationship according to the plurality of components of the white point in the color space and a preset first white point gain adjustment coefficient, where the gamut mapping relationship is used for characterization The correspondence between the components in the color space processed by the gamut mapping and the components in the color space before the gamut mapping processing;
- the processing module is configured to perform gamut mapping processing on the first image data according to the gamut mapping relationship, to obtain second image data processed by gamut mapping.
- the processing module when the first image data includes image data of a face image, is configured to perform color gamut on the face region in the first image data according to the gamut mapping relationship. Mapping processing.
- the device further includes a setting module, wherein the setting module is configured to set a first white point gain adjustment coefficient corresponding to the plurality of ambient light sources before determining the color gamut mapping relationship;
- the first determining module is further configured to: after acquiring the first image data, determine a first ambient light source corresponding to the first image data;
- the second determining module is configured to select, in the at least one first white point gain adjustment coefficient, a first white point gain adjustment coefficient corresponding to the first ambient light source as a second white point gain adjustment coefficient;
- the color gamut mapping relationship is determined by a value of a plurality of components of the white point in the color space and the second white point gain adjustment coefficient.
- the second determining module is configured to set a first value of the plurality of components in the RGB color space according to each white point and the RGB color space when the color space is a red, green, and blue RGB color space.
- a conversion relationship to the YUV color space a second value of each of the plurality of components of the white point in the YUV color space is obtained; and each of the white points is in accordance with the second white point gain adjustment coefficient Correcting a first value of each of at least two components in the RGB color space to obtain a first correction value of each of the at least two components of the white point in the RGB color space; according to at least two first Correcting a value, and the conversion relationship, obtaining a second correction value of each of the at least two components of the white point in the YUV color space; and placing each of the white points in the YUV color space
- the mapping relationship between the second value of each of the at least two components and the at least two second correction values of the corresponding white point is determined as: the gamut mapping relationship.
- the first determining module is configured to determine a first ambient light source corresponding to the first image data by using a white balance algorithm.
- the gamut mapping relationship is used to characterize the correspondence between the blue chrominance Cb component of the YUV color space after the gamut mapping process and the Cb component of the YUV color space before the gamut mapping process, and the gamut mapping.
- the first determining module is configured to determine a white point in the first image data using a white balance algorithm.
- a computer readable storage medium storing computer executable instructions arranged to perform the above method.
- a terminal comprising:
- At least one processor At least one processor
- the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to cause the at least one processor to perform the method described above.
- FIG. 1 is a flowchart of an image processing method provided by an embodiment
- FIG. 3 is a schematic structural diagram of an image processing apparatus according to an embodiment.
- FIG. 4 is a schematic structural diagram of a hardware of a terminal according to an embodiment.
- An embodiment discloses an image processing method that can be applied to a terminal having a photographing function.
- the terminal may be a fixed terminal such as a computer, or may be a mobile terminal, and the mobile terminal includes a tablet device, a personal digital assistant (PDA), a handheld device, a laptop computer, a smartbook, and a netbook.
- PDA personal digital assistant
- the terminal described above may be photographed using one or more cameras.
- the position and number of the camera of the terminal are exemplarily illustrated by only a few examples.
- the terminal is a mobile terminal, the number of cameras of the mobile terminal is 1 or 2, and the camera of the mobile terminal may be located at the front side of the mobile terminal (front The camera can also be located on the back side of the mobile terminal (rear camera).
- the terminal may process the image data by using a white balance algorithm, for example, determining an ambient light source corresponding to the image data, and determining a white point in the image data.
- a white balance algorithm can be a gray world method.
- FIG. 1 is a flowchart of an image processing method according to the embodiment. As shown in FIG. 1, the flow includes the following steps.
- step 101 first image data is acquired.
- Step 101 can be implemented using at least one camera.
- the shooting resolution of the camera is not limited, for example, the shooting resolution is 1024 ⁇ 768 pixels, or 1920 ⁇ 1080 pixels.
- the first image data may be image data including a face image.
- step 102 a white point in the first image data is determined.
- the determined number of white points may be greater than 1, and after determining the white point in the image data, a plurality of components of the white point in the color space may also be determined.
- the types of color spaces include Red Green Blue (RGB) color space (RGB domain) and YUV color space (YUV domain), which can determine multiple components or white points of white point in RGB color space. Multiple components in the YUV color space.
- RGB Red Green Blue
- RGB domain Red Green Blue
- YUV domain YUV color space
- the components of the white point in the RGB color space are the R component, the B component, and the G component;
- the components of the white point in the YUV color space are the luminance component (Y component) and the blue chrominance component (Cb).
- the component i.e., V component
- the red chrominance component Cr component (i.e., U component)); wherein the Y component is a luminance component, and the Cb component and the Cr component are both chrominance components.
- a white point in the first image data can be determined using a white balance algorithm.
- the first ambient light source corresponding to the first image data may also be determined by using a white balance algorithm. For example, when the white point in the current first image data is counted by using the white balance algorithm, that is, when the r/g and b/g of the pixel in the image satisfy the gray zone condition, the pixel point is determined as the white point falling into the gray zone. .
- r/g represents the ratio of the R component to the G component of the pixel
- b/g represents the ratio of the B component to the G component of the pixel.
- An average value can be calculated for a specific parameter of the white point falling into the gray area, and the calculated average value is respectively different from the value of the specific parameter of the reference point of each standard light source, and a plurality of differences are obtained, and the smallest difference is obtained.
- the standard light source corresponding to the value is determined as an ambient light source corresponding to the first image data, wherein the specific parameter may be a pixel value, a luminance component, or a chrominance component.
- the gamut mapping relationship is determined according to the plurality of components of the white space in the color space and the preset first white point gain adjustment coefficient, where the gamut mapping relationship is used to represent the gamut mapping process. The correspondence between the components in the color space and the components in the color space before the gamut mapping process.
- the gamut mapping relationship is used to characterize the correspondence between the Cb component in the YUV color space after the gamut mapping process and the chrominance component in the YUV color space before the gamut mapping process, and the gamut mapping process.
- the gamut mapping relationship is used to characterize the correspondence between the Cb component in the YUV color space after the gamut mapping process and the Cb component in the YUV color space before the gamut mapping process, and the gamut mapping process.
- the preset first white point gain adjustment coefficient may include a gain coefficient of at least one channel (ie, component) of the RGB color space; for example, the first white point gain adjustment coefficient may include an R channel gain of the RGB color space.
- the coefficient (ie, the R component gain coefficient) and the B channel gain coefficient (B component gain coefficient) of the RGB color space may include a gain coefficient of at least one channel (ie, component) of the RGB color space.
- the white point gain adjustment coefficient corresponding to the plurality of ambient light sources may be preset, and the white point gain adjustment coefficient corresponding to each ambient light source is set according to the user's personal needs (or preferences), wherein the white point gain adjustment coefficient set by the user may be used Improve the color cast of the image.
- the first white point gain adjustment coefficient set by the user is used to implement skin color enhancement, that is, the first white point gain adjustment coefficient set by the user is used to correspond to the image under the ambient light source.
- the skin color enhancement effect required by the user can be achieved.
- the first white point gain adjustment coefficient may be a white balance gain coefficient
- the ambient light source may be a standard light source, wherein the standard light source includes: a D75 light source, a D65 light source, a D50 light source, a TL84 light source, an A light source, and an H light source.
- the determining the gamut mapping relationship according to the plurality of components of the white point in the color space and the preset first white point gain adjustment coefficient including:
- determining the color gamut mapping relationship according to the plurality of components of the white point in the color space and the second white point gain adjustment coefficient including:
- a mapping relationship between a second value of each of the white points in at least two components of the YUV color space and at least two second correction values of the corresponding white points is determined as: a gamut mapping relationship.
- RGB color space YUV color space
- R, G, and B represent the value of the R component of the RGB color space, the value of the G component, and the value of the B component, respectively
- Y, Cb, and Cr represent the value of the Y component of the YUV color space, the value of the Cb component, and Cr, respectively.
- the value of the component is the value of the component.
- the second white point gain adjustment coefficient includes an R channel gain coefficient a1, a B channel gain coefficient a2, and a G channel gain coefficient a3 of the RGB color space; among the determined plurality of white points, a white point
- the values of the R component, the B component, and the G component of the white point in the RGB color space are denoted as R', B', and G', respectively.
- the correction values of the R component, the B component, and the G component of the white point in the RGB color space are a1*R', a2*B', and a3*G', respectively, and the value of the R component of the white point in the RGB color space, B.
- the value of the component and the value of the G component can be expressed by the gamut coordinates (R', B', G'), and the correction values of the R component, the B component, and the G component of the white point in the RGB color space can be determined by the gamut coordinates ( A1*R', a2*B', a3*G') indicates.
- the value of the multi-component of the white point in the YUV color space can be obtained according to the value of the multi-component of the white point in the RGB color space and the conversion relationship of the RGB color space to the YUV color space.
- the value of the Y component of the YUV color space of the obtained white point, the value of the Cb component, and the value of the Cr component are respectively denoted as Y', Cb', and Cr', and at this time, the YUV color space of the white point is obtained.
- the value of the Y component, the value of the Cb component, and the value of the Cr component can be expressed by color gamut coordinates (Y', Cb', Cr').
- the correction values of the plurality of components of the white point in the YUV color space can be obtained, and the corrected values of the Y component, the Cb component, and the Cr component of the white point in the YUV color space are respectively recorded as Y", Cb", and Cr.
- the correction values of the Y component, the Cb component, and the Cr component of the obtained YUV color space of the white point can be expressed by the color gamut coordinates (Y", Cb", Cr").
- mapping relationship of the gamut coordinates (Y', Cb', Cr') to (Y", Cb", Cr") can be expressed by the following formula:
- A represents a matrix of size 3*3.
- Matrix A represents the gamut mapping relationship.
- the values of the plurality of components of the white point in the YUV color space and the correction values of the plurality of components of the corresponding white point in the YUV color space may be obtained for a plurality of determined white points.
- the mapping relationship, and then the establishment of multiple linear equations to solve the matrix A may be obtained for a plurality of determined white points.
- the second white point gain adjustment factor includes an R channel gain coefficient k1, a B channel gain coefficient k2, and a G channel gain coefficient k3 of the RGB color space; wherein the G channel gain coefficient k3 is equal to one.
- a white point is taken as an example for description, and the value of the R component, the value of the B component, and the value of the G component of the white point in the RGB color space are respectively recorded as R0, B0 and G0, the correction values of the R component, the B component, and the G component of the white point in the RGB color space are k1*R0, k2*B0, and k3*G0, respectively, that is, the R component of the RGB color space of the white point.
- the value of the value, the value of the B component, and the value of the G component can be expressed by the color gamut coordinates (R0/G0, B0/G0, 1), and the correction values of the R component, the B component, and the G component of the RGB color space of the white point can be used.
- the gamut coordinates (k1*R0/G0, k2*B0/G0, 1) indicate, among them. * is a multiplication operator, / is a division operator.
- the value of at least one component of the white point in the YUV color space may be derived from the value of at least one component of the white point in the RGB color space and the conversion relationship of the RGB color space to the YUV color space.
- the values of the Y component, the value of the Cb component, and the value of the Cr component of the obtained white point in the YUV color space are respectively recorded as Y0, Cb0, and Cr0, and the resulting white point is in the YUV color space.
- the value of the Y component, the value of the Cb component, and the value of the Cr component can be expressed by color gamut coordinates (Y0, Cb0, Cr0).
- a correction value of at least one component of the white point in the YUV color space can be obtained; wherein the corrected values of the Y component, the Cb component, and the Cr component of the YUV color space of the obtained white point are respectively recorded as Y1, Cb1, and Cr1, At this time, the correction values of the Y component, the Cb component, and the Cr component of the obtained YUV color space of the white point can be expressed by the color gamut coordinates (Y1, Cb1, Cr1).
- mapping relationship of the gamut coordinates (Y', Cb', Cr') to (Y", Cb", Cr") can be expressed by the following formula:
- B represents a matrix of size 2*3.
- the matrix B represents the gamut mapping relationship; in order to solve the matrix B, the value of the chrominance component of the white point in the YUV color space and the color of the corresponding white point in the YUV color space can be obtained for a plurality of determined white points. The mapping relationship of the correction values of the degree components, and then a plurality of linear equations are established to solve the matrix B.
- matrix B can be expressed as:
- step 104 the first image data is subjected to gamut mapping processing according to the gamut mapping relationship, and second color image data subjected to gamut mapping processing is obtained.
- the gamut mapping process may be performed on the face region in the first image data according to the gamut mapping relationship to obtain the color gradation.
- the domain maps the processed image data.
- the gamut mapping process may be performed on the face region in the image data according to the determined ambient light source.
- the gamut mapping relationship can also meet the requirements of the scene, and the face area in the image data can be improved.
- the skin color enhancement effect can overcome the problem of color cast color which occurs when the same light source is used in different environments in the related art, and achieves the effect of adaptive skin color enhancement.
- the acquired first image data includes image data of a face image.
- FIG. 2 is a flowchart of an image processing method according to an embodiment. As shown in FIG. 2, the flow includes the following steps.
- step 201 the first image data is acquired.
- step 201 can be the same as step 101.
- step 202 the white point algorithm is used to count the white point and perform the ambient light source judgment.
- the step 202 can be implemented by a device such as a processor of the terminal, and the implementation of step 202 can be the same as step 102.
- step 203 a face area is detected.
- the image data can be identified by a face recognition algorithm to derive a face region in the image data.
- step 204 a gamut mapping relationship is determined.
- step 204 can be the same as step 103.
- step 205 gamut mapping processing is performed on the face region in the first image data according to the gamut mapping relationship, and image data processed by gamut mapping is obtained.
- step 205 can be the same as step 104.
- only the face region in the first image data is subjected to gamut mapping processing, and for other regions in the first image data, gamut mapping processing is not performed, and the gamut of the face region is performed. Mapping processing does not affect other areas.
- the user may decide whether to adopt the image processing method in the above embodiment according to the requirement.
- the user decides to adopt the image processing method of the embodiment of the present invention, if the first image data including the face image is collected, The skin tone enhancement is automatically performed based on the above method.
- an embodiment proposes an image processing apparatus.
- FIG. 3 is a schematic structural diagram of an image processing apparatus according to an embodiment. As shown in FIG. 3, the apparatus includes: an obtaining module 301, a first determining module 302, a second determining module 303, and a processing module 304.
- the acquisition module 301 is configured to acquire first image data.
- the first determining module 302 is configured to determine a white point in the first image data.
- the second determining module 303 is configured to determine a gamut mapping relationship according to the plurality of components of the white point in the color space and a preset first white point gain adjustment coefficient, where the gamut mapping relationship is used to represent the gamut mapping The correspondence between the components in the processed color space and the components in the color space before the gamut mapping process.
- the processing module 304 is configured to perform gamut mapping processing on the first image data according to the gamut mapping relationship to obtain second image data after gamut mapping processing.
- the processing module 304 is configured to color the face region in the first image data according to the gamut mapping relationship. Domain mapping processing.
- the apparatus further includes a setting module 305, the setting module 305 is configured to set a first white point gain adjustment coefficient corresponding to each ambient light source as a second white point gain adjustment before determining a color gamut mapping relationship. coefficient.
- the first determining module 302 may be further configured to determine, after the second image data, a first ambient light source corresponding to the first image data by using a white balance algorithm.
- the second determining module 303 may be configured to: in the at least one second white point gain adjustment coefficient, select a second white point gain adjustment coefficient corresponding to the first ambient light source; and according to the white point in the color space
- the color gamut mapping relationship is determined by a value of the plurality of components and the second white point gain adjustment coefficient.
- the second determining module 303 is configured to set a first value of a plurality of components in the RGB color space according to each white point and an RGB color space when the color space is an RGB color space. a conversion relationship of the YUV color space, obtaining a second value of the plurality of components of each white point in the YUV color space; according to the second white point gain adjustment coefficient, the each white point is Correcting a first value of each of at least two components in the RGB color space to obtain a first correction value of each of the at least two components of the white point in the RGB color space; according to at least two first corrections a value, and a conversion relationship of the RGB color space to the YUV color space, a second correction value of each of the at least two components of the white point in the YUV color space is obtained; and each of the white points is A mapping relationship between a second value of each of the at least two components in the YUV color space to at least two second correction values of the corresponding white point is determined as: a gamut mapping relationship
- the first determining module 302 is configured to determine a first ambient light source corresponding to the first image data by using a white balance algorithm.
- the gamut mapping relationship is used to represent the correspondence between the Cb component of the YUV color space after the gamut mapping process and the chrominance component of the YUV color space before the gamut mapping process, and after the gamut mapping process.
- the first determining module 302 is configured to determine a white point in the first image data using a white balance algorithm.
- the obtaining module 301 can be implemented by a camera in the terminal, and the first determining module 302, the second determining module 303, and the processing module 304 can each be a central processing unit (CPU) and a microprocessor (Micro Processor Unit) located in the terminal. , MPU), digital signal processor (DSP), or Field Programmable Gate Array (FPGA) implementation.
- CPU central processing unit
- DSP digital signal processor
- FPGA Field Programmable Gate Array
- the above embodiments may be provided as a method, system, or computer program product. Therefore, the above technical solution may take the form of a hardware embodiment, a software embodiment, or an embodiment of a combination of software and hardware.
- the above technical solution may take the form of a computer program product embodied on one or more computer usable storage media (including disk storage and optical storage, etc.) containing computer usable program code.
- the computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine such that instructions generated by a processor of a computer or other programmable data processing device can be At least one of the following means is implemented: means for specifying a function in one or more flows of a flowchart, and means for blocking a function specified in a block or a plurality of blocks.
- the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
- the apparatus may implement at least one of the following: a device that specifies a function in one or more flows of the flowchart, and a device that blocks the functions specified in one or more of the blocks.
- These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
- the instructions provide steps for implementing at least one of the following: a function of a function specified in a flow or a flow of a flowchart, and a block diagram of a function specified in a block or a plurality of blocks.
- An embodiment provides a computer readable storage medium storing computer executable instructions arranged to perform the method of any of the above embodiments.
- the terminal includes:
- At least one processor 40 is exemplified by a processor 40 in FIG. 4; a memory 41; and a communication interface 42 and a bus 43.
- the processor 40, the memory 41, and the communication interface 42 can complete communication with each other through the bus 43.
- the processor 40 can call the logic instructions in the memory 41 to perform the methods in the above embodiments.
- logic instructions in the memory 41 described above may be implemented in the form of a software functional unit and sold or used as a stand-alone product, and may be stored in a computer readable storage medium.
- the memory 41 is a computer readable storage medium and can be used to store a software program, a computer executable program, such as a program instruction or a module corresponding to the method in the above embodiment.
- the processor 40 executes the functional application and data processing by executing software programs, instructions or modules stored in the memory 41, i.e., implements the methods in the above embodiments.
- the memory 41 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function; the storage data area may store data created according to use of the terminal device, and the like. Further, the memory 41 may include a high speed random access memory, and may also include a nonvolatile memory.
- the above technical solution may be embodied in the form of a software product stored in a storage medium, including one or more instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to execute All or part of the steps of the method described in the above embodiments.
- the foregoing storage medium may be a non-transitory storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
- the image processing method and apparatus can reduce the color cast of an image processed by the same image processing method when the same ambient light source is used in different environments.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
一种图像处理方法包括:获取第一图像数据;确定所述第一图像数据中的白点;根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,其中,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系;以及按照所述色域映射关系,对所述第一图像数据进行色域映射处理,得到经色域映射处理后的第二图像数据。还提供了一种图像处理装置。
Description
本公开涉及图像处理技术,例如,涉及一种图像处理方法和装置。
在图像处理过程中,相同的环境光源通常采用同一种处理方式。如果在不同的环境下使用同一种环境光源(例如在室内和室外采用相同的光源),采用相同的图像处理方式,如此,可能导致处理后的图像出现严重偏色。
发明内容
提供一种图像处理方法和装置,能够降低在不同的环境下使用同一种环境光源时采用相同的图像处理方式处理后的图像出现的偏色。
一种图像处理方法,包括:
获取第一图像数据;
确定所述第一图像数据中的白点;
根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,其中,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系;以及
按照所述色域映射关系,对所述第一图像数据进行色域映射处理,得到经色域映射处理后的第二图像数据。
一实施例中,所述第一图像数据包含人脸图像的图像数据时,所述按照所述色域映射关系,对所述第一图像数据进行色域映射处理,包括:
按照所述色域映射关系,对所述第一图像数据中的人脸区域进行色域映射处理。
一实施例中,在所述获取所述第一图像数据后,所述方法还包括:确定所述第一图像数据对应的第一环境光源;以及
在所述确定色域映射关系前,所述方法还包括:设置多个环境光源对应的第一白点增益调节系数;
其中,所述根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,包括:
在至少一个第一白点增益调节系数中,选取所述第一环境光源对应的第一白点增益调节系数作为第二白点增益调节系数;以及根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定所述色域映射关系。
一实施例中,所述颜色空间为红绿蓝RGB颜色空间时,所述根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定所述色域映射关系,包括:
根据每个白点在RGB颜色空间中的多个分量的第一数值、以及RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在YUV颜色空间中的多个分量的第二数值;
根据所述第二白点增益调节系数,对所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一数值进行修正,得到所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一修正值;
根据至少两个第一修正值、以及所述转换关系,得出所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二修正值;以及
将所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二数值与对应白点的至少两个第二修正值之间的映射关系确定为:所述色域映射关系。
一实施例中,所述确定所述第一图像数据对应的第一环境光源,包括:利用白平衡算法确定所述第一图像数据对应的第一环境光源。
一实施例中,所述色域映射关系用于表征色域映射处理后的YUV颜色空间的蓝色色度Cb分量与色域映射处理前的YUV颜色空间的Cb分量的对应关系、以及色域映射处理后的YUV颜色空间的红色色度Cr分量与色域映射处理前的YUV颜色空间的Cr分量的对应关系;其中,所述YUV颜色空间的色度分量包括所述Cb分量和所述Cr分量。
一实施例中,所述确定所述第一图像数据的白点,包括:利用白平衡算法 确定所述第一图像数据中的白点。
一种图像处理装置,包括获取模块、第一确定模块、第二确定模块和处理模块;其中,
所述获取模块设置为获取第一图像数据;
所述第一确定模块设置为确定所述第一图像数据中的白点;
所述第二确定模块设置为根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,其中,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系;以及
所述处理模块设置为按照所述色域映射关系,对所述第一图像数据进行色域映射处理,得到经色域映射处理后的第二图像数据。
一实施例中,所述第一图像数据包含人脸图像的图像数据时,所述处理模块,设置为按照所述色域映射关系,对所述第一图像数据中的人脸区域进行色域映射处理。
一实施例中,所述的装置,还包括设置模块,其中,所述设置模块设置为在确定色域映射关系前,设置多个环境光源对应的第一白点增益调节系数;
所述第一确定模块还设置为在获取所述第一图像数据后,确定所述第一图像数据对应的第一环境光源;
所述第二确定模块,设置为在至少一个第一白点增益调节系数中,选取所述第一环境光源对应的第一白点增益调节系数作为第二白点增益调节系数;以及根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定所述色域映射关系。
一实施例中,所述第二确定模块设置为在所述颜色空间为红绿蓝RGB颜色空间时,根据每个白点在RGB颜色空间中的多个分量的第一数值、以及RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在YUV颜色空间中的多个分量的第二数值;根据所述第二白点增益调节系数,对所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一数值进行修正,得到所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一修正值;根据至少两个 第一修正值、以及所述转换关系,得出所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二修正值;以及将所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二数值与对应白点的至少两个第二修正值之间的映射关系确定为:所述色域映射关系。
一实施例中,所述第一确定模块,设置为利用白平衡算法确定所述第一图像数据对应的第一环境光源。
一实施例中,所述色域映射关系用于表征色域映射处理后的YUV颜色空间的蓝色色度Cb分量与色域映射处理前的YUV颜色空间的Cb分量的对应关系、以及色域映射处理后的YUV颜色空间的红色色度Cr分量与色域映射处理前的YUV颜色空间的Cr分量的对应关系;其中,所述YUV颜色空间的色度分量包括所述Cb分量和所述Cr分量。
一实施例中,所述第一确定模块设置为利用白平衡算法确定所述第一图像数据中的白点。
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行上述方法。
一种终端,包括:
至少一个处理器;以及
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器执行上述的方法。
图1为一实施例提供的图像处理方法的流程图;
图2为另一实施例提供的图像处理方法的流程图;
图3为一实施例提供的图像处理装置的组成结构示意图;以及
图4是一实施例提供的终端的硬件结构示意图。
一实施例公开了一种图像处理方法,该图像处理方法可以应用于具有拍摄功能的终端中。终端可以是计算机等固定终端,也可以是移动终端,移动终端包括平板设备、个人数字助理(Personal Digital Assistant,PDA)、手持式设备、膝上型计算机、智能本以及上网本。
在一实施例中,上述记载的终端可以采用一个或多个摄像头进行拍摄。下面仅仅通过几个例子对终端的摄像头的位置和数目进行示例性说明,例如,终端为移动终端,移动终端的摄像头的个数为1或2,移动终端的摄像头可以位于移动终端前侧(前置摄像头),也可以位于移动终端后侧(后置摄像头)。
一实施例中,终端在获取通过摄像头拍摄的图像数据后,可以利用白平衡算法对该图像数据进行处理,例如,可以判断图像数据对应的环境光源,并确定图像数据中的白点。在一个示例中,白平衡算法可以是灰度世界法。
基于上述记载的终端、摄像头和白平衡算法,提出以下多个实施例。
一实施例提供了一种图像处理方法,图1为本实施例的图像处理方法的流程图,如图1所示,该流程包括以下步骤。
步骤101中,获取第一图像数据。
可以采用至少一个摄像头实现步骤101。在利用摄像头进行拍摄时,并不对摄像头的拍摄分辨率进行限制,例如,拍摄分辨率为1024×768像素,或1920×1080像素。
示例性地,第一图像数据可以是包含人脸图像的图像数据。
步骤102中,确定所述第一图像数据中的白点。
步骤102中,确定的白点的个数可以大于1,在确定图像数据中的白点后,还可以确定所述白点在颜色空间中的多个分量。
示例性地,颜色空间的种类包括红绿蓝(Red Green Blue,RGB)颜色空间(RGB域)和YUV颜色空间(YUV域),可以确定白点在RGB颜色空间中的多个分量或白点在YUV颜色空间中的多个分量。
其中,白点在RGB颜色空间中的分量为R分量、B分量和G分量;白点在YUV颜色空间(也称YCrCb)中的各分量为亮度分量(Y分量)、蓝色色度分量(Cb分量(也即V分量))和红色色度分量(Cr分量(也即U分量));其中, Y分量为亮度分量,Cb分量和Cr分量均为色度分量。
可以利用白平衡算法确定所述第一图像数据中的白点。
一实施例中,在获取包含人脸图像的第一图像数据后,还可以利用白平衡算法确定所述第一图像数据对应的第一环境光源。例如,在利用白平衡算法统计当前第一图像数据中的白点时,即在图像中像素点的r/g和b/g满足灰区条件时,确定像素点为落入灰区的白点。其中,r/g表示像素点的R分量与G分量的比值,b/g表示像素点的B分量与G分量的比值。可以对落入灰区的白点的特定参数计算平均值,将计算出来的平均值与每个标准光源的参考点的特定参数的值分别作差,得出多个差值,将最小的差值对应的标准光源确定为所述第一图像数据对应的环境光源,其中,特定参数可以是像素值、亮度分量或色度分量。
步骤103中,根据所述白点在颜色空间的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,其中,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系。
示例性地,所述色域映射关系用于表征色域映射处理后的YUV颜色空间中的Cb分量与色域映射处理前的YUV颜色空间中的色度分量的对应关系、以及色域映射处理后的YUV颜色空间中的Cr分量与色域映射处理前的YUV颜色空间中的色度分量的对应关系;其中,所述YUV颜色空间的色度分量包括Cb分量和Cr分量。
一实施例中,所述色域映射关系用于表征色域映射处理后的YUV颜色空间中的Cb分量与色域映射处理前的YUV颜色空间中的Cb分量的对应关系、以及色域映射处理后的YUV颜色空间中的Cr分量与色域映射处理前的YUV颜色空间中的Cr分量的对应关系;其中,所述YUV颜色空间的色度分量包括Cb分量和Cr分量。
一实施例中,预先设置的第一白点增益调节系数可以包括RGB颜色空间的至少一个通道(即分量)的增益系数;例如,第一白点增益调节系数可以包括RGB颜色空间的R通道增益系数(即R分量增益系数)和RGB颜色空间的B通道增益系数(B分量增益系数)。
可以预先设置多个环境光源对应的白点增益调节系数,根据用户根据个人 需求(或爱好)设置每个环境光源对应的白点增益调节系数,其中,用户设置的白点增益调节系数可以用于改进图像的偏色。例如,在所第一图像数据包含人脸图像时,用户设置的第一白点增益调节系数用于实现肤色增强,即,采用用户设置的第一白点增益调节系数对对应环境光源下的图像进行白平衡处理后,可以达到用户要求的肤色增强效果。
第一白点增益调节系数可以是白平衡增益系数,环境光源可以是标准光源,其中,标准光源包括:D75光源、D65光源、D50光源、TL84光源、A光源以及H光源。
在一个实施例中,所述根据所白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,包括:
在至少一个环境光源对应的第一白点增益调节系数中,选取第一环境光源对应的第一白点增益调节系数作为第二白点增益调节系数;以及根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定色域映射关系。
一实施例中,所述白点的颜色空间为RGB颜色空间时,所述根据所述白点在颜色空间中的多个分量和第二白点增益调节系数,确定色域映射关系,包括:
根据每个白点在RGB颜色空间中的多个分量的第一数值、以及RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在YUV颜色空间中的至少两个分量各自的第二数值;
根据所述二白点增益调节系数,对所述每个白点在RGB颜色空间中的至少两个分量各自的第一数值进行修正,得到所述每个白点在所述RGB颜色空间中至少两个分量各自的第一修正值;
根据至少两个第一修正值、以及所述RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在YUV颜色空间中的至少两个分量各自的第二修正值;以及
将每个白点在YUV颜色空间中的至少两个分量各自的第二数值与对应白点的至少两个第二修正值之间的映射关系确定为:色域映射关系。
RGB颜色空间到YUV颜色空间的转换关系可以为:
Y=0.257*R+0.564*G+0.098*B+16
Cb=-0.148*R-0.291*G+0.439*B+128
Cr=0.439*R-0.368*G-0.071*B+128
其中,R、G和B分别表示RGB颜色空间的R分量的值、G分量的值和B分量的值,Y、Cb和Cr分别表示YUV颜色空间的Y分量的值、Cb分量的值和Cr分量的值。
在一个示例中,所述第二白点增益调节系数包括RGB颜色空间的R通道增益系数a1、B通道增益系数a2和G通道增益系数a3;在确定的多个白点中,以一个白点为例进行说明,白点在RGB颜色空间中的R分量的值、B分量的值和G分量的值分别记为R’、B’和G’。白点在RGB颜色空间中的R分量、B分量和G分量的修正值分别为a1*R’、a2*B’和a3*G’,白点在RGB颜色空间中的R分量的值、B分量的值和G分量的值可以用色域坐标(R’,B’,G’)表示,白点在RGB颜色空间中的R分量、B分量和G分量的修正值可以用色域坐标(a1*R’,a2*B’,a3*G’)表示。
可以根据白点在RGB颜色空间的多分量的值、以及RGB颜色空间到YUV颜色空间的转换关系,得出白点在YUV颜色空间中的多分量的值。例如,得出的白点的YUV颜色空间的Y分量的值、Cb分量的值和Cr分量的值分别记为Y’、Cb’和Cr’,此时,得出的白点的YUV颜色空间的Y分量的值、Cb分量的值和Cr分量的值可以用色域坐标(Y’,Cb’,Cr’)表示。
可以得出白点在YUV颜色空间中的多个分量的修正值,得出的白点在YUV颜色空间中的Y分量、Cb分量和Cr分量的修正值分别记为Y”、Cb”和Cr”,此时,得出的白点的YUV颜色空间的Y分量、Cb分量和Cr分量的修正值可以用色域坐标(Y”,Cb”,Cr”)表示。
色域坐标(Y’,Cb’,Cr’)到(Y”,Cb”,Cr”)的映射关系可以通过以下公式进行表示:
其中,A表示大小为3*3的矩阵。
矩阵A表示色域映射关系。一实施例中,为了求解矩阵A,可以针对多个确定的白点,得出白点在YUV颜色空间中的多个分量的值与对应白点在YUV颜色空间中的多个分量的修正值的映射关系,进而建立多个线性方程,以求解得出矩阵A。
在一个示例中,所第二白点增益调节系数包括RGB颜色空间的R通道增益系数k1、B通道增益系数k2和G通道增益系数k3;其中,G通道增益系数k3等于1。一实施例中,在确定的至少一个白点中,以一个白点为例进行说明,白点在RGB颜色空间中的R分量的值、B分量的值和G分量的值分别记为R0、B0和G0,白点在RGB颜色空间中的R分量、B分量和G分量的修正值分别为k1*R0、k2*B0和k3*G0,也就是说,白点的RGB颜色空间的R分量的值、B分量的值和G分量的值可以用色域坐标(R0/G0,B0/G0,1)表示,白点的RGB颜色空间的R分量、B分量和G分量的修正值可以用色域坐标(k1*R0/G0,k2*B0/G0,1)表示,其中。*为乘法运算符,/为除法运算符。
可以根据白点在RGB颜色空间中的至少一个分量的值、以及RGB颜色空间到YUV颜色空间的转换关系,得出白点在YUV颜色空间中至少一个分量的值。例如,得出的白点在YUV颜色空间中的Y分量的值、Cb分量的值和Cr分量的值分别记为Y0、Cb0和Cr0,此时,得出的白点在YUV颜色空间中的Y分量的值、Cb分量的值和Cr分量的值可以用色域坐标(Y0,Cb0,Cr0)表示。
可以得出白点在YUV颜色空间中的至少一个分量的修正值;其中,得出的白点的YUV颜色空间的Y分量、Cb分量和Cr分量的修正值分别记为Y1、Cb1和Cr1,此时,得出的白点的YUV颜色空间的Y分量、Cb分量和Cr分量的修正值可以用色域坐标(Y1,Cb1,Cr1)表示。
在忽略掉色域坐标中的Y分量后,色域坐标(Y’,Cb’,Cr’)到(Y”,Cb”,Cr”)的映射关系可以通过以下公式进行表示:
其中,B表示大小为2*3的矩阵。
这里,矩阵B表示色域映射关系;为了求解矩阵B,可以针对多个确定的 白点,得出白点在YUV颜色空间中的色度分量的值与对应白点在YUV颜色空间中的色度分量的修正值的映射关系,进而建立多个线性方程,以求解得出矩阵B。
在一个实现方式中,矩阵B可以表示为:
其中,c和f为已知量。
步骤104中,按照所述色域映射关系,对所述第一图像数据进行色域映射处理,得到经色域映射处理后的第二图像数据。
示例性地,在所述第一图像数据包含人脸图像的图像数据时,可以按照所述色域映射关系,对所述第一图像数据中的人脸区域进行色域映射处理,得到经色域映射处理后的图像数据。
在一实施例中,可以根据所确定的环境光源,对所述图像数据中的人脸区域进行色域映射处理。
应用上述实施例中的图像处理方法,获取第一图像数据;确定所述第一图像数据中的白点;根据所述白点在颜色空间的多分量和预先设置的第一白点增益调节系数,确定色域映射关系,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系;按照所述色域映射关系,对所述图像数据进行色域映射处理,得到经色域映射处理后的图像数据;如此,由于白点增益调节系数可以根据场景需求进行设置,因而色域映射关系也可以符合场景的需求,可以避免出现图像严重偏色的问题,提高了图像的显示效果。
一实施例中,在第一图像数据包含人脸图像时,由于白点增益调节系数可以根据场景需求进行设置,因而色域映射关系也可以符合场景的需求,可以提高图像数据中的人脸区域的肤色增强效果,可以克服相关技术中在不同环境同样光源时出现的肤色偏色的问题,达到自适应肤色增强的效果。
在上述实施例的基础上,对以下实施例进行说明。
在一实施例中,获取的第一图像数据包含人脸图像的图像数据。
图2为一实施例提供的图像处理方法的流程图,如图2所示,该流程包括以下步骤。
步骤201中,获取第一图像数据。
步骤201的实现方式可以与步骤101相同。
步骤202中,利用白平衡算法统计白点并进行环境光源判断。
步骤202可以由终端的处理器等装置实现,步骤202的实现方式可以与步骤102相同。
步骤203中,检测人脸区域。
可以由人脸识别算法对图像数据进行识别,得出图像数据中的人脸区域。
步骤204中,确定色域映射关系。
步骤204的实现方式可以与步骤103相同。
步骤205中,按照所述色域映射关系,对所述第一图像数据中的人脸区域进行色域映射处理,得到经色域映射处理后的图像数据。
步骤205的实现方式可以与步骤104相同。
一实施例中,仅对所述第一图像数据中的人脸区域进行色域映射处理,而对于所述第一图像数据中的其他区域不进行色域映射处理,对人脸区域的色域映射处理不影响其他区域。
在一实施例中,用户可以根据需求决定是否采用上述实施例中的图像处理方法,在用户决定采用本发明实施例的图像处理方法时,如果采集到包含人脸图像的第一图像数据,可以自动基于上述方法进行肤色增强。
根据图1所在实施例中的图像处理方法,一实施例提出了一种图像处理装置。
图3为一实施例提供的图像处理装置的结构示意图,如图3所示,该装置包括:获取模块301、第一确定模块302、第二确定模块303和处理模块304。
获取模块301设置为获取第一图像数据。
第一确定模块302设置为确定所述第一图像数据中的白点。
第二确定模块303设置为根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系。
处理模块304设置为按照所述色域映射关系,对所述第一图像数据进行色域映射处理,得到经色域映射处理后的第二图像数据。
一实施例中,所述第一图像数据为包含人脸图像的图像数据时,所述处理模块304设置为按照所述色域映射关系,对所述第一图像数据中的人脸区域进行色域映射处理。
一实施例中,所述装置还包括设置模块305,所述设置模块305设置为在确定色域映射关系前,设置每个环境光源对应的第一白点增益调节系数作为第二白点增益调节系数。
所述第一确定模块302还可以设置为在所述第二图像数据后,利用白平衡算法确定所述第一图像数据对应的第一环境光源。
所述第二确定模块303可以设置为在所述至少一个第二白点增益调节系数中,选取第一环境光源对应的第二白点增益调节系数;以及根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定所述色域映射关系。
一实施例中,所述第二确定模块303,设置为在所述颜色空间为RGB颜色空间时,根据每个白点在RGB颜色空间中的多个分量的第一数值、以及RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在YUV颜色空间中的多个分量的第二数值;根据所述第二白点增益调节系数,对所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一数值进行修正,得到所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一修正值;根据至少两个第一修正值、以及RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二修正值;以及将所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二数值至对应白点的至少两个第二修正值之间的映射关系确定为:色域映射关系。
一实施例中,所述第一确定模块302,设置为利用白平衡算法确定所述第一图像数据对应的第一环境光源。
一实施例中,所述色域映射关系用于表征色域映射处理后的YUV颜色空间的Cb分量与色域映射处理前的YUV颜色空间的色度分量的对应关系、以及色域映射处理后的YUV颜色空间的Cr分量与色域映射处理前的YUV颜色空间的色度分量的对应关系;其中,所述YUV颜色空间的色度分量包括Cb分量和Cr分量。
一实施例中,所述第一确定模块302设置为利用白平衡算法确定所述第一 图像数据中的白点。
获取模块301可以由终端中的摄像头实现,第一确定模块302、第二确定模块303和处理模块304均可由位于终端中的中央处理器(Central Processing Unit,CPU)、微处理器(Micro Processor Unit,MPU)、数字信号处理器(Digital Signal Processor,DSP)、或现场可编程门阵列(Field Programmable Gate Array,FPGA)等实现。
上述实施例可提供为方法、系统、或计算机程序产品。因此,上述技术方案可采用硬件实施例、软件实施例、或软件和硬件组合的实施例的形式。上述技术方案可采用在一个或多个包含有计算机可用程序代码的计算机可用存储介质(包括磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。
以上实施例是参照根据实施例的方法、设备(系统)、和计算机程序产品的流程图和方框图中至少之一来描述的。可由计算机程序指令实现以下至少之一:流程图中每一流程、方框图中的每一方框、以及流程图中的流程和方框图中的方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生可以实现以下至少一个装置:在流程图一个流程或多个流程中指定的功能的装置,和,方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置可以实现以下至少一个装置:在流程图一个流程或多个流程中指定的功能的装置,和,方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现以下至少一个装置:在流程图一个流程或多个流程中指定的功能的步骤,和,方框图一个方框或多个方框中指定的功能的步骤。
一实施例提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行上述任一实施例中的方法。
一实施例提供了一种终端的硬件结构示意图。参见图4,该终端包括:
至少一个处理器(processor)40,图4中以一个处理器40为例;存储器(memory)41;还可以包括通信接口(Communications Interface)42和总线43。其中,处理器40、存储器41以及通信接口42可以通过总线43完成相互间的通信。处理器40可以调用存储器41中的逻辑指令,以执行上述实施例中的方法。
此外,上述的存储器41中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。
存储器41作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序,如上述实施例中的方法对应的程序指令或模块。处理器40通过运行存储在存储器41中的软件程序、指令或模块,从而执行功能应用以及数据处理,即实现上述实施例中的方法。
存储器41可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端设备的使用所创建的数据等。此外,存储器41可以包括高速随机存取存储器,还可以包括非易失性存储器。
以上技术方案可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括一个或多个指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行上述实施例所述方法的全部或部分步骤。而前述的存储介质可以是非暂态存储介质,包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等多种可以存储程序代码的介质,也可以是暂态存储介质。
图像处理方法和装置,能够降低在不同的环境下使用同一种环境光源时采用相同的图像处理方式处理后的图像出现的偏色。
Claims (15)
- 一种图像处理方法,包括:获取第一图像数据;确定所述第一图像数据中的白点;根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,其中,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系;以及按照所述色域映射关系,对所述第一图像数据进行色域映射处理,得到经色域映射处理后的第二图像数据。
- 根据权利要求1所述的方法,其中,所述第一图像数据包含人脸图像的图像数据时,所述按照所述色域映射关系,对所述第一图像数据进行色域映射处理,包括:按照所述色域映射关系,对所述第一图像数据中的人脸区域进行色域映射处理。
- 根据权利要求1所述的方法,在所述获取所述第一图像数据后,所述方法还包括:确定所述第一图像数据对应的第一环境光源;以及在所述确定色域映射关系前,所述方法还包括:设置多个环境光源对应的第一白点增益调节系数;其中,所述根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,包括:在至少一个第一白点增益调节系数中,选取所述第一环境光源对应的第一白点增益调节系数作为第二白点增益调节系数;以及根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定所述色域映射关系。
- 根据权利要求3所述的方法,其中,所述颜色空间为红绿蓝RGB颜色空间时,所述根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定所述色域映射关系,包括:根据每个白点在RGB颜色空间中的多个分量的第一数值、以及RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在YUV颜色空间中的多个分量的第二数值;根据所述第二白点增益调节系数,对所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一数值进行修正,得到所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一修正值;根据至少两个第一修正值、以及所述转换关系,得出所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二修正值;以及将所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二数值与对应白点的至少两个第二修正值之间的映射关系确定为:所述色域映射关系。
- 根据权利要求3或4所述的方法,其中,所述确定所述第一图像数据对应的第一环境光源,包括:利用白平衡算法确定所述第一图像数据对应的第一环境光源。
- 根据权利要求1所述的方法,其中,所述色域映射关系用于表征色域映射处理后的YUV颜色空间的蓝色色度Cb分量与色域映射处理前的YUV颜色空间的Cb分量的对应关系、以及色域映射处理后的YUV颜色空间的红色色度Cr分量与色域映射处理前的YUV颜色空间的Cr分量的对应关系;其中,所述YUV颜色空间的色度分量包括所述Cb分量和所述Cr分量。
- 根据权利要求1所述的方法,其中,所述确定所述第一图像数据的白点, 包括:利用白平衡算法确定所述第一图像数据中的白点。
- 一种图像处理装置,包括获取模块、第一确定模块、第二确定模块和处理模块;其中,所述获取模块设置为获取第一图像数据;所述第一确定模块设置为确定所述第一图像数据中的白点;所述第二确定模块设置为根据所述白点在颜色空间中的多个分量和预先设置的第一白点增益调节系数,确定色域映射关系,其中,所述色域映射关系用于表征色域映射处理后的颜色空间中的分量与色域映射处理前的颜色空间中的分量的对应关系;以及所述处理模块设置为按照所述色域映射关系,对所述第一图像数据进行色域映射处理,得到经色域映射处理后的第二图像数据。
- 根据权利要求8所述的装置,其中,所述第一图像数据包含人脸图像的图像数据时,所述处理模块,设置为按照所述色域映射关系,对所述第一图像数据中的人脸区域进行色域映射处理。
- 根据权利要求8所述的装置,还包括设置模块,其中,所述设置模块设置为在确定色域映射关系前,设置多个环境光源对应的第一白点增益调节系数;所述第一确定模块还设置为在获取所述第一图像数据后,确定所述第一图像数据对应的第一环境光源;所述第二确定模块,设置为在至少一个第一白点增益调节系数中,选取所述第一环境光源对应的第二白点增益调节系数;以及根据所述白点在颜色空间中的多个分量的值和所述第二白点增益调节系数,确定所述色域映射关系。
- 根据权利要求10所述的装置,其中,所述第二确定模块设置为在所述颜色空间为红绿蓝RGB颜色空间时,根据每个白点在RGB颜色空间中的多个分量的第一数值、以及RGB颜色空间到YUV颜色空间的转换关系,得出所述每个白点在YUV颜色空间中的多个分量的第二数值;根据所述第二白点增益调节系数,对所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一数值进行修正,得到所述每个白点在所述RGB颜色空间中的至少两个分量各自的第一修正值;根据至少两个第一修正值、以及所述转换关系,得出所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二修正值;以及将所述每个白点在所述YUV颜色空间中的至少两个分量各自的第二数值与对应白点的至少两个第二修正值之间的映射关系确定为:所述色域映射关系。
- 根据权利要求10或11所述的装置,其中,所述第一确定模块,设置为利用白平衡算法确定所述第一图像数据对应的第一环境光源。
- 根据权利要求8所述的装置,其中,所述色域映射关系用于表征色域映射处理后的YUV颜色空间的蓝色色度Cb分量与色域映射处理前的YUV颜色空间的Cb分量的对应关系、以及色域映射处理后的YUV颜色空间的红色色度Cr分量与色域映射处理前的YUV颜色空间的Cr分量的对应关系;其中,所述YUV颜色空间的色度分量包括所述Cb分量和所述Cr分量。
- 根据权利要求8所述的装置,其中,所述第一确定模块设置为利用白平衡算法确定所述第一图像数据中的白点。
- 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求1-7中任一项的方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710349185.0 | 2017-05-17 | ||
CN201710349185.0A CN108965685A (zh) | 2017-05-17 | 2017-05-17 | 一种图像处理方法和装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2018209984A1 true WO2018209984A1 (zh) | 2018-11-22 |
Family
ID=64273218
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2018/071894 WO2018209984A1 (zh) | 2017-05-17 | 2018-01-09 | 图像处理方法和装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108965685A (zh) |
WO (1) | WO2018209984A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114928732A (zh) * | 2022-04-14 | 2022-08-19 | 深圳创维-Rgb电子有限公司 | 图像色准校正方法、装置、电子设备及可读存储介质 |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111836029B (zh) * | 2019-04-18 | 2022-03-15 | 福州瑞芯微电子股份有限公司 | 一种基于色域映射的白平衡调整方法、系统及白平衡终端 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1832583A (zh) * | 2005-02-18 | 2006-09-13 | 三星电子株式会社 | 具有自动白平衡控制的设备、介质和方法 |
CN101166285A (zh) * | 2006-10-16 | 2008-04-23 | 展讯通信(上海)有限公司 | 自动白平衡方法及装置 |
CN102244790A (zh) * | 2011-06-27 | 2011-11-16 | 展讯通信(上海)有限公司 | 图像信号处理器配套参数的自适应调整装置及方法 |
US20150070337A1 (en) * | 2013-09-10 | 2015-03-12 | Cynthia Sue Bell | Ambient light context-aware display |
CN104702941A (zh) * | 2013-12-09 | 2015-06-10 | 展讯通信(上海)有限公司 | 一种白点区域表示及判定方法 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3958298B2 (ja) * | 2004-03-31 | 2007-08-15 | 富士フイルム株式会社 | 色再現定義作成方法および色変換方法 |
KR100866486B1 (ko) * | 2007-01-04 | 2008-11-03 | 삼성전자주식회사 | 주변광 적응적인 색 보정 장치 및 방법 |
-
2017
- 2017-05-17 CN CN201710349185.0A patent/CN108965685A/zh not_active Withdrawn
-
2018
- 2018-01-09 WO PCT/CN2018/071894 patent/WO2018209984A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1832583A (zh) * | 2005-02-18 | 2006-09-13 | 三星电子株式会社 | 具有自动白平衡控制的设备、介质和方法 |
CN101166285A (zh) * | 2006-10-16 | 2008-04-23 | 展讯通信(上海)有限公司 | 自动白平衡方法及装置 |
CN102244790A (zh) * | 2011-06-27 | 2011-11-16 | 展讯通信(上海)有限公司 | 图像信号处理器配套参数的自适应调整装置及方法 |
US20150070337A1 (en) * | 2013-09-10 | 2015-03-12 | Cynthia Sue Bell | Ambient light context-aware display |
CN104702941A (zh) * | 2013-12-09 | 2015-06-10 | 展讯通信(上海)有限公司 | 一种白点区域表示及判定方法 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114928732A (zh) * | 2022-04-14 | 2022-08-19 | 深圳创维-Rgb电子有限公司 | 图像色准校正方法、装置、电子设备及可读存储介质 |
CN114928732B (zh) * | 2022-04-14 | 2024-01-23 | 深圳创维-Rgb电子有限公司 | 图像色准校正方法、装置、电子设备及可读存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN108965685A (zh) | 2018-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104796683B (zh) | 一种校准图像色彩的方法和系统 | |
US9723285B2 (en) | Multi-area white-balance control device, multi-area white-balance control method, multi-area white-balance control program, computer in which multi-area white-balance control program is recorded, multi-area white-balance image-processing device, multi-area white-balance image-processing method, multi-area white-balance image-processing program, computer in which multi-area white-balance image-processing program is recorded, and image-capture apparatus | |
TWI293742B (zh) | ||
EP2426928B1 (en) | Image processing apparatus, image processing method and program | |
JP2015211319A5 (ja) | 画像処理装置、画像処理方法、およびプログラム | |
CN110381303B (zh) | 基于皮肤颜色统计的人像自动曝光白平衡矫正方法及系统 | |
CN111861922A (zh) | 颜色校正矩阵的调整方法及装置、存储介质 | |
US20190320152A1 (en) | White balance calibration method based on skin color data and image processing apparatus using the same | |
WO2019061766A1 (zh) | 一种图像处理方法及装置 | |
US11962917B2 (en) | Color adjustment method, color adjustment device, electronic device and computer-readable storage medium | |
US11451703B2 (en) | Method and system for customizing camera parameters | |
WO2021088639A1 (zh) | 图像亮度处理方法及装置、图像处理方法及装置 | |
WO2017096858A1 (zh) | 图像白平衡的调整方法和装置 | |
US10224004B2 (en) | Automatic white balance based on surface reflection decomposition | |
WO2019015553A1 (zh) | 图像色彩校正方法、装置、存储介质和计算机设备 | |
WO2018209984A1 (zh) | 图像处理方法和装置 | |
Lakhwani et al. | Color space transformation for visual enhancement of noisy color image | |
CN110782400A (zh) | 一种自适应的光照均匀实现方法和装置 | |
WO2021179142A1 (zh) | 一种图像处理方法及相关装置 | |
TWI523500B (zh) | 影像的動態範圍壓縮方法與影像處理裝置 | |
TW201541961A (zh) | 照相元件校正方法 | |
WO2019137396A1 (zh) | 一种图像处理方法及装置 | |
TWI544451B (zh) | 影像處理方法 | |
JP7335283B2 (ja) | 情報処理端末、プログラム、情報処理システム及び色補正方法 | |
JPWO2006106750A1 (ja) | 画像処理装置、画像処理方法、および画像処理プログラム |
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: 18802616 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: 18802616 Country of ref document: EP Kind code of ref document: A1 |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 18802616 Country of ref document: EP Kind code of ref document: A1 |