CN116958280A - Color taking method and device and electronic equipment - Google Patents

Color taking method and device and electronic equipment Download PDF

Info

Publication number
CN116958280A
CN116958280A CN202310648409.3A CN202310648409A CN116958280A CN 116958280 A CN116958280 A CN 116958280A CN 202310648409 A CN202310648409 A CN 202310648409A CN 116958280 A CN116958280 A CN 116958280A
Authority
CN
China
Prior art keywords
color
target
data
pure
display screen
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202310648409.3A
Other languages
Chinese (zh)
Inventor
杨植
徐�明
吴凯华
唐林
孙斌
徐盎
张少峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Jixian Technology Co ltd
Original Assignee
Shenzhen Jixian Technology Co ltd
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 Shenzhen Jixian Technology Co ltd filed Critical Shenzhen Jixian Technology Co ltd
Priority to CN202310648409.3A priority Critical patent/CN116958280A/en
Publication of CN116958280A publication Critical patent/CN116958280A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/16Matrix or vector computation, e.g. matrix-matrix or matrix-vector multiplication, matrix factorization

Abstract

The application provides a color taking method, a device and electronic equipment, which are applicable to the technical field of image processing, wherein the method comprises the following steps: the color taking device acquires second color data, wherein the second color data comprises intensity data of R, G, B components of the acquired target color when the display screen displays the target color. The RGB values of the target color are then determined based on the second color data and the target conversion relationship. The target conversion relation is determined based on first color data, wherein the first color data comprises intensity data of R, G, B components respectively corresponding to all collected colors when the display screen displays pure red, pure green, pure blue and gray colors. The embodiment of the application can improve the accuracy and the effectiveness of color taking of the display screen.

Description

