Image data processing method, device, electronic device and storage medium
By determining the color extraction area in the screen image of the display screen and assigning color weights to the pixels, the problem of inaccurate color extraction of the existing ambient light is solved, and the authenticity and user experience of the ambient light lighting effect are improved.
Patent Information
- Application Number
- CN202111498616.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-12-09
AI Technical Summary
Existing ambient lights rely on color averages in the color extraction process, causing the light color to be inconsistent with the real color of the image and unable to effectively reflect the actual color information of the image, resulting in poor user experience.
By determining the color extraction area in the screen image of the display screen, calculating the hue average based on the RGB color space value of each pixel, and giving each pixel a color weight, a weighted average calculation is performed to improve the accuracy of image color extraction. sex.
By giving different weights to each pixel in the image, the extracted image color space value is closer to the actual color of the image, which improves the authenticity and user experience of the ambient lighting effect.
Smart Images

Figure CN114266838B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and more specifically, to an image data processing method, device, electronic device and storage medium. Background Art
[0002] The color information of an image is a relatively simple but widely used visual feature. Color information is often related to the objects or scenes contained in the image. Compared with other image features (brightness, texture, etc.), color information is less dependent on changes in image size, direction, and viewing angle, and has better robustness. Therefore, the color information of an image is often used in application scenarios that require color control based on color information, such as the lighting effect control of ambient lights.
[0003] At present, most atmosphere lights calculate the color average value based on the RGB (Red, Green, Blue) values of all pixels in the image during the color extraction process, and use the color average value to control the light color of the atmosphere light. However, since the method of collecting color information relies on the color average value, there is a large difference between the collected color information and the actual color of the image. Therefore, the solution of using the color average value to control the lighting effect often causes the color of the light to be inconsistent with the actual color of the image. Therefore, the lighting effect displayed by the atmosphere light is not realistic enough. Summary of the invention
[0004] The embodiments of the present application provide an image data processing method, device, electronic device and storage medium, aiming to improve the quality of image color extraction.
[0005] In a first aspect, some embodiments of the present application provide an image data processing method for acquiring a screen image of a display screen; determining at least one color picking area in the screen image, the color picking area being used to represent a portion of the image area delineated on the screen image; determining a hue average value corresponding to the RGB color space value based on the RGB color space value of each pixel in the color picking area; determining a color weight corresponding to the RGB color space value of each pixel based on the hue average value; and determining a target color space value of the color picking area based on the RGB color space value and the color weight.
[0006] In a second aspect, some embodiments of the present application also provide an image data processing device, including an image acquisition module for acquiring a screen image of a display screen; an area determination module for determining at least one color picking area in the screen image, the color picking area being used to characterize a portion of the image area delineated on the screen image; a hue determination module for determining, based on the RGB color space value of each pixel point in the color picking area, an average hue value corresponding to the RGB color space value; a weight determination module for determining, based on the hue average value, the color weight corresponding to the RGB color space value of each pixel point; and a color determination module for determining, based on the RGB color space value and the color weight, a target color space value of the color picking area.
[0007] In a third aspect, some embodiments of the present application further provide an electronic device, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are called by the processor, the above-mentioned image data processing method is executed.
[0008] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program code, wherein the above-mentioned image data processing method is executed when the program code is executed by a processor.
[0009] The present application provides an image data processing method, which can obtain a screen image of a display screen, and determine at least one color picking area in the screen image, and then determine the hue average value corresponding to the RGB color space value according to the RGB color space value of each pixel in the color picking area, and further, based on the hue average value, determine the color weight corresponding to the RGB color space value of each pixel, and determine the target color space value of the color picking area according to the RGB color space value and the color weight. Thus, by assigning different weights to each pixel in the image, so as to calculate the weighted average value of all pixels, the extracted image color space value is closer to the actual color of the image, thereby improving the quality of image color extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 A flow chart of an image data processing method provided in an embodiment of the present application is shown.
[0012] Figure 2 A schematic diagram showing the relationship between a color picking area and a light emitting device provided in an embodiment of the present application is shown.
[0013] Figure 3 A flow chart of another image data processing method provided in an embodiment of the present application is shown.
[0014] Figure 4 A flowchart of an image data processing method provided in an embodiment of the present application is shown.
[0015] Figure 5 A schematic diagram of different color space values of a color picking area provided in an embodiment of the present application is shown.
[0016] Figure 6 A schematic diagram of an application scenario of an image data processing method provided in an embodiment of the present application is shown.
[0017] Figure 7 A module block diagram of an image data processing device provided in an embodiment of the present application is shown.
[0018] Figure 8 This is a module block diagram of an electronic device provided in an embodiment of the present application.
[0019] Fig. 9 It is a module block diagram of a computer-readable storage medium provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be understood as limiting the present application.
[0021] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0022] In the process of image color extraction, the existing technology usually calculates the color average value based on the colors of the red, green, and blue color channels corresponding to all pixels on the image. Specifically, a certain area on the image is determined as the color extraction area, and then each pixel in the color extraction area is traversed, and the values of the red, green, and blue color channels of each pixel are summed up, and then divided by the total number of pixels to obtain the color average value of the color extraction area. In this way, the color information of the image can be obtained by calculating the color average value of multiple color extraction areas, which can be used in different color control application scenarios.
[0023] For example, with the continuous development of smart home technology, smart atmosphere lights have been favored by many users. Ambient lights can automatically change their lighting effects based on the color information displayed on the TV screen or computer display. However, since the color information of the display screen obtained by the atmosphere light is based on the color average of the color acquisition area, the final lighting effect displayed does not match the real color of the image, resulting in a poor user experience.
[0024] In order to solve the above problems, the inventors have proposed an image data processing method provided by the embodiment of the present application after long-term research. The method can obtain the screen image of the display screen, determine at least one color picking area in the screen image, and determine the hue average value corresponding to the RGB color space value according to the RGB color space value of each pixel in the color picking area, and then determine the color weight corresponding to the RGB color space value of each pixel based on the hue average value, and determine the target color space value of the color picking area according to the RGB color space value and the color weight. Thus, by calculating the weighted average value of all pixels, the color quality of the extracted image can be effectively improved.
[0025] The various embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0026] See also Figure 1 , Figure 1 An image data processing method provided by an embodiment of the present application is shown, and the image data processing method may include steps S110 to S150.
[0027] Step S110: Acquire a screen image of the display screen.
[0028] Wherein, the screen image refers to the image displayed on the display screen, and when color extraction is performed on the image, the screen image needs to be obtained from the display screen. In some embodiments, the screen image of the display screen can be obtained according to different hardware devices for collecting colors.
[0029] As an implementation method, the screen image of the display screen can be obtained through a camera. For example, in a scenario where the screen color of a TV is used to control the lighting effect of an ambient light, a camera can be installed above the TV display screen, and then the screen image displayed on the TV display screen can be captured through the camera. Optionally, the camera can capture the screen corresponding to each frame of the video displayed on the display screen as the screen image.
[0030] As another implementation, the screen image of the display screen can be directly acquired. Optionally, for a terminal device equipped with a display screen, the terminal device can directly acquire the screen image displayed by the display screen using the underlying operating system. For example, when the operating system of the terminal device is a Windows system, the terminal device can acquire the screen image of the display screen using the DXGI graphics device interface provided by the Windows system.
[0031] Step S120: determining at least one color picking area in the screen image.
[0032] The color picking area refers to a portion of the image area delineated on the screen image. Optionally, when the ambient light includes multiple light-emitting devices (such as lamp tubes, light bulbs, etc.), each color picking area can be matched with a light-emitting device, and the lighting effect of the corresponding light-emitting device can be controlled by the color of the color picking area.
[0033] As an implementation method, the size, number and distribution position of the color picking area can be customized by the user according to actual application requirements. Figure 2 As shown in the distribution of the color picking areas, the display screen of the TV has determined 10 color picking areas, each of which corresponds to a light-emitting device in the atmosphere light. For example, color picking area A1 corresponds to light-emitting device D1, and color picking area A2 corresponds to light-emitting device D2. Thus, the color of the color picking area can be used to control the color change of the light-emitting device corresponding to the color picking area, so that the color of each light-emitting device in the atmosphere light is consistent with the color of an associated color picking area, wherein the installation position of the light-emitting device can be determined by different design styles of the atmosphere light, for example, installed on the back of the TV.
[0034] Step S130: determining the average hue value corresponding to the color picking area according to the RGB color space value of each pixel in the color picking area.
[0035] In the embodiment of the present application, the RGB color space value refers to a combination of values based on the three basic colors of red (Red, R), green (Green, G), and blue (Blue, B) for representing the color of an image, wherein the range of each value is: R [0, 255], G [0, 255], B [0, 255]. The hue average value refers to the arithmetic average of the color hue values of all pixels in the color sampling area.
[0036] In some embodiments, when a preset application is running, a color picking area is determined on the screen image shown on the display screen, and then the RGB color space value of each pixel is obtained from the color picking area. The preset application can be an entertainment application, such as a video playback application, a music playback application, a game application, etc., or it can be a work application, such as a mind mapping application, a work meeting application, etc. It can be set by the user or pre-set by the system, and is not limited here.
[0037] As an implementation method, after obtaining the RGB color space value corresponding to each pixel in the color picking area, further, the HSV color space value corresponding to each pixel can be calculated based on the RGB color space value corresponding to each pixel, and the hue average value of the color picking area can be calculated based on the HSV color space value corresponding to each pixel.
[0038] Among them, the HSV color space value is used to represent the color hue (Hue, H), saturation / brightness / color purity (Saturation, S) and brightness / brightness (Value, V). Optionally, after obtaining the HSV color space value corresponding to each pixel, the hue average value can be calculated based on the color hue values of all pixels in the color selection area.
[0039] Step S140: determining the color weight corresponding to the RGB color space value of each pixel based on the hue average value.
[0040] The existing technology has the problem that the color of the collected color picking area is significantly different from the color of the actual image. Considering that the reason for this large difference is that the average value of the RGB color space values of all pixels in the color picking area is directly calculated as the color characterizing the color of the color picking area, and there is a certain color difference on each pixel, for example, the red and blue of some pixels are more obvious, while the red and blue of some pixels are not obvious.
[0041] To this end, when calculating the color of the color picking area, a color weight corresponding to each pixel can be assigned, so that the color information of each pixel can be retained in the color of the color picking area finally obtained, so that the collected color is more realistic. Among them, the color weight refers to the contribution value of each pixel in the color picking area when calculating the color of the color picking area.
[0042] As an implementation manner, the hue value in the HSV color space value of each pixel may be obtained, and further, the color weight corresponding to the RGB color space value of each pixel may be determined based on the color hue value and the hue average value of each pixel.
[0043] Step S150: Determine the target color space value of the color extraction area according to the RGB color space value and the color weight.
[0044] As an implementation method, the color value of each channel in the RGB color space value can be weighted averaged to obtain the weighted average value corresponding to the color value of each channel. Specifically, for the red channel, the product of the red color value corresponding to each pixel and its own color weight is obtained, and then the weighted average value corresponding to the color value of the color-selected area in the red channel is calculated based on the product and the number of all pixels. Similarly, the weighted average values corresponding to the color values of the green channel and the blue channel are calculated, thereby obtaining the target color space value composed of the weighted average values corresponding to the color values of the three color channels.
[0045] In an embodiment of the present application, a screen image of a display screen can be obtained, and at least one color picking area can be determined in the screen image, and then the hue average value corresponding to the RGB color space value can be determined based on the RGB color space value of each pixel in the color picking area, and further, based on the hue average value, the color weight corresponding to the RGB color space value of each pixel can be determined, and the target color space value of the color picking area can be determined based on the RGB color space value and the color weight. Thus, by assigning different weights to each pixel in the image, a weighted average value can be calculated for the color values of all pixels, so that the extracted image color space value is closer to the actual color of the image, so as to improve the quality of image color extraction.
[0046] like Figure 3 As shown, Figure 3 Another image data processing method provided by an embodiment of the present application is schematically illustrated. The image data processing method may include steps S201 to S210.
[0047] Step S201: Acquire a screen image of a display screen through a camera.
[0048] Step S202: determining at least one color picking area in the screen image.
[0049] In this embodiment, the specific implementation of step S201 and step S202 can refer to the description of step S110 and step S120 provided in the above embodiment, and will not be described in detail here.
[0050] Step S203: Obtain the RGB color space value of each pixel in the color picking area, and determine the HSV color space value based on the RGB color space value, where the HSV color space value includes the color and hue.
[0051] In the embodiment of the present application, the RGB color space value of each pixel in the color picking area can be obtained according to different application scenarios. Specifically, the device for obtaining the RGB color space value can calculate the RGB color space value of each pixel in the color picking area based on different operating systems. It should be noted that the calculation operation of the RGB color space value can be performed by the atmosphere light or by a terminal device with a display screen, which is not limited here.
[0052] For example, when the terminal device is installed with the Windows operating system, the Windows device can be used to collect images of the color picking area through the DXGI graphics device interface, create a D3DDevice, obtain the IDXGIOutputDuplication object, call AcquireNextFrame, obtain the RGB color space value of the color picking area of the current display, save it in the IDXGIResource, and map the RGB color space value of the color picking area from the GPU to the memory, that is, the RGB color space value of each pixel in the color picking area is obtained.
[0053] As an implementation method, after obtaining the RGB color space value of each pixel in the color picking area, the RGB color space value and the HSV color space value conversion algorithm / software can be used to calculate the RGB color space value of each pixel corresponding to the HSV color space value. For example, in Matlab computing software, the rgb2hsv() method can be called to convert the RGB color space value into the hue value, saturation value, and lightness value of the HSV color space value.
[0054] Step S204: Determine the hue average value corresponding to the RGB color space value according to the number of pixels and the color hue value corresponding to each pixel.
[0055] As an implementation method, the color hue value of each pixel can be determined according to the HSV color space value of each pixel, and then the hue average value can be calculated according to the color hue value of each pixel and the number of pixels. For example, the color hue value, saturation value and lightness value of the HSV color space value are denoted as H, S, and V, respectively. The hue average value of the color sampling area The calculation formula is:
[0056]
[0057] Among them, n(n∈N * ) represents the number of pixels contained in each color picking area, V i Indicates the color hue value corresponding to the i-th pixel in the color picking area.
[0058] Step S205: determining whether the absolute value of the difference between the color hue value and the hue average value is greater than a preset threshold.
[0059] The preset threshold refers to the preset threshold of the difference between the color hue value and the hue average value. The value of the preset threshold can be set by professionals. In the application embodiment, the preset threshold can be set to 30, which is recorded as
[0060] As an implementation method, the color hue value V of each pixel can be determined by i With the average value of the tone Is the absolute value of the difference greater than the preset threshold? To determine the color weight of each pixel. Specifically, the absolute value of the difference between the color hue value and the hue average value |V| can be expressed as:
[0061]
[0062] Step S206a: If the absolute value of the difference between the color hue value and the hue average value is not greater than the preset threshold, the color weight is determined to be the standard weight.
[0063] The standard weight refers to the default color weight. It should be noted that the color weight is determined by the weight coefficient μ i The maximum deviation value V from the preset threshold max =100, for example, the color weight W of the i-th pixel i =μ i ×V max .
[0064] As an implementation method, when it is determined that the absolute value of the difference between the color hue value of the i-th pixel and the hue average value is not greater than the preset threshold, that is, Determine the weight coefficient of the pixel point by default i =1, and then calculate the color weight of the pixel That is, the standard weight.
[0065] Step S206b: If the absolute value of the difference between the color hue value and the hue average value is greater than the preset threshold, obtain the difference between the absolute value of the difference and the preset threshold, and determine whether the difference between the absolute value of the difference and the preset threshold is less than the maximum deviation value.
[0066] As an implementation method, when it is determined that the absolute value of the difference between the color hue value of a certain pixel and the hue average value is greater than a preset threshold, that is, Calculate the absolute value of the difference |V| and the preset threshold The difference is denoted as And determine whether the difference between the absolute value of the difference and the preset threshold is less than the maximum deviation value.
[0067] Step S207b: If the difference between the absolute value of the difference and the preset threshold is smaller than the maximum deviation value, weight calculation is performed on the absolute value of the difference to obtain a color weight.
[0068] As an implementation method, when the absolute value of the difference is greater than the preset threshold Less than the maximum deviation value V max When, that is, The absolute value of the difference is weighted to obtain the color weight of the pixel. Specifically, the weight coefficient μ of the pixel can be calculated first. i , and then according to the weight coefficient μ i and standard weights Calculate the color weight W of the pixel i , the specific calculation formula is:
[0069]
[0070]
[0071] Step S208b: If the difference between the absolute value of the difference and the preset threshold is not less than the maximum deviation value, the color weight is determined to be zero.
[0072] As an implementation method, when it is determined that the difference between the absolute value of the difference and the preset threshold is not less than the maximum deviation value, that is, Determine the weight coefficient μ of the pixel i =0, and then the color weight of the pixel is obtained
[0073] Step S209: Based on the red channel value and the color weight, determine the first color weighted average value corresponding to the red channel value; based on the green channel value and the color weight, determine the second color weighted average value corresponding to the green channel value; based on the blue channel value and the color weight, determine the third color weighted average value corresponding to the blue channel value.
[0074] As an implementation method, according to the RGB color space value of the color picking area, the first color weighted average value corresponding to the red channel value can be determined based on the red channel value and the color weight. The calculation formula is:
[0075]
[0076] Among them, R i is the color value of the i-th pixel on the red channel. Further, based on the green channel value and the color weight, the second color weighted average value corresponding to the green channel value is determined. The calculation formula is:
[0077]
[0078] Among them, G i is the color value of the i-th pixel on the green channel. Further, based on the blue channel value and the color weight, the third color weighted average value corresponding to the blue channel value is determined. The calculation formula is:
[0079]
[0080] Among them, B i is the color value of the i-th pixel in the blue channel.
[0081] Step S210: Determine a target color space value according to the first color weighted average value, the second color weighted average value, and the third color weighted average value.
[0082] As an implementation method, the target color space value may be determined according to the first color weighted average value, the second color weighted average value, and the third color weighted average value. That is:
[0083]
[0084] See also Figure 4 , Figure 4 A flowchart of an image data processing method is shown. In some embodiments, the corresponding HSV color space value is calculated by taking the RGB color space value of each pixel in the color region to obtain the hue average value, and further,
[0085] Traverse all the pixels in the color picking area, if the color hue value V corresponding to the i-th pixel i The average hue of the color area The absolute value of the difference is less than or equal to the preset threshold Then the color weight of the pixel is the standard weight If it is greater than the preset threshold And the absolute value of the difference between the color hue value and the hue average value |V| is equal to the preset threshold The difference Recorded as, If the value is greater than or equal to the maximum deviation value, the color weight of the pixel is zero. i =0, otherwise, weight calculation is performed to obtain the weight coefficient μ of the pixel point i :
[0086]
[0087] Furthermore, the color weight can be obtained
[0088] Furthermore, according to the RGB color space value and the color weight, the target color space value of the color picking area is determined, which is:
[0089]
[0090] For example, Figure 5 The RGB color space value of each pixel in a certain color picking area is shown, and the corresponding HSV color space value and color weight are shown, where the calculated hue average value is 60 and the preset threshold is 30. Under normal circumstances, the RGB of the color average value of the color picking area is directly calculated: (72, 109, 72). It can be seen that there are more red and blue colors, and the color picking area is closer to white. The RGB of the weighted color average value of the color picking area calculated by the present application is: (49, 155, 49). It can be seen that there are fewer red and blue colors, and the green of the color picking area is more obvious, while the actual color of the color picking area is green. In this way, the RGB space color value calculated by the present application is closer to the color of the actual image.
[0091] In some embodiments, see Figure 6 , Figure 6 An application scenario of the image data processing method involved in the present application is shown. In this scenario, the camera 301 is installed on the top of the display screen of the TV 303, wherein the atmosphere light 305 may include a plurality of light-emitting devices, and the atmosphere light 305 and the camera 301 may be connected by wireless communication.
[0092] As an implementation method, the camera 301 can capture the screen image on the display screen of the TV 303 and send the screen image to the atmosphere light 305. The atmosphere light 305 can determine at least one color picking area in the screen image, and obtain the RGB color space value of each pixel in the color picking area, and determine the HSV color space value based on the RGB color space value. The HSV color space value includes the color hue. Further, according to the number of pixels and the color hue value corresponding to each pixel, the hue average value corresponding to the RGB color space value is determined, and based on the hue average value, the color weight corresponding to the RGB color space value of each pixel is determined, and then the target color space value of the color picking area is determined according to the RGB color space value and the color weight. Further, the atmosphere light can control the corresponding light-emitting device to display the lighting effect according to the target color space value of the color picking area.
[0093] It should be noted that the calculation process of the target color space value of the atmosphere light in this scenario can also be completed by a terminal device with computing functions. For example, the TV is replaced with a computer. At this time, after the camera obtains the screen image, it is directly transmitted to the computer's processor for calculation to obtain the target color space value. The computer then transmits the target color space value to the atmosphere light, and the atmosphere light controls the lighting effect of the light-emitting device according to the target color space value of each color picking area.
[0094] Figure 6 The application scenario diagram of the image data processing method shown is merely an example. The application scenario of the image data processing method described in the embodiment of the present invention is intended to more clearly illustrate the technical solution of the embodiment of the present invention, and does not constitute a limitation on the technical solution provided by the embodiment of the present invention. A person of ordinary skill in the art can know that with the emergence of new application scenarios of the image data processing method, the technical solution provided by the embodiment of the present invention is also applicable to similar technical problems.
[0095] In the embodiment of the present application, a screen image of a display screen is acquired by a camera, and at least one color picking area is determined in the screen image, the RGB color space value of each pixel in the color picking area is acquired, and based on the RGB color space value, the HSV color space value is determined, the HSV color space value includes the color hue, and further, according to the number of pixels and the color hue value corresponding to each pixel, the hue average value corresponding to the RGB color space value is determined, and it is judged whether the absolute value of the difference between the color hue value and the hue average value is greater than a preset threshold value; if the absolute value of the difference between the color hue value and the hue average value is not greater than the preset threshold value, the color weight is determined to be the standard weight; if the absolute value of the difference between the color hue value and the hue average value is greater than the preset threshold value, the absolute value of the difference is obtained. Set a threshold difference, and determine whether the difference between the absolute value of the difference and the preset threshold is less than the maximum deviation value. If the difference between the absolute value of the difference and the preset threshold is less than the maximum deviation value, perform weight calculation on the absolute value of the difference to obtain a color weight. If the difference between the absolute value of the difference and the preset threshold is not less than the maximum deviation value, determine that the color weight is zero. Further, based on the red channel value and the color weight, determine a first color weighted average value corresponding to the red channel value; based on the green channel value and the color weight, determine a second color weighted average value corresponding to the green channel value; based on the blue channel value and the color weight, determine a third color weighted average value corresponding to the blue channel value, and determine the target color space value based on the first color weighted average value, the second color weighted average value and the third color weighted average value.
[0096] Therefore, by assigning different weights to each pixel in the image, a weighted average value is calculated for all pixels, so that the extracted image color space value is closer to the actual color of the image, thereby improving the quality of image color extraction.
[0097] See also Figure 7 , which shows a structural block diagram of an image data processing device 400 provided in an embodiment of the present application. The image data processing device 400 includes: an image acquisition module 410, used to acquire a screen image of a display screen; an area determination module 420, used to determine at least one color picking area in the screen image, the color picking area being used to characterize a portion of the image area delineated on the screen image; a hue determination module 430, used to determine the hue average value corresponding to the color picking area according to the RGB color space value of each pixel in the color picking area; a weight determination module 440, used to determine the color weight corresponding to the RGB color space value of each pixel based on the hue average value; a color determination module 450, used to determine the target color space value of the color picking area according to the RGB color space value and the color weight.
[0098] In some embodiments, the hue determination module 430 can be specifically used to: obtain the RGB color space value of each pixel in the color picking area; determine the HSV color space value based on the RGB color space value, and the HSV color space value includes the color hue value; determine the hue average value corresponding to the color picking area according to the number of pixels and the color hue value corresponding to each pixel.
[0099] In some embodiments, the weight determination module 440 can be specifically used to: determine whether the absolute value of the difference between the color hue value and the hue average value is greater than a preset threshold; if the absolute value of the difference between the color hue value and the hue average value is not greater than the preset threshold, determine that the color weight is the standard weight.
[0100] In some embodiments, the weight determination module 440 may also be specifically used to: if the absolute value of the difference between the color hue value and the hue average value is greater than a preset threshold, obtain the difference between the absolute value of the difference and the preset threshold; determine whether the difference between the absolute value of the difference and the preset threshold is less than the maximum deviation value; if the difference between the absolute value of the difference and the preset threshold is less than the maximum deviation value, perform weight calculation on the absolute value of the difference to obtain the color weight. If the difference between the absolute value of the difference and the preset threshold is not less than the maximum deviation value, determine that the color weight is zero.
[0101] In some embodiments, the RGB color space value includes a red channel value, a green channel value, and a blue channel value. The color determination module 450 can be specifically used to determine a first color weighted average value corresponding to the red channel value based on the red channel value and the color weight; determine a second color weighted average value corresponding to the green channel value based on the green channel value and the color weight; determine a third color weighted average value corresponding to the blue channel value based on the blue channel value and the color weight; and determine the target color space value based on the first color weighted average value, the second color weighted average value, and the third color weighted average value.
[0102] In some embodiments, the image acquisition module 410 may be specifically configured to acquire a screen image displayed on a display screen through a camera.
[0103] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0104] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0105] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0106] In an embodiment of the present application, a screen image of a display screen can be obtained, and at least one color picking area can be determined in the screen image, and then the hue average value corresponding to the RGB color space value can be determined based on the RGB color space value of each pixel in the color picking area, and further, based on the hue average value, the color weight corresponding to the RGB color space value of each pixel can be determined, and the target color space value of the color picking area can be determined based on the RGB color space value and the color weight. Thus, by assigning different weights to each pixel in the image, so as to calculate the weighted average value of all pixels, the extracted image color space value is closer to the actual color of the image, thereby improving the quality of image color extraction.
[0107] The embodiment of the present application also provides a lighting effect control system. The lighting effect control system may include an image data processing device 400 and a plurality of light-emitting devices, the plurality of light-emitting devices may be communicatively connected with the image data processing device 400, the plurality of light-emitting devices may receive a target color space value sent from the image data processing device 400, and generate a lighting effect control instruction according to the target color space value to display a lighting effect corresponding to the target color space value.
[0108] like Figure 8 As shown, an embodiment of the present application further provides an electronic device 500, which includes a processor 510 and a memory 520, wherein the memory 520 stores computer program instructions, and when the computer program instructions are called by the processor 510, the above-mentioned image data processing method is executed.
[0109] The processor 510 may include one or more processing cores. The processor 510 uses various interfaces and lines to connect various parts of the entire battery management system, and executes various functions and processes data of the battery management system by running or executing instructions, programs, code sets or instruction sets stored in the memory 520, and calling data stored in the memory 520. Optionally, the processor 510 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 510 can integrate one or more combinations of a central processing unit 510 (CPU), a graphics processing unit 510 (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 510, but may be implemented separately through a communication chip.
[0110] The memory 520 may include a random access memory 520 (Random Access Memory, RAM), and may also include a read-only memory 520 (Read-Only Memory). The memory 520 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 520 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the various method embodiments described below, etc. The data storage area may also store data created by the electronic device during use (such as a phone book, audio and video data, chat record data), etc.
[0111] like Fig. 9 As shown, an embodiment of the present application further provides a computer-readable storage medium 600, in which computer program instructions 610 are stored. The computer program instructions 610 can be called by a processor to execute the method described in the above embodiment.
[0112] The computer readable storage medium may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium includes a non-transitory computer-readable storage medium. The computer readable storage medium 700 has storage space for program codes that execute any of the method steps in the above method. These program codes may be read from or written to one or more computer program products. The program code may be compressed, for example, in an appropriate form.
[0113] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations provided in the above embodiments.
[0114] The above are only preferred embodiments of the present application, and are not intended to limit the present application in any form. Although the present application has been disclosed as above with preferred embodiments, it is not intended to limit the present application. Any technical personnel in the field can make some changes or modify the technical contents disclosed above into equivalent embodiments without departing from the scope of the technical solution of the present application. However, any brief modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application are still within the scope of the technical solution of the present application.
Claims
1. A method for processing image data, characterized in that: The method comprises: Get the screen image of the display screen; Determine at least one color picking area in the screen image, wherein the color picking area is used to represent a portion of an image area defined on the screen image; Determine the average hue value corresponding to the color picking area according to the RGB color space value of each pixel point in the color picking area; Based on the hue average value, determining the color weight corresponding to the RGB color space value of each pixel; Determining a target color space value of the color picking area according to the RGB color space value and the color weight; The step of determining the hue average value corresponding to the color picking area according to the RGB color space value of each pixel point in the color picking area includes: Obtain the RGB color space value of each pixel in the color picking area; Based on the RGB color space value, determining an HSV color space value, the HSV color space value including a color hue value; According to the number of the pixels and the color hue value corresponding to each pixel, the hue average value corresponding to the color sampling area is determined.
2. The method according to claim 1, characterized in that The step of determining the color weight corresponding to the RGB color space value of each pixel based on the hue average value includes: Determine whether the absolute value of the difference between the color hue value and the hue average value is greater than a preset threshold; If the absolute value of the difference between the color hue value and the hue average value is not greater than a preset threshold, the color weight is determined to be a standard weight.
3. The method according to claim 2, characterized in that The method further comprises: If the absolute value of the difference between the color hue value and the hue average value is greater than a preset threshold, then obtaining the difference between the absolute value of the difference and the preset threshold; Determine whether the difference between the absolute value of the difference and a preset threshold is less than a maximum deviation value; If the difference between the absolute value of the difference and the preset threshold is smaller than the maximum deviation value, weight calculation is performed on the absolute value of the difference to obtain a color weight; If the difference between the absolute value of the difference and the preset threshold is not less than the maximum deviation value, the color weight is determined to be zero.
4. The method according to claim 1, characterized in that: The RGB color space value includes a red channel value, a green channel value, and a blue channel value. Determining the target color space value of the color picking area according to the RGB color space value and the color weight includes: Based on the red channel value and the color weight, determining a first color weighted average value corresponding to the red channel value; Determine a second color weighted average value corresponding to the green channel value based on the green channel value and the color weight; Determine a third color weighted average value corresponding to the blue channel value based on the blue channel value and the color weight; A target color space value is determined according to the first color weighted average value, the second color weighted average value, and the third color weighted average value.
5. The method according to claim 1, characterized in that The acquiring of the screen image of the display screen includes: acquiring the screen image displayed by the display screen through a camera.
6. An image data processing device, characterized in that: The device comprises: An image acquisition module, used to acquire a screen image of a display screen; An area determination module, used to determine at least one color picking area in the screen image, wherein the color picking area is used to represent a portion of an image area delineated on the screen image; A hue determination module, used to determine the average hue value corresponding to the color picking area according to the RGB color space value of each pixel point in the color picking area; A weight determination module, used to determine the color weight corresponding to the RGB color space value of each pixel based on the hue average value; A color determination module, used to determine a target color space value of the color picking area according to the RGB color space value and the color weight; The hue determination module is specifically used to: obtain the RGB color space value of each pixel in the color picking area; determine the HSV color space value based on the RGB color space value, and the HSV color space value includes the color hue value; determine the hue average value corresponding to the color picking area according to the number of pixels and the color hue value corresponding to each pixel.
7. A lighting effect control system, characterized in that: include: The image data processing device according to claim 6; A plurality of light-emitting devices are communicatively connected with the image data processing device, the plurality of light-emitting devices receive target color space values sent from the image data processing device, and generate lighting effect control instructions according to the target color space values to display lighting effects.
8. An electronic device, characterized in that: include: Memory; One or more processors coupled to the memory; One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors, and the one or more applications are configured to execute the image data processing method according to any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the image data processing method according to any one of claims 1 to 5.