Color taking method and device and electronic equipment
Technical Field
The application belongs to the technical field of image processing, and particularly relates to a color taking method, a device and electronic equipment.
Background
Many electronic devices are equipped with a display screen, sometimes requiring the color of the image displayed by the display screen. For example, in order to enhance the environmental atmosphere, the visual experience of the user is improved, the color of the television screen is taken, and then the background light of the television is controlled to display the corresponding color.
The method for color extraction of the display screen is generally as follows: the color extraction method comprises the steps of collecting images of a display screen through a camera, a color sensor and other color extraction equipment, and extracting colors in the images. However, this method often has certain drawbacks: is easily affected by various factors such as ambient light, installation position, mode and production batch of the color taking device, and the like, so that the extracted color is inconsistent with the color actually displayed by the display screen.
Disclosure of Invention
In view of this, the embodiment of the application provides a color taking method, a device and an electronic device, which can improve the accuracy of color taking of a display screen.
A first aspect of an embodiment of the present application provides a color extracting method, including:
and acquiring second color data, wherein the second color data comprises the intensity data of the R, G, B component of the acquired target color when the target color is displayed on the display screen.
RGB values of the target color are determined based on the second color data and the target conversion relationship. The target conversion relation is determined based on first color data, wherein the first color data comprises intensity data of R, G, B components respectively corresponding to all collected colors when the display screen displays pure red, pure green, pure blue and gray colors.
In a first possible implementation manner of the first aspect, the method includes:
the gray color is pure red, pure green and pure blue light, and the corresponding colors are obtained after mixing the same proportion.
In a second possible implementation manner of the first aspect, the method includes:
pure red is the redest, pure green is the greenest, pure blue is the blueest, and gray color is pure white.
In a third possible implementation manner of the first aspect, the determining operation of the target conversion relation includes:
based on the first color data, the R, G, B component of the XYZ color space is corrected to correspond to the length in the vector space, resulting in a R, G, B component corrected for length.
With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the target conversion relationship includes: and (5) a target conversion matrix.
Correcting the length of the R, G, B component of the XYZ color space corresponding to the vector space based on the first color data to obtain a corrected length R, G, B component, comprising:
and determining three-dimensional coordinates corresponding to each collected color in the XYZ color space when the display screen displays pure red, pure green, pure blue and gray colors based on the first color data.
According to the three-dimensional coordinates of each color, the R, G, B component of the XYZ color space is corrected to correspond to the length in the vector space, and R, G, B components in the XYZ color space after the correction of the length are obtained.
Based on the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner of the first aspect, correcting a length of the R, G, B component of the XYZ color space corresponding to the vector space according to the three-dimensional coordinates of each color includes:
according to the three-dimensional coordinates of each color, the length proportion of the R, G, B component of the XYZ color space in the vector space is determined.
And calculating a target conversion matrix according to the three-dimensional coordinates and the length ratio corresponding to the pure red, the pure green and the pure blue in the XYZ color space.
In a sixth possible implementation manner of the first aspect, after determining the RGB values of the target color, the method further includes:
and controlling the lighting equipment of the target area to display the colors corresponding to the RGB values according to the RGB values of the target colors.
According to the embodiment of the application, the color extracted by the color extracting device is more similar to the color actually displayed by the display screen, and the accuracy and the effectiveness of color extracting of the display screen are improved.
In a second aspect of the embodiment of the present application, there is provided a color extracting device, including:
the acquisition module is used for acquiring second color data, wherein the second color data comprise intensity data of R, G, B components of the acquired target color when the display screen displays the target color.
And the processing module is used for determining RGB values of the target color based on the second color data and the target conversion relation. The target conversion relationship is determined based on first color data including intensity data of R, G, B components corresponding to respective colors when the display screen displays pure red, pure green, pure blue, and gray colors.
A third aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, where the memory stores a computer program executable on the processor, and when the processor executes the computer program, causes the electronic device to implement the steps of the color extraction method according to any one of the first aspect.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium comprising: a computer program is stored which, when executed by a processor, causes an electronic device to carry out the steps of the color extraction method according to any one of the first aspects described above.
It will be appreciated that the advantages of the second to fourth aspects may be found in the relevant description of the first aspect and are not repeated here.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an implementation flow of a color extraction method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an implementation flow of a color extraction method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an implementation flow of a color extraction method according to an embodiment of the present application;
fig. 4 is a schematic flowchart of an implementation of a color extraction method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a color extraction device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The color taking method provided by the embodiment of the application can be applied to cameras, color sensors or other electronic equipment, and the electronic equipment can be used as the color taking equipment in the embodiments of the application. The execution main body of the color extraction method provided by the embodiment of the application is color extraction equipment, and in the embodiment of the application, the specific type of the color extraction equipment is not limited.
Some concepts that may be related to embodiments of the application are described herein:
target color: in the embodiment of the application, the target color is the color required to be extracted by the user.
RGB color space: the color value of a color may be represented by three components: red (Red, R), green (G) and Blue (B). The color value constituted by the three components R, G, B is referred to as RGB value. One component corresponds to an intensity value, the intensity value of a component representing the intensity of the color on the component channel. The intensity value for each component is typically represented by 0 to 255 or 0 to 1. When the intensity values corresponding to the three components R, G, B are expressed by 0 to 255,0 represents the minimum intensity and 255 represents the maximum intensity. Wherein, the red-most RGB value is (255, 0), the green-most RGB value is (0, 255, 0), the blue-most RGB value is (0, 255), and the white-most (pure white) RGB value is (255, 255, 255). In the various embodiments of the present application, an example will be described in which the intensity value corresponding to each component is represented by 0 to 255.
Vector space: referring to a three-dimensional space of three component representations, a three-dimensional vector space representing colors is described. In vector space, each color may be a vector whose coordinates may be represented in the form of three components. These three components correspond to R, G, B, respectively.
CIE XYZ color space: is a color space based on spectral matching. Based on RGB system, three imaginary primary colors [ X ], [ Y ], [ Z ] (tristimulus value: X, Y, Z) are selected to replace the actual primary colors of R, G and B. Wherein X represents a red primary stimulus value, Y represents a green primary stimulus value, and Z represents a blue primary stimulus value.
With the continued advancement of technology, and for the purpose of better information transfer, many electronic devices are equipped with display screens. In some real life scenarios, it is desirable to color the image displayed by the display screen. For example, the color of the television screen display is taken, and then the backlight of the television is controlled to display the corresponding color. Therefore, the background light of the television and the color displayed on the television screen can realize synchronous conversion, and the environmental atmosphere of a user when watching the television can be enhanced.
The method for color extraction of the display screen generally comprises the following steps: the method comprises the steps of obtaining an image of a display screen through a color taking device, extracting colors in the image to obtain data related to the colors, and then mapping the collected data into RGB values to finish color taking. Although the method can finish the color taking of the display screen, the method is influenced by factors of the color taking equipment or other factors. If the color is likely to be affected by factors such as quality, installation position and installation mode of the color taking device, ambient light, type of the display screen and the like, deviation exists between data related to the color collected by the color taking device and real data, so that the finally extracted color is inaccurate, and the color is greatly different from the color actually displayed by the display screen.
In order to enable the color taken out by the color taking device to be closer to the color actually displayed by the display screen, the color taking accuracy and effectiveness of the color taking device are improved. In the technical scheme of the application, the color taking device for taking the color of the display screen can be mainly divided into: two procedures are calibrated and applied. In the calibration process, color calibration is performed on the color taking device based on the distortion data, so as to obtain calibration data. In the application process, based on the obtained calibration data, the data acquired by the color taking device when the display screen displays the target color are combined, and the actual RGB value corresponding to the target color is restored. It should be noted that, when the color taking device takes color from the display screen,
The calibration process need not be completed each time. For example, when the color taking device takes color on the display screen for the previous time, the calibration process is already performed, calibration data is obtained, various influencing factors influencing the color taking of the color taking device remain relatively stable for a period of time (that is, the change of various influencing factors influencing the color taking of the color taking device in a period of time is always in a certain range), so that the color taking device needs to complete the color taking of the display screen in the period of time, and the calibration process is not needed before the application process.
As an alternative embodiment of the present application, the color-taking device is first color calibrated based on the distortion data to obtain calibration data.
The distortion data refers to data related to color, which is acquired by the color acquisition device and has deviation or error when the color is acquired by the color acquisition device when the color is acquired by the display screen after being interfered by various influencing factors. The distorted data is somewhat different from the actual data.
Due to different environments, the light-emitting wavelength of the display screen is different, the quality of the color taking device is different, the installation position or the installation mode is different, and the like, the color taken out by the color taking device and the current actual color displayed by the display screen can be greatly different. Therefore, calibration is required before the color extraction device is used for extracting the color of the display screen, so that errors between the color extracted by the color extraction device and the color actually displayed by the display screen are reduced, and the color extraction device and the color actually displayed by the display screen are as close as possible. And after the color calibration of the color taking device, obtaining calibration data.
Optionally, the user may control the color capturing device to complete color calibration through a terminal device that establishes a connection with the color capturing device. In an alternative embodiment, the user may choose to establish a connection with the color extraction device after installing the corresponding application (Application Program, APP) in the terminal device. And then, the APP is used for controlling the color taking equipment to complete calibration, and calibration data are obtained.
It is contemplated that certain influencing factors, such as ambient light, may often change that influence the data acquisition of the color extraction device. Thus in an alternative embodiment, the color extraction device may monitor these influencing factors. When detecting that the changes of the influence factors exceed a certain range, the color taking device automatically enters a calibration mode to finish calibration. When the target color is required to be extracted from the display screen next time, the efficiency and the accuracy can be improved.
It should be noted that, in some application scenarios, the color capturing method, the device, the electronic device and the like in the present application may be suitable for capturing colors for multiple times, and then processing the captured colors to complete color capturing without first capturing an image of the whole screen and then performing partition color capturing on the image.
In the embodiment of the application, after the color calibration of the color taking device is completed, based on the calibration data, the data acquired by the color taking device when the display screen displays the target color are combined, and the actual RGB value corresponding to the target color is restored, so that the color taking is completed.
According to the embodiment of the application, the correction is performed based on the distortion data to obtain the correction data, and the actual RGB value corresponding to the target color is determined according to the correction data, so that the color extracted by the color extracting device can be more accurate.
In order to illustrate the technical scheme of the application, the following description is made by specific examples.
As an alternative embodiment of the present application, the R, G, B component of the XYZ color space under the current condition may be corrected to correspond to the length in the vector space, resulting in R, G, B components of the XYZ color space after the correction of the length. Then, based on R, G, B components in the XYZ color space after the correction length, a conversion relationship from the XYZ color space to the RGB color space belonging to the current condition is determined. At this time, the conversion relationship can be regarded as calibration data of the color taking device. The current conditions comprise factors such as the current environment, the current color taking equipment, a display screen of the current electronic equipment and the like. The XYZ color space corresponds to the CIE XYZ color space.
In the RGB color space, when three primary colors of red, green, and blue are mixed in the same ratio, a gray color (gray color may be pure white, pure black, or a series of transition colors from black to white in both) can be obtained. For example, the redest (255, 0), the greenest (0, 255, 0), and the bluest (0, 255) are mixed to obtain pure white (255, 255, 255). And mixing red (150,0,0), green (0, 150,0) and blue (0, 150) can result in a gray color (150, 150, 150) having a gray level of 150.
Since pure red, pure green and pure blue are mixed in the same ratio, gray colors can be obtained. Here, additive color mixing refers to color mixing for light. Thus, in some alternative embodiments, a particular gray color may be selected as the reference color for correcting the length of the R, G, B component of the XYZ color space in the vector space under the current conditions. Then, based on R, G, B components of the XYZ color space after the correction length, the conversion relation from the XYZ color space to the RGB color space of the display screen under the current condition is determined. For example, gray with a gray level of 200 may be selected as the reference color, or white may be selected as the reference color to correct the length of the R, G, B component of the XYZ color space of the display screen corresponding to the vector space under the current condition. Since the length of the R, G, B component in the vector space determines the color range that can be represented by its corresponding color space, in order to be able to represent the most colors with the R, G, B component of the XYZ color space after correction of the length, the length of the R, G, B component of the XYZ color space in the vector space can be selected to be corrected with pure white as the reference color. In the following embodiments of the present application, an exemplary description will be given taking, as an example, correction of the length of the R, G, B component of the XYZ color space of the display screen in the vector space under the present condition with plain white as a reference color.
As an alternative embodiment of the present application, reference may be made to fig. 1 when pure white is used as the reference color. Fig. 1 shows a flowchart of an implementation of a color extraction method according to an embodiment of the present application, which is described in detail below:
s1, acquiring first color data of a display screen. Wherein the first color data includes: when the display screen displays pure red, pure green, pure blue and reference colors, the collected intensity data of R, G, B components corresponding to the colors respectively.
In an alternative embodiment, the first color data of the display screen may be acquired separately from the intensity data of the R, G, B component when the display screen displays pure red, the intensity data of the R, G, B component when the display screen displays pure green, the intensity data of the R, G, B component when the display screen displays pure blue, and the intensity data of the R, G, B component when the display screen displays a reference color.
It should be noted that, in the embodiments of the present application, the lengths of the three primary colors of red, green and blue in the RGB vector space are corrected by using pure white (the whitest) as the reference color. The above step S1 can be replaced with S100: acquiring first color data of a display screen, wherein the first color data comprises: the display screen is respectively corresponding to R, G, B component intensity data of each color when in the redest, the greenest, the blueest and the pure white.
The intensity data of the R, G, B three components is positively correlated with the intensities of the R, G, B three components. The intensity data may be intensity values of three components R, G, B, or intensity parameters which can be converted with the intensity values of three components R, G, B according to a certain rule, wherein the intensity parameters and the intensity values are positively correlated. In some possible embodiments, the acquisition of the first color data may be accomplished by acquiring R, G, B the intensity data of the three components through an Analog-to-Digital Converter (ADC) converter.
In some specific embodiments, an analog-to-digital converter (ADC) is disposed in the color extraction device, and the analog-to-digital converter is respectively used for collecting the red-most, green-most, blue-most and pure white color of the display screen, so as to obtain the sampled values of R, G, B three channels of the display screen in the red-most, green-most, blue-most and pure white colors. At this point, the sampled values of the R, G, B three channels can be considered as R, G, B three component intensity parameters. Wherein, the redest is pure red corresponding to the maximum intensity data of the R component; the most green is the pure green corresponding to the maximum intensity data of the G component; the bluest is the pure blue corresponding to the maximum intensity data of the B component. In the following embodiments of the present application, an exemplary description will be given taking intensity data as an intensity parameter, and taking sampled values of the R, G, B three channels as an intensity parameter of the R, G, B three components. Accordingly, the above step S1 may be replaced with: sampling values of R, G, B channels of the display screen, which display pure red, pure green, pure blue and calibration colors, are obtained. The above step S100 may be replaced with: the sampled values of R, G, B channels of the display screen at the redest, greenest, blueest and whitest (whitest) are obtained.
S2, according to the first color data, determining the conversion relation from the XYZ color space to the RGB color space of the display screen under the current condition. At this time, the conversion relationship may be referred to as a target conversion relationship.
After the first color data is obtained, the conversion relation from the XYZ color space to the RGB color space of the display screen under the current condition is determined after the first color data is processed to a certain degree. Wherein the RGB color space may be, but is not limited to, an sRGB color space, an Adobe RGB color space, an Apple RGB color space, or a CIE RGB color space, etc.
Alternatively, the conversion relation of the XYZ color space to the RGB color space may be expressed by a conversion matrix. Other mapping rules may also be used to represent the conversion relationship of XYZ color space to RGB color space. In the following embodiments of the present application, an exemplary description will be given taking an example of representing a conversion relationship from an XYZ color space to an RGB color space belonging to the current condition by a conversion matrix. At this time, the above S2 may be replaced with: and determining a conversion matrix from the XYZ color space to the RGB color space under the current condition according to the first color data. This transformation matrix may be referred to as a target transformation matrix.
In an alternative embodiment of the present application, reference may be made to fig. 2, and fig. 2 shows a schematic diagram of a calibration procedure provided in an embodiment of the present application, which is described in detail below:
s11, displaying the redest color on a display screen, and collecting and recording a sampling value by using color taking equipment.
And S12, displaying the most green color on a display screen, and collecting and recording a sampling value by using color taking equipment.
S13, displaying the bluest color on the display screen, and collecting and recording a sampling value by the color taking device.
S14, displaying pure white on a display screen, and collecting and recording a sampling value by using a color taking device.
S15, calculating a target conversion matrix according to the collected 4 groups of sampling values.
As an optional embodiment of the present application, a certain process is performed on the first color data to determine a target conversion matrix, and a specific implementation manner may refer to fig. 3, where fig. 3 shows a flowchart of an implementation of a color extraction method provided by an embodiment of the present application, where the method includes:
and S101, determining corresponding three-dimensional coordinates of each color in an XYZ color space when the display screen displays the redest, the greenest, the blueest and the pure white under the current condition based on the first color data.
After the first color data is obtained, that is, after the intensity data of the three components R, G, B of the display screen in the redest, the greenest, the blueest and the pure white (reference color) are obtained, the four groups R, G, B of the intensity data of the three components can be normalized and converted into three-dimensional coordinates, so that the three-dimensional coordinates of the display screen in the redest, the greenest, the blueest and the pure white under the current condition can be obtained.
S102, correcting the length of the R, G, B component in the XYZ color space corresponding to the vector space, and obtaining the R, G, B component in the XYZ color space after correcting the length.
The length of the R, G, B component corresponding to the vector space can be corrected according to the three-dimensional coordinates corresponding to each color when the display screen is obtained to display the redest, the greenest, the blueest and the pure white, and the R, G, B component with the corrected length can be obtained.
In an alternative embodiment, the length proportion of the R, G, B component corresponding to the vector space can be determined according to the three-dimensional coordinates corresponding to each color when the display screen is obtained to display the redest, the greenest, the blueest and the pure white, so that the length of the R, G, B component in the XYZ color space corresponding to the vector space can be corrected, and the R, G, B component with the corrected length can be obtained.
In a specific embodiment, after the three-dimensional coordinates corresponding to the redest, the greenest, the blueest and the pure white of the display screen are obtained, the three-dimensional coordinates corresponding to the redest, the greenest and the blueest can be converted into a three-dimensional matrix, and the three-dimensional matrix can be called as a first matrix. The three-dimensional coordinates corresponding to the pure white color are then converted into a 3×1 matrix, which may be referred to as a second matrix at this time. And multiplying the inverse of the first matrix with the second matrix. The obtained calculation result (the calculation result is also a 3×1 matrix, which may be referred to as a third matrix at this time) may be represented as a length ratio of the R, G, B component in the XYZ color space in the vector space. Thus, the length of the R, G, B component in the XYZ color space corresponding to the vector space can be determined, so that the length of the R, G, B component in the XYZ color space corresponding to the vector space can be corrected, resulting in the R, G, B component in the XYZ color space after the correction of the length.
Illustratively in one exampleIt is assumed that the obtained display screen has (a 1, b1, c 1) corresponding to the redest color, (a 2, b2, c 2) corresponding to the greenest color, (a 3, b3, c 3) corresponding to the blueest color, and (a 4, b4, c 4) corresponding to the pure white color. Then the first matrix for converting the three-dimensional coordinates corresponding to the redest, the greenest and the blueest is
Converting the three-dimensional coordinates corresponding to the pure white into a second matrixThe third matrix obtained by multiplying the inverse of the first matrix by the second matrix is +.>At this time, m, n, and l in the third matrix represent the length ratios of the R, G, B component in the XYZ color space in the vector space.
S103, determining a conversion matrix (namely a target conversion matrix) from the XYZ color space to the RGB color space of the display screen under the current condition based on the R, G, B components in the XYZ color space after the correction length.
And using the R, G, B component with the corrected length as a new substrate, and calculating a target conversion matrix. In the subsequent flow, the XYZ coordinates corresponding to the target color can be converted into corresponding R, G, B scale values according to the target conversion matrix. From the R, G, B scale values, the RGB values of the target color can be determined.
In an alternative embodiment, using the R, G, B component after the correction length as a new substrate, the implementation manner of determining the target conversion matrix may be: and calculating a target conversion matrix according to the three-dimensional coordinates corresponding to each color when the display screen displays the redest, the greenest and the blueest and the length proportion of the R, G, B component determined in the step S102 in the vector space.
In a specific embodiment, after obtaining the R, G, B component in the XYZ color space after the correction length, the aforementioned third matrix is converted into a fourth matrix, wherein the fourth matrix is a diagonal matrix corresponding to the third matrix. Then, the first matrix and the fourth matrix are multiplied, and then the result is inverted, so that the target conversion matrix can be calculated.
An example corresponding to the example set forth in step S102 is exemplified. The fourth matrix converted from the third matrix isAfter multiplying the first matrix and the fourth matrix, the result is inverted, which can be expressed as follows:
the calculated result is the target conversion matrix.
S3, acquiring second color data of the display screen. The second color data comprises intensity data of R, G, B components of the target color collected by the display screen under the current condition when the target color is displayed. The description of the intensity data may refer to the relevant content in step S1, and will not be repeated here.
In the embodiment of the present application, the intensity data is taken as an intensity parameter, and the sampled values of the three channels R, G, B are taken as the intensity parameters of the three components R, G, B for illustration. Accordingly, S3 may be replaced with: and acquiring sampling values of three channels R, G, B of the display screen when displaying the target color.
S4, determining RGB values of the target color based on the second color data and the target conversion relation.
After the second color data is obtained, the RGB value of the target color can be determined according to the second color data and the target conversion relation, and color taking is completed.
Optionally, after the second color data is obtained, certain processing is performed on the second color data, and in combination with the target conversion matrix, a R, G, B proportion value of the target color corresponding to the RGB color space can be determined first, and then, according to the R, G, B proportion value of the target color corresponding to the RGB color space, a certain processing is performed to determine the RGB value of the target color.
As an optional embodiment of the present application, based on the second color data and the target conversion matrix, the RGB values of the target color are determined, and a specific implementation manner may refer to fig. 4, where fig. 4 shows a flowchart of an implementation of a color extraction method provided by an embodiment of the present application, where the method includes:
S201, determining the three-dimensional coordinates of the display screen when displaying the target color under the current condition based on the second color data.
After the second color data is acquired, that is, after the intensity data of the R, G, B three components of the target color displayed by the display screen is acquired, the intensity data of the group R, G, B of three components can be normalized and converted into three-dimensional coordinate points, so that the three-dimensional coordinates of the target color displayed by the display screen under the current condition can be obtained.
S202, converting the three-dimensional coordinates of the display screen in the current condition to a matrix when the display screen displays the target color.
S203, obtaining a R, G, B proportion value of the target color corresponding to the RGB color space based on the matrix obtained in the S202 and the target conversion matrix.
And multiplying the matrix obtained in the step S202 by a target conversion matrix, wherein the calculation result at the moment represents R, G, B proportional values of the target color corresponding to the RGB color space.
S204, determining the RGB value of the target color according to the R, G, B proportion value of the target color corresponding to the RGB color space.
After the R, G, B proportion value of the target color corresponding to the RGB color space is obtained, the proportion values corresponding to the R, G, B three components can be multiplied by 255 respectively, so that the RGB value of the target color can be determined, the target color can be restored, and color taking is completed.
According to the embodiment of the application, the color extracted by the color extracting device is more similar to the color actually displayed by the display screen, and the accuracy and the effectiveness of color extracting of the display screen are improved.
As an alternative embodiment of the present application, if the determined RGB value of the target color is beyond the gamut coverage, the determined RGB value of the target color needs to be further processed in a preset manner to return to the gamut coverage. And taking the RGB value of the target color processed in a preset mode as the RGB value of the target color finally determined.
Optionally, the predetermined manner of further processing the determined RGB values of the target color may be: the intensity values of the three components corresponding to the RGB values are remapped to the range of 0 to 255 with a certain rule. In practical applications, other preset methods may be used to further process the RGB values of the target color that is beyond the gamut coverage, so that the RGB values return to the gamut coverage, which is not limited herein. In a specific embodiment, if the determined RGB value of the target color exceeds the gamut coverage, the intensity values of the R, G, B components corresponding to the target color may be normalized and mapped to 0-255, so that the RGB value of the target color returning to the gamut coverage may be determined. In one possible embodiment, to perform normalization processing on the intensity values of the three R, G, B components corresponding to the target color, the intensity values of the three R, G, B components may be divided by the largest of the three intensity values. After the intensity values of the three R, G, B components corresponding to the target color are normalized, the proportion values of the three R, G, B components can be obtained again. The RGB values for the target color can then be redetermined by remapping the scale values to 0-255.
For illustration in a specific example, assume pure white is used as the reference color, and the sampled values of the three channels R, G, B of the display screen at the redst, greenest, bluest and pure white under the current conditions are obtained as shown in table 1:
TABLE 1
R (sampling value) G (sampling value) B (sampling value)
The most red 62 12 2
The most green 11 82 21
The bluest 3 10 50
Pure white 76 104 73
Then, corresponding to step S101, taking the three-dimensional coordinate point with the redest display screen determined under the current condition as an example, dividing the sampling value of the R channel, the sampling value of the G channel, and the sampling value of the B channel corresponding to the redest display screen by the sum of the sampling values of the three channels R, G, B, so as to determine the three-dimensional coordinate point. The three-dimensional coordinates of the display screen at the time of redest, greenest, blueest and whitest under the current condition are determined as shown in table 2:
TABLE 2
Three-dimensional coordinates
The most red (0.815789474,0.157894737,0.026315789)
The most green (0.096491228,0.719298246,0.184210526)
The bluest (0.047619048,0.158730159,0.793650794)
Pure white (0.300395257,0.411067194,0.288537549)
Corresponding to step S102, the lengths of the redst, greenest and bluest primary colors of the display screen in the RGB vector space under the current condition are corrected by taking pure white as a reference color. The three-dimensional coordinates at the redest, greenest and blueest are converted into a three-dimensional matrix, which is called a first matrix at this time, and the three-dimensional coordinates at the time of pure white are converted into a 3×1 matrix, which is called a second matrix at this time. And multiplying the second matrix by the inverse of the first matrix to obtain a third matrix. The calculation formula and the calculation result are as follows:
The resulting third matrix represents the length of the R, G, B component in the XYZ color space of the display screen corresponding to the vector space under the current conditions. Corresponding to step S103, a conversion matrix from XYZ color space to RGB color space of the display screen under the current condition, that is, a target conversion matrix is determined based on R, G, B components in the XYZ color space after the correction length. Specifically:
a fourth matrix is derived based on the third matrix, wherein the fourth matrix is a diagonal matrix corresponding to the third matrix. And then multiplying the second matrix with the fourth matrix, and then inverting the whole calculation result. So that a target transformation matrix can be obtained. The calculation formula and the calculation result are as follows:
corresponding to step S201, assume that the sampling values of the three channels R, G, B when the display screen displays the target color under the current condition are respectively: 23. 56, 21. Then the three-dimensional coordinates of the display screen at the time of displaying the target color under the current condition are (0.23,0.56,0.21). The three-dimensional coordinates are converted into a matrix corresponding to step S202. Then, corresponding to step S203, the matrix is multiplied by the target conversion matrix obtained above to obtain a R, G, B scale value of the target color corresponding to the RGB color space. The calculation formula and the calculation result are as follows:
The 0.63327493, 1.4549773, 0.73360771 are the R, G, B scale values of the target color corresponding to the RGB color space. The RGB values of the target color can then be determined by multiplying the ratio values by 255, respectively. The calculation results are respectively as follows: 161.48510715, 371.0192115, 187.06996605, the RGB values of the target color are obtained after rounding (161, 371, 187).
It can be seen that the RGB values (161,371,187) of the target color are determined to be outside the gamut coverage, so that further processing is required to bring them back into the gamut coverage. In an alternative embodiment, the intensity values of the three components corresponding to the RGB values (161,371,187) may be normalized first to obtain the ratio values of the three components: 0.43, 1, 0.5, and then remaps the ratio values to 0-255, resulting in RGB values (110,255,128). So in this example, the RGB value of the final determined target color is (110,255,187).
In order to more intuitively show the color capturing result, as an alternative embodiment of the present application, after determining the RGB value of the target color, the method may further include: and controlling the lighting equipment of the target area to display the color corresponding to the RGB value according to the determined RGB value of the target color. The target area may be any area that the user needs to light. For example, the target area may be a background area of the display screen, and the lighting device of the target area may be a backlight installed in the background area of the display screen.
Corresponding to the color extraction method described in the above embodiments, fig. 5 shows a schematic structural diagram of the color extraction device provided in the embodiment of the present application, and for convenience of explanation, only the portion relevant to the embodiment of the present application is shown.
Referring to fig. 5, the color extracting device includes:
an acquisition module 001 for acquiring second color data; the second color data includes intensity data for three components of the display screen R, G, B when displaying the target color.
A processing module 002 for determining RGB values of the target color based on the second color data and the target conversion relationship; the target conversion relationship is determined based on first color data including intensity data of R, G, B components corresponding to respective colors when the display screen displays pure red, pure green, pure blue, and gray colors.
The process of implementing respective functions by each module in the color extraction device provided in the embodiment of the present application may refer to the foregoing description of the embodiment shown in fig. 1 and other related method embodiments, which are not described herein again.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present application, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present application.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance. It will also be understood that, although the terms "first," "second," etc. may be used herein in some embodiments of the application to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, a first table may be named a second table, and similarly, a second table may be named a first table without departing from the scope of the various described embodiments. The first table and the second table are both tables, but they are not the same table.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The color taking method provided by the embodiment of the application can also be applied to electronic equipment such as mobile phones, tablet computers, wearable equipment, notebook computers, netbooks, personal digital assistants (personal digital assistant, PDA) and the like, and the embodiment of the application does not limit the specific type of the electronic equipment.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 6, the electronic device 7 of this embodiment includes: at least one processor 70 (only one shown in fig. 6), a memory 71, said memory 71 having stored therein a computer program 72 executable on said processor 70. The processor 70, when executing the computer program 72, implements the steps of the various color extraction method embodiments described above, such as the steps shown in fig. 1. Alternatively, the processor 70 may perform the functions of the modules/units of the apparatus embodiments described above, such as the functions of the modules shown in fig. 5, when executing the computer program 72.
The electronic device 7 may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The electronic device may include, but is not limited to, a processor 70, a memory 71. It will be appreciated by those skilled in the art that fig. 6 is merely an example of the electronic device 7 and is not meant to be limiting of the electronic device 7, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the electronic device may also include an input transmitting device, a network access device, a bus, etc.
The processor 70 may be a central processing unit (Central Processing Unit, CPU), or may be another general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), an off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 71 may in some embodiments be an internal storage unit of the electronic device 7, such as a hard disk or a memory of the electronic device 7. The memory 71 may be an external storage device of the electronic device 7, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the electronic device 7. The memory 71 is used for storing an operating system, application programs, boot loader (BootLoader), data, other programs, etc., such as program codes of the computer program. The memory 71 may also be used for temporarily storing data that has been transmitted or is to be transmitted.
In addition, it will be clearly understood by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The embodiment of the application also provides an electronic device, which comprises at least one memory, at least one processor and a computer program stored in the at least one memory and capable of running on the at least one processor, wherein the processor executes the computer program to enable the electronic device to realize the steps in any of the method embodiments.
Embodiments of the present application also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps for implementing the various method embodiments described above.
Embodiments of the present application provide a computer program product which, when run on an electronic device, causes the electronic device to perform the steps of the method embodiments described above.
The embodiment of the application also provides a chip system, which comprises a processor, wherein the processor is coupled with a memory, and the processor executes a computer program stored in the memory to realize the steps in the embodiments of the method.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. A method of color extraction, comprising:
acquiring second color data, wherein the second color data comprises intensity data of R, G, B components corresponding to the target color acquired when the target color is displayed on a display screen;
determining an RGB value of the target color based on the second color data and a target conversion relationship; the target conversion relation is determined based on first color data, wherein the first color data comprises intensity data of R, G, B components respectively corresponding to all collected colors when the display screen displays pure red, pure green, pure blue and gray colors.
2. The method according to claim 1, wherein the gray-scale color is a corresponding color of the light of the pure red, the pure green, and the pure blue mixed in the same proportion.
3. The color-taking method according to claim 1 or 2, wherein the pure red is the redest, the pure green is the greenest, the pure blue is the blueest, and the gray-scale color is the pure white.
4. The color extraction method according to claim 1 or 2, wherein the determining operation of the target conversion relationship includes:
Correcting the length of the R, G, B component of the XYZ color space corresponding to the vector space based on the first color data to obtain R, G, B components in the XYZ color space after correcting the length;
based on the R, G, B component after the correction length, a target conversion relationship is determined.
5. The method of claim 4, wherein the target conversion relationship comprises: a target transformation matrix;
the correcting the R, G, B component of the XYZ color space corresponding to the length in the vector space based on the first color data, to obtain R, G, B components in the XYZ color space after correcting the length, includes:
based on the first color data, determining three-dimensional coordinates corresponding to all acquired colors in an XYZ color space when the display screen displays pure red, pure green, pure blue and gray scale colors;
according to the three-dimensional coordinates of each color, correcting the length of the R, G, B component of the XYZ color space corresponding to the vector space, and obtaining the R, G, B component of the XYZ color space with the corrected length.
6. The color extraction method according to claim 5, wherein correcting the length of R, G, B component of XYZ color space corresponding to the vector space according to the three-dimensional coordinates of each color comprises:
According to the three-dimensional coordinates of each color, determining the length proportion of the R, G, B component of the XYZ color space in the vector space;
and calculating the target conversion matrix according to the three-dimensional coordinates corresponding to the pure red, the pure green and the pure blue in the XYZ color space and the length proportion.
7. The color extraction method according to any one of claim 1, further comprising, after said determining RGB values of the target color:
and controlling the lighting equipment of the target area to display the color corresponding to the RGB value according to the RGB value of the target color.
8. A color extraction device, comprising:
the acquisition module is used for acquiring second color data; the second color data comprises intensity data of three components R, G, B of the display screen when displaying the target color;
a processing module, configured to determine an RGB value of the target color based on the second color data and a target conversion relationship; the target conversion relationship is determined based on first color data including intensity data of R, G, B components corresponding to respective colors when the display screen displays pure red, pure green, pure blue, and gray colors.
9. An electronic device comprising a memory, a processor, the memory having stored thereon a computer program executable on the processor, the processor executing the computer program to perform the steps of the method according to any of claims 1 to 6.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 6.
CN202310648409.3A 2023-06-01 2023-06-01 Color taking method and device and electronic equipment Pending CN116958280A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310648409.3A CN116958280A (en) 2023-06-01 2023-06-01 Color taking method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310648409.3A CN116958280A (en) 2023-06-01 2023-06-01 Color taking method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN116958280A true CN116958280A (en) 2023-10-27

Family

ID=88457221

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310648409.3A Pending CN116958280A (en) 2023-06-01 2023-06-01 Color taking method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116958280A (en)

Similar Documents

Publication Publication Date Title
US20150009226A1 (en) Color chart detection apparatus, color chart detection method, and color chart detection computer program
CN113676713A (en) Image processing method, apparatus, device and medium
WO2014208472A1 (en) Image processing device, image processing method, and non-transitory storage medium storing image processing program
CN113674164A (en) Sample color correction method, sample color correction device, electronic device, and medium
JP2015158626A (en) Calibration device, calibration method and program
CN115278186B (en) Controllable uniform projection method, device, equipment and medium based on Internet of things
CN115760653B (en) Image correction method, device, equipment and readable storage medium
CN112929625A (en) Display material rendering method and device
CN109559707B (en) Gamma value processing method and device of display panel and display equipment
CN116958280A (en) Color taking method and device and electronic equipment
CN116883336A (en) Image processing method, device, computer equipment and medium
CN108447456B (en) A kind of image shows bearing calibration and device
CN113870800B (en) Backlight adjusting method and device, terminal equipment and storage medium
CN114928732A (en) Image color calibration method and device, electronic equipment and readable storage medium
CN111458112B (en) Color coordinate measuring method, device, equipment and storage medium based on Gamma correction
CN111276092B (en) Optimization parameter determination method and device
CN114286000A (en) Image color processing method and device and electronic equipment
CN108628715B (en) Display effect correction method and device of display equipment
CN112365833A (en) Method for detecting and correcting brightness adjustment value of light sensation under screen
US9082163B2 (en) Image processing device
CN108282643B (en) Image processing method, image processing device and electronic equipment
CN113327552A (en) Gamma debugging method and device, electronic equipment and storage medium
CN112201192B (en) Method, device, equipment and medium for determining gamma value of display
US10586126B2 (en) Change degree deriving apparatus, change degree deriving method and non-transitory computer readable medium
CN111243039B (en) Method and device for adjusting image color

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination