Method, device and display device for controlling color of marquee based on screen color
By periodically acquiring screen color data in the marquee and converting it to the HSL color space for weighted color distance matching, the problem of the traditional marquee being disconnected from the screen content is solved, achieving a seamless integration of light and screen image perception, and improving immersive experience and hardware compatibility.
Patent Information
- Application Number
- CN202610998654.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-06
- Publication Date
- 2026-11-03
AI Technical Summary
The lighting changes of traditional marquee lights are disconnected from the content displayed on the screen, making it difficult to create an immersive light and shadow experience. Existing solutions calculate based on RGB average values, which leads to perceptual discrepancies in the human eye.
By periodically acquiring screen color data, converting it to the HSL color space, calculating the weighted color distance, selecting the target color with the smallest color distance to drive the marquee, and using the HSL color space for color mapping and low-pass filter smoothing.
It achieves a perfect match between the light color and the perceived screen image, enhancing the immersive light and shadow experience, is compatible with different hardware configurations, and avoids the glare caused by sudden changes in light.
Smart Images

Figure CN123035577A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of lighting control technology, and in particular to a method, apparatus, and display device for controlling the color of a running light based on screen color. Background Technology
[0002] As a common decorative lighting device, marquee lights are widely used in creating indoor atmosphere, commercial displays, and peripheral lighting systems for consumer electronics products.
[0003] Traditional marquees often use a fixed programming pattern, which means they flash in a cycle according to a preset time sequence and color combination. The pattern of light changes has no relation to the content displayed on the screen, resulting in a disconnect between the lighting atmosphere and the video, game, or application content that the user is currently watching, making it difficult to create an immersive light and shadow experience.
[0004] To improve this situation, existing solutions attempt to control the color of the scrolling light by analyzing the screen content. These solutions typically calculate the average of the RGB components of the screen pixels and use the resulting average as the target color to drive the light. However, the RGB color space, when describing color, exhibits a significant non-linear difference between its numerical variations and human visual perception. That is, two colors with the same numerical difference in the RGB space may not appear to have the same color difference to the human eye. This inherent characteristic leads to a perceptual discrepancy between the dominant hue calculated from the RGB average and the dominant color actually perceived by the human eye, affecting the naturalness of the synchronized effect. Summary of the Invention
[0005] To address the above problems, the present invention provides a method, apparatus, and display device for controlling the color of a marquee based on screen color.
[0006] In a first aspect, the present invention provides a method for controlling the color of a marquee light based on screen color, comprising: Periodically retrieve the color data corresponding to the content currently displayed on the screen; The source RGB value is extracted from the color data, and the source RGB value represents the main color tone of the content currently displayed on the screen. The source RGB value is converted to the HSL color space to obtain the source HSL value. The weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library is calculated. The RGB value corresponding to the target color with the smallest weighted color distance is selected as the target RGB value. The target RGB value is sent to the marquee driver circuit to drive the marquee to update its color.
[0007] In other optional implementations, the step of calculating the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library includes: The weighted color distance between the source HSL value and each target HSL value is calculated based on the weighted Euclidean distance; wherein, the hue component difference is calculated using the circumferential distance, and the weighting coefficient of the hue component difference is greater than the weighting coefficient of the saturation component difference and the weighting coefficient of the luminance component difference.
[0008] In other optional implementations, the periodic acquisition of color data corresponding to the currently displayed screen content includes any of the following methods: Capture the corresponding frame data using the graphical application programming interface provided by the operating system; Pixel data in the display frame buffer can be read directly through the memory mapping interface; Read the title bar background color of the active window in the foreground or the screen background color of the player window; The auxiliary channel of the display interface receives the main color statistics returned by the display driver chip; The main light source color parameters are read from the rendering buffer through the rendering interface provided by the game engine.
[0009] In other alternative implementations, when directly reading pixel data from the display frame buffer via a memory-mapped interface, at least one of the following is also included: Synchronize the vertical synchronization signal to obtain pixel data for the entire frame; When the processor load exceeds a preset threshold, the acquisition frequency is reduced, and the acquired pixel data is hardware compressed.
[0010] In other optional implementations, the periodic acquisition of color data corresponding to the currently displayed screen content includes: The color data is acquired at a preset fixed period or an adaptive period; wherein, the adaptive period refers to dynamically adjusting the acquisition frequency according to the speed of change of the current screen display content.
[0011] In other optional implementations, when the color data is frame data or pixel data, the step of extracting the source RGB value based on the color data includes any of the following methods: The source RGB value is obtained by downsampling all pixels of the currently displayed content and calculating the RGB average value of all sampled points. The entire area or edge area of the currently displayed content on the screen is divided into partitions, and the average RGB value of the pixels in each partition is calculated to obtain the source RGB value. Each partition corresponds to a segment of the marquee. Identify the active window in the foreground, and perform color histogram statistics based on the pixels of the active window to obtain the source RGB value.
[0012] Other alternative implementations include at least one of the following: Before extracting the source RGB values based on the color data, abnormal pixels are discarded, including at least one of pure black pixels and pure white pixels; When the target RGB value is sent to the marquee driver circuit, a low-pass filter is used to smooth the target RGB value so that the marquee color gradually changes from the current color to the target RGB value.
[0013] In other optional implementations, when the marquee is a monochrome or limited color LED, the steps of converting the source RGB value to the HSL color space to obtain the source HSL value, calculating the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library, and selecting the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value are performed. When the running light is an RGB three-channel LED, the source RGB value is directly sent to the running light driver circuit.
[0014] Secondly, the present invention provides a device for controlling the color of a marquee light based on screen color, comprising: The color acquisition module is used to periodically acquire the color data corresponding to the content currently displayed on the screen; The primary color extraction module is used to extract source RGB values based on the color data, where the source RGB values represent the primary color of the content currently displayed on the screen. The color mapping module is used to convert the source RGB value to the HSL color space to obtain the source HSL value, calculate the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library, and select the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value. The control execution module is used to send the target RGB value to the marquee driver circuit to drive the marquee to update its color.
[0015] Thirdly, the present invention provides a display device, comprising: Display screen; A marquee light is mounted on at least one bezel of the display screen; The device described above that controls the color of the marquee based on screen color.
[0016] The present invention provides a method, apparatus, and display device for controlling the color of a marquee display based on screen color. This involves periodically acquiring color data corresponding to the currently displayed screen content; extracting source RGB values from the color data, where the source RGB values represent the dominant color tone of the currently displayed content; converting the source RGB values to the HSL color space to obtain source HSL values; calculating the weighted color distance between the source HSL values and the target HSL values corresponding to each target color in a preset target theme color library; selecting the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value; and sending the target RGB value to the marquee drive circuit to drive the marquee to update its color. In other words, by converting RGB to the HSL color space and performing weighted color distance matching, the target color with the smallest color distance is selected to drive the marquee, solving the problem of human eye perception deviation when directly driving the light based on the average RGB value, making the light color more closely match the actual human perception of the screen image. Simultaneously, through the mapping mechanism of a preset target theme color library + minimum color distance selection, mapping any screen dominant color to a limited target color library is achieved, exhibiting good hardware compatibility. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of an application scenario on which the present invention is based; Figure 2 A flowchart illustrating a method for controlling the color of a marquee based on screen color, provided by the present invention; Figure 3 A schematic diagram illustrating the mapping relationship between screen partitions and marquee segments provided by the present invention; Figure 4 A flowchart illustrating another method for controlling the color of a marquee based on screen color provided by the present invention; Figure 5 This invention provides a schematic diagram of a specific process for extracting RGB values from a partition source. Figure 6 This is a schematic diagram of a device for controlling the color of a marquee light based on screen color, provided by the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings.
[0019] Figure 1 This is a schematic diagram of an application scenario on which the present invention is based, such as... Figure 1As shown, the present invention can be applied to a system including a display screen 101 and a marquee 102, wherein the marquee 102 is arranged along the border of the display screen 101, and a device for controlling the color of the marquee based on the screen color is deployed inside the display screen 101. This device is used to perform the method for controlling the color of the marquee based on the screen color as described in the following embodiments.
[0020] Specifically, the device for controlling the color of a running light based on screen color includes a color acquisition module, a main color extraction module, a color mapping module, and a control execution module. The color acquisition module runs at the operating system level. The main color extraction module and the color mapping module can be combined into an analysis module, deployed on a CPU or GPU, and implemented by software algorithms. The control execution module is further subdivided into a control module and an execution module. The control module is deployed on the GPIO / PWM interface layer of a microcontroller or system-on-a-chip (SoC), or sends commands via Bluetooth / serial port. The execution module contains the running light LED driver circuit and LED beads.
[0021] The aforementioned display screen 101 can be a display screen of an electronic device with image display function, such as a smart TV, LCD monitor, computer monitor, tablet computer, laptop computer, all-in-one gaming console, or conference tablet, and the present invention does not limit it to this.
[0022] In a first aspect, the present invention provides a method for controlling the color of a marquee light based on screen color. Figure 2 This is a flowchart illustrating a method for controlling the color of a marquee based on screen color, as provided by the present invention.
[0023] like Figure 2 As shown, the method for controlling the color of the marquee based on screen color includes: Step 201: Periodically obtain the color data corresponding to the content currently displayed on the screen.
[0024] Specifically, periodicity refers to repeatedly performing the operation of acquiring color data of the screen display content at preset time intervals. Color data is digital information used to characterize the color features of the screen display content.
[0025] In other optional examples, the periodic acquisition of color data corresponding to the current screen display content includes: acquiring the color data at a preset fixed period or an adaptive period; wherein, the adaptive period refers to dynamically adjusting the acquisition frequency according to the speed of change of the current screen display content.
[0026] Furthermore, the periodicity includes two modes: fixed period and adaptive period. Fixed period refers to capturing screen color data at fixed time intervals, preferably 10 frames per second, meaning a capture action is performed every 100 milliseconds. Adaptive period refers to dynamically adjusting the capture frequency based on the speed of screen content changes or processor load. For example, when a long period of screen stillness is detected (such as displaying a static desktop wallpaper), the capture frequency is automatically reduced to save system resources; when high-dynamic scenes such as full-screen video playback or games are detected, the capture frequency is automatically increased to ensure the real-time performance of the light tracking; and when the processor load exceeds a preset threshold, the capture frame rate is dynamically reduced to prevent interface stuttering due to frequent captures. Adaptive period achieves a dynamic balance between real-time light tracking and resource consumption.
[0027] In other optional examples, the periodic acquisition of color data corresponding to the currently displayed content on the screen includes any of the following methods: capturing the corresponding frame data through the graphics application programming interface provided by the operating system; directly reading pixel data in the display frame buffer through the memory mapping interface; reading the background color of the title bar of the active window in the foreground or the background color of the player window; receiving the main color statistics returned by the display driver chip through the auxiliary channel of the display interface; or reading the main light source color parameters in the rendering buffer through the rendering interface provided by the game engine.
[0028] Furthermore, in order to obtain the color data of the currently displayed content on the screen, this invention provides a variety of flexible implementation methods to adapt to different operating system environments and hardware configurations.
[0029] The first method involves capturing the corresponding frame data through the graphics application programming interface (API) provided by the operating system. This method uses the system interface to copy a copy of the color data of the currently displayed image from the video memory and returns it to the application. It is suitable for various general-purpose operating system platforms. For example, in Android, this involves calling the MediaProjection API, or in Windows, it involves calling the DXGI interface.
[0030] The second method is to directly read pixel data from the display frame buffer through a memory-mapped interface. Unlike the first method, this method uses memory mapping (mmap) to directly map the physical address of the video memory to the application's address space, achieving zero-copy access. Therefore, the data reading speed is extremely fast, the CPU usage is low, and it is suitable for embedded systems.
[0031] Preferably, when directly reading pixel data from the display frame buffer via the memory-mapped interface, the method further includes at least one of the following: synchronizing the vertical synchronization signal to obtain pixel data for the complete frame; reducing the acquisition frequency and performing hardware compression on the acquired pixel data when the processor load exceeds a preset threshold. The vertical synchronization signal (V-Sync) is a synchronization pulse signal emitted by the display controller each time a complete frame is refreshed. To prevent the capture of torn frame data, the reading operation is performed only after the V-Sync signal arrives, ensuring that a complete frame is obtained. Furthermore, when the system load is high (e.g., the processor utilization exceeds a preset threshold), the screen capture frequency can be reduced, and pixel data can be compressed to reduce data transmission and prevent interface stuttering.
[0032] The third method obtains color data by reading the background color of the title bar of the active window in the foreground or the background color of the player window. This method directly reads the RGB color values of the title bar of the currently active window or the background of the player window through the window property interface provided by the operating system. The obtained color values are ready-made and do not require screenshots or pixel analysis. This method is only applicable to Windows or desktop environments.
[0033] The fourth method involves receiving primary color statistics returned by the display driver chip via an auxiliary channel (such as AUX or CEC) on the display interface (such as HDMI or DP). This method requires dedicated support from the display hardware, meaning that the display driver chip, while processing image signals normally, uses hardware logic circuits to calculate the primary color of the current image in real time, and then sends the statistical results back to the main control unit through the auxiliary channel.
[0034] The fifth method involves reading the main light source color parameters from the render buffer via the rendering interface provided by the game engine. This method directly obtains the scene's main light source color from the game engine's (Unity / Unreal) render buffer, offering greater accuracy than image analysis. It is specifically designed for game scenes.
[0035] Step 202: Extract the source RGB value based on the color data. The source RGB value represents the main color tone of the content currently displayed on the screen.
[0036] Specifically, the source RGB value is a set of RGB values extracted from the color data that represent the overall color tendency of the current image (i.e., the specific values of the red, green and blue channels, with each channel typically ranging from 0 to 255).
[0037] In other optional examples, the method further includes discarding abnormal pixels, including at least one of pure black pixels and pure white pixels, before extracting the source RGB values from the color data.
[0038] Furthermore, before extracting the source RGB values from the color data, the pixels are preprocessed: abnormal pixels are discarded, such as pure black pixels with RGB values close to (0, 0, 0) and pure white pixels with RGB values close to (255, 255, 255), in order to improve the accuracy and stability of the main color extraction.
[0039] In other optional examples, when the color data is frame data or pixel data, the extraction of source RGB values based on the color data includes any of the following methods: downsampling all pixels of the current screen display content, calculating the RGB average of all sampled points to obtain the source RGB value; partitioning the entire area or edge area of the current screen display content, calculating the RGB average of pixels in each partition to obtain the source RGB value, wherein each partition corresponds to a segment of the marquee; identifying the active window in the foreground, performing color histogram statistics based on the pixels of the active window to obtain the source RGB value.
[0040] Furthermore, in order to extract the source RGB value representing the main color tone of the current screen from the acquired screen color data, the present invention provides three flexible implementation methods to adapt to different screen content types and marquee hardware configurations.
[0041] The first method is the global averaging method. This method uniformly downsamples the entire screen display content, that is, it takes a sampling point every N pixels (the preferred range of N is 8 to 16), and obtains the source RGB value representing the main color tone of the entire screen by calculating the RGB average of all sampled pixels.
[0042] The second method is the edge-first approach. This method divides the current screen content or screen edge area into multiple partitions, calculates the RGB average value of pixels in each partition, and each partition corresponds to a segment of the marquee. For example... Figure 3 This is a schematic diagram illustrating the mapping relationship between screen partitions and marquee segments provided by the present invention. The left area controls the left light strip, and the right area controls the right light strip.
[0043] For example, when the marquee is a long strip of light with 15 independently addressable LED beads, the screen can be horizontally divided into 15 equal parts, each part can be calculated with an independent average RGB value, and then these 15 sets of RGB data can be packaged and sent to the marquee driver circuit through a communication protocol (such as RS232).
[0044] The third method is the window dominant color method. This method first identifies the currently active window in the foreground, and then analyzes only the pixels of that window area, rather than processing the entire screen. In its implementation, a color histogram statistical method is used to extract the dominant color: first, the RGB color components of the pixels within the window are quantized to the high 5 bits (i.e., 32 levels) to form a one-dimensional histogram of 32,768 colors; then, the frequency of each quantized color is counted, and after neighborhood smoothing, the color corresponding to the peak value is taken as the dominant color.
[0045] It should be noted that the three methods for extracting source RGB values described above are applicable to frame data captured through the operating system's graphics API and frame buffer pixel data read through a memory mapping interface. Since both types of data are raw pixel matrices, they require extraction to obtain the source RGB values representing the primary color tone. Other acquisition methods (such as reading the title bar or player background color, receiving primary color statistics returned by the display driver chip, or reading the primary light source color parameters from the game engine's rendering buffer) obtain ready-made color values that can be directly used as source RGB values without the aforementioned extraction process.
[0046] Step 203: Convert the source RGB value to the HSL color space to obtain the source HSL value. Calculate the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library. Select the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value.
[0047] Specifically, the HSL color space decomposes color into three independent perceptual dimensions: hue, saturation, and lightness. This allows for color analysis and comparison to be performed on each of these attributes separately, more closely resembling how the human eye perceives color. Therefore, this step first converts the source RGB values extracted in step 202 to the HSL color space, obtaining source HSL values (containing hue component H1, saturation component S1, and lightness component L1). Simultaneously, each target color in the preset target theme color library is also converted from RGB to HSL, obtaining its corresponding target HSL value (containing hue component H2, saturation component S2, and lightness component L2). Then, the weighted color distance between the source HSL value and each target HSL value is calculated, and the RGB value corresponding to the smallest weighted color distance is selected as the final target RGB value. This step achieves the selection of the target color from the preset target theme color library that is visually closest to the source color.
[0048] In other optional examples, the step of calculating the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library includes: The weighted color distance between the source HSL value and each target HSL value is calculated based on the weighted Euclidean distance; wherein, the hue component difference is calculated using the circumferential distance, and the weighting coefficient of the hue component difference is greater than the weighting coefficient of the saturation component difference and the weighting coefficient of the luminance component difference.
[0049] Furthermore, the formula for weighted Euclidean distance is as follows:
[0050] Where D represents the weighted chromatic distance, Indicates the difference in hue components. Indicates the difference in saturation components. Indicates the difference in luminance components. , , These represent the weighting coefficients for hue, saturation, and brightness, respectively.
[0051] It should be noted that when calculating the difference in hue components... When calculating hue, considering that hue forms a continuous color wheel, linear subtraction cannot be used simply; instead, calculations should be based on circumferential distance. This requires setting weighting coefficients. , , Considering that the human eye is most sensitive to hue differences, followed by saturation differences, and relatively least sensitive to brightness differences, this example assigns the hue component the highest weight, the saturation component a medium weight, and the brightness component the lowest weight. Preferably, the weighting coefficients are set to... , , This makes the color mapping result of the marquee more closely match the actual perception of the human eye.
[0052] In other optional examples, when the marquee is a monochrome or limited-color LED, step S203 is executed; when the marquee is an RGB three-channel LED, the source RGB value is directly sent to the marquee driver circuit.
[0053] Furthermore, when the LED display uses a single-color LED (which can only emit one color of light) or a limited-color LED (which only supports a few preset colors such as red, green, blue, and white), the source RGB value cannot be directly used as the driving instruction because the LED itself does not support arbitrary color output. In this case, step S203 needs to be executed: converting the source RGB value to the HSL color space, calculating the weighted color distance between it and each target color in the preset target theme color library, and selecting the RGB value corresponding to the target color with the smallest color distance as the target RGB value. Through this mapping process, any primary color extracted from the screen is downgraded and matched to the closest color that the LED can actually display.
[0054] When the running light uses RGB three-channel LEDs, each LED contains three independent light-emitting chips for red, green, and blue. Any color can be created by adjusting the brightness ratio of these three chips. Since the LEDs themselves support full-color display, the source RGB values can be directly used as driving commands without the need for HSL color matching mapping steps. The source RGB values can be sent directly to the running light driver circuit.
[0055] Step 204: Send the target RGB value to the marquee driver circuit to drive the marquee to update its color.
[0056] Specifically, the target RGB value is sent to the running light driver circuit through a communication interface (such as I2C, SPI, UART, Bluetooth, WiFi, etc.) to drive the running light LED beads (such as LEDs) to change color.
[0057] Other optional examples include: when sending the target RGB value to the marquee driver circuit, using a low-pass filter to smooth the target RGB value, so that the marquee color gradually changes from the current color to the target RGB value.
[0058] Furthermore, when sending the target RGB value to the LED light driver circuit, a low-pass filter is used to smooth the target RGB value. This means that each calculated target RGB value does not directly overwrite the current LED color, but rather gradually approximates it according to a certain ratio. This prevents the LED light color from abruptly changing when the screen image switches, instead allowing for a gradual transition from the current color to the new target color. This smooth transition process is gentle and natural, matching the human eye's adaptation rhythm to changes in light, effectively avoiding the glare caused by sudden changes in light.
[0059] The method for controlling the color of a running light based on screen color provided in this invention periodically acquires screen color data and extracts the dominant hue. It then converts RGB to the HSL color space for weighted color distance matching and selects the target color with the smallest color distance to drive the running light. This solves the problem of human eye perception deviation when directly driving the light based on the average RGB value, making the light color more closely match the actual human eye's perception of the screen image. At the same time, through a mapping mechanism of preset target theme color library + minimum color distance selection, it realizes the mapping of any screen dominant color to a limited target color library, and has good hardware compatibility.
[0060] Combining the aforementioned implementation methods, Figure 4 This is a flowchart illustrating another method for controlling the color of a marquee based on screen color provided by the present invention, now combined with... Figure 4 The present invention will be described in detail below: I. Initialization Phase Initialize the serial port and configure the serial port parameters baud rate (preferably 115200 / 8N1) to establish a physical communication link between the main control chip and the running light driver circuit; Check if the serial port is successfully opened. If successful, enter the main loop; if it fails, perform error handling or retry until the communication link is successfully established.
[0061] II. Screen Color Data Acquisition Stage Upon entering the main loop, the system first captures the current screen content and obtains a Bitmap image. The specific implementation of this step includes, but is not limited to: Capture frame data of the current screen using the operating system's graphics API (such as the Android MediaProjection API or the Windows DXGI interface); Pixel data in the display frame buffer can be read directly through the memory mapping interface (at this time, the system maps the original pixel data in the video memory to the application address space to achieve zero-copy access).
[0062] III. Primary Color Extraction Stage After acquiring the screen image data (Bitmap), the image data is analyzed and processed. For example... Figure 4 As shown, the method used in this embodiment is as follows: Divide the screen into 15 equal parts horizontally and calculate the average RGB value for each part.
[0063] This step divides the screen into 15 evenly spaced sections horizontally, and calculates the RGB average value of all pixels within each section. Each section corresponds to a segment of the marquee. The color data of the leftmost section controls the color of the corresponding LED on the left side of the marquee, the rightmost section controls the LED on the right side, and so on.
[0064] It should be noted that, Figure 4 The horizontal division into 15 equal parts shown is only one specific example. The specific number of divisions and the direction of partitioning (horizontal division, vertical division, or matrix division) can be flexibly configured according to the physical layout of the marquee and the number of LEDs. In other embodiments, the system can also use the full-screen averaging method to extract the single main color of the entire screen, or use the color histogram statistical method to identify the main color of the active window, etc.
[0065] Figure 5 This invention provides a schematic diagram of a specific process for extracting source RGB values by partitioning, as shown below. Figure 5As shown, the input is a screen Bitmap image with a width of W and a height of H. It is divided into 15 partitions in the horizontal direction. The partition width partWidth = floor(W / 15) is calculated. An array avgRGBA
[45] of length 45 is initialized to store the RGB average values of the 15 partitions (each partition occupies 3 consecutive elements, corresponding to R, G, and B respectively).
[0066] Then, iterate through i from 0 to 14, processing each partition sequentially. For the i-th partition, its starting X-coordinate is startX = i * partWidth, and its ending X-coordinate is endX = startX + partWidth. If the current partition is the last partition (i.e., i == 14), the ending X-coordinate is directly taken as the screen width W, i.e., endX = W, to cover any possible pixel margins. After determining the horizontal range of the partition, iterate through all pixels within that partition (x from startX to endX-1, y from 0 to H-1), accumulating the R, G, and B channel values of each pixel to sumR, sumG, and sumB respectively, and counting the total number of pixels (pixelCount). After the traversal is complete, calculate the RGB average values of the partition: avgR = sumR / pixelCount, avgG = sumG / pixelCount, avgB = sumB / pixelCount, and store the three average values sequentially into avgRGBA[i*3] to avgRGB[i*3+2].
[0067] After all partitions have been processed, the avgRGBA
[45] array is output, which contains 15 sets of RGB values, corresponding to the average RGB values of the 15 partitions of the screen.
[0068] IV. Color Mapping Stage exist Figure 4 In the illustrated process, after the 15 sets of RGB average values are calculated, the system packages them into a fixed frame format (52 bytes) and sends it via RS232. Before transmission, a crucial color mapping step must be performed: First, the source RGB values extracted in step three are converted to the HSL color space to obtain source HSL values (including hue component H1, saturation component S1, and brightness component L1); at the same time, each target color in the preset target theme color library is also converted from RGB to HSL space to obtain the corresponding target HSL values (including hue component H2, saturation component S2, and brightness component L2).
[0069] Secondly, the weighted color distance between the source HSL value and each target HSL value is calculated. The hue component difference ΔH is calculated using the circumferential distance to avoid misjudging colors at the beginning and end of the color wheel as having too large a difference. The weighting coefficients are preset to hue 1.0, saturation 0.5, and brightness 0.3 to conform to the biological visual characteristics of the human eye, which is most sensitive to hue differences and relatively least sensitive to brightness differences.
[0070] Finally, the RGB value corresponding to the target color with the smallest weighted color distance is selected as the target RGB value.
[0071] If the LED display uses RGB three-channel LEDs, then the above mapping process is unnecessary; the extracted source RGB values can be directly output as the target RGB values.
[0072] V. Data Packaging and Transmission Stage After color mapping is complete, the system packages and sends the target RGB values according to a predefined protocol: Format encapsulation: Combine 15 groups of RGB data (3 bytes per group, 45 bytes in total) with control bytes such as frame header, frame trailer, and check bit into a fixed-length data frame (52 bytes in this embodiment).
[0073] Serial port transmission: A 52-byte data frame is sent to the LED light driver circuit via the RS232 serial port. After receiving the data, the LED light driver circuit parses the RGB values of each group and drives the corresponding LED beads to update their colors.
[0074] Waiting for the next frame: After sending, wait for the preset frame interval time (usually 50ms to 100ms, which corresponds to a refresh rate of 10 frames / second to 20 frames / second), and then return to the beginning of the main loop to repeat the complete process of "getting screen data → extracting the main color → color mapping → sending".
[0075] This invention provides a method for controlling the color of a marquee light based on screen color. By converting the screen's primary color from RGB to HSL space and assigning differentiated weights to hue, saturation, and brightness based on human visual characteristics (hue 1.0, saturation 0.5, brightness 0.3), the color output of the marquee light more closely matches the actual perception of the screen image by the human eye, effectively solving the problem of primary color deviation when directly driving the light based on the RGB average value. Simultaneously, by pre-setting a target theme color library and selecting the minimum weighted color distance, it is compatible with different hardware configurations ranging from monochrome LEDs to full-color LEDs.
[0076] This invention also provides multiple parallel acquisition methods, including system API frame capture, memory-mapped direct reading, window attribute reading, display interface auxiliary channel, and game engine rendering interface, covering deployments across all platforms from smart TVs and PCs to embedded systems. The optimal solution can be flexibly selected based on hardware configuration and application scenario. Specifically, memory-mapped direct reading, combined with vertical synchronization signals and hardware compression, ensures stable operation in resource-constrained embedded systems without affecting the smoothness of the display device itself. The adaptive cycle design reduces the sampling rate to save resources when the image is static and increases the sampling rate to ensure response speed during high-dynamic scenes.
[0077] This invention also eliminates interference from non-ambient colors such as black borders in subtitles on the main color statistics by discarding abnormal pixels such as pure black and pure white. It smooths the target RGB values using a low-pass filter, allowing the light to transition gradually from the current color to the target color, avoiding abrupt flickering during screen transitions and resulting in a smooth and natural process. Overall, this invention achieves real-time, smooth, and human-eye-friendly light and shadow linkage between screen colors and physical light strips, significantly enhancing the immersive experience in movie and game scenarios. Simultaneously, it reduces the brightness contrast between the screen and the surrounding environment to some extent, providing eye protection.
[0078] Secondly, this invention provides an example of a device for controlling the color of a scrolling marquee based on screen color. Figure 6 This is a schematic diagram of a device for controlling the color of a running light based on screen color, as provided by the present invention. Figure 6 As shown, the device includes: The color acquisition module 601 is used to periodically acquire the color data corresponding to the content currently displayed on the screen; The primary color extraction module 602 is used to extract source RGB values based on the color data, wherein the source RGB values represent the primary color of the content currently displayed on the screen. The color mapping module 603 is used to convert the source RGB value to the HSL color space to obtain the source HSL value, calculate the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library, and select the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value. The control execution module 604 is used to send the target RGB value to the marquee driver circuit to drive the marquee to update its color.
[0079] In other alternative embodiments, the color mapping module 603 is specifically used for: The weighted color distance between the source HSL value and each target HSL value is calculated based on the weighted Euclidean distance; wherein, the hue component difference is calculated using the circumferential distance, and the weighting coefficient of the hue component difference is greater than the weighting coefficient of the saturation component difference and the weighting coefficient of the luminance component difference.
[0080] In other alternative embodiments, the color acquisition module 601 is specifically used in any of the following ways: Capture the corresponding frame data using the graphical application programming interface provided by the operating system; Pixel data in the display frame buffer can be read directly through the memory mapping interface; Read the title bar background color of the active window in the foreground or the screen background color of the player window; The auxiliary channel of the display interface receives the main color statistics returned by the display driver chip; The main light source color parameters are read from the rendering buffer through the rendering interface provided by the game engine.
[0081] In other alternative implementations, when directly reading pixel data from the display frame buffer via a memory-mapped interface, at least one of the following is also included: Synchronize the vertical synchronization signal to obtain pixel data for the entire frame; When the processor load exceeds a preset threshold, the acquisition frequency is reduced, and the acquired pixel data is hardware compressed.
[0082] In other alternative implementations, the color acquisition module is specifically used for: The color data is acquired at a preset fixed period or an adaptive period; wherein, the adaptive period refers to dynamically adjusting the acquisition frequency according to the speed of change of the current screen display content.
[0083] In other optional implementations, when the color data is frame data or pixel data, the primary color extraction module 602 is specifically used in any of the following ways: The source RGB value is obtained by downsampling all pixels of the currently displayed content and calculating the RGB average value of all sampled points. The entire area or edge area of the currently displayed content on the screen is divided into partitions, and the average RGB value of the pixels in each partition is calculated to obtain the source RGB value. Each partition corresponds to a segment of the marquee. Identify the active window in the foreground, and perform color histogram statistics based on the pixels of the active window to obtain the source RGB value.
[0084] In other optional embodiments, the primary color extraction module 602 is further configured to: Before extracting the source RGB values based on the color data, abnormal pixels are discarded, including at least one of pure black pixels and pure white pixels; The control execution module 604 is further configured to use a low-pass filter to smooth the target RGB value when sending the target RGB value to the marquee drive circuit, so that the marquee color gradually changes from the current color to the target RGB value.
[0085] In other optional implementations, when the marquee is a monochrome or limited color LED, the steps of converting the source RGB value to the HSL color space to obtain the source HSL value, calculating the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library, and selecting the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value are performed. When the running light is an RGB three-channel LED, the source RGB value is directly sent to the running light driver circuit.
[0086] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and corresponding beneficial effects of the device for controlling the color of the marquee based on screen color described above can be referred to the corresponding process in the aforementioned method example, and will not be repeated here.
[0087] The device for controlling the color of a running light based on screen color provided by this invention periodically acquires screen color data and extracts the main color tone. It then converts RGB to the HSL color space for weighted color distance matching and selects the target color with the smallest color distance to drive the running light. This solves the problem of human eye perception deviation when directly driving the light based on the average RGB value, making the light color more closely match the actual human eye's perception of the screen image. At the same time, through a mapping mechanism of preset target theme color library + minimum color distance selection, it realizes the mapping of any screen main color to a limited target color library, and has good hardware compatibility.
[0088] Thirdly, the present invention provides a display device, such as... Figure 1 As shown, the present invention provides a display device, comprising: Display screen; A marquee light is mounted on at least one bezel of the display screen; The device described above that controls the color of the marquee based on screen color.
[0089] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process and corresponding beneficial effects of the display device described above can be referred to the corresponding process in the aforementioned method examples, and will not be repeated here.
[0090] Fourthly, an example of the present invention provides a storage medium for storing computer software instructions used by a display device, which includes a program for performing the screen color-based marquee color control method described in the first aspect.
[0091] Those skilled in the art will understand that all or part of the steps of the above-described method examples can be implemented by hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method examples; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0092] Finally, it should be noted that the above examples are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing examples, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing examples, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the examples of the present invention.
Claims
1. A method for controlling the color of a marquee light based on screen color, characterized in that, include: Periodically retrieve the color data corresponding to the content currently displayed on the screen; The source RGB value is extracted from the color data, and the source RGB value represents the main color tone of the content currently displayed on the screen. The source RGB value is converted to the HSL color space to obtain the source HSL value. The weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library is calculated. The RGB value corresponding to the target color with the smallest weighted color distance is selected as the target RGB value. The target RGB value is sent to the marquee driver circuit to drive the marquee to update its color.
2. The method according to claim 1, characterized in that, The step of calculating the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library includes: The weighted color distance between the source HSL value and each target HSL value is calculated based on the weighted Euclidean distance; wherein, the hue component difference is calculated using the circumferential distance, and the weighting coefficient of the hue component difference is greater than the weighting coefficient of the saturation component difference and the weighting coefficient of the luminance component difference.
3. The method according to claim 1 or 2, characterized in that, The periodic acquisition of color data corresponding to the currently displayed screen content includes any of the following methods: Capture the corresponding frame data using the graphical application programming interface provided by the operating system; Pixel data in the display frame buffer can be read directly through the memory mapping interface; Read the title bar background color of the active window in the foreground or the screen background color of the player window; The auxiliary channel of the display interface receives the main color statistics data returned by the display driver chip; The main light source color parameters are read from the rendering buffer through the rendering interface provided by the game engine.
4. The method according to claim 3, characterized in that, When directly reading pixel data from the display frame buffer via a memory-mapped interface, at least one of the following is also included: Synchronize the vertical synchronization signal to obtain pixel data for the entire frame; When the processor load exceeds a preset threshold, the acquisition frequency is reduced, and the acquired pixel data is hardware compressed.
5. The method according to claim 1 or 2, characterized in that, The periodic acquisition of color data corresponding to the currently displayed content includes: The color data is acquired at a preset fixed period or an adaptive period; wherein, the adaptive period refers to dynamically adjusting the acquisition frequency according to the speed of change of the current screen display content.
6. The method according to claim 3, characterized in that, When the color data is frame data or pixel data, the extraction of source RGB values based on the color data includes any of the following methods: The source RGB value is obtained by downsampling all pixels of the currently displayed content and calculating the RGB average value of all sampled points. The entire area or edge area of the currently displayed content on the screen is divided into partitions, and the average RGB value of the pixels in each partition is calculated to obtain the source RGB value. Each partition corresponds to a segment of the marquee. Identify the active window in the foreground, and perform color histogram statistics based on the pixels of the active window to obtain the source RGB value.
7. The method according to claim 6, characterized in that, It also includes at least one of the following: Before extracting the source RGB values based on the color data, abnormal pixels are discarded, including at least one of pure black pixels and pure white pixels; When the target RGB value is sent to the marquee driver circuit, a low-pass filter is used to smooth the target RGB value so that the marquee color gradually changes from the current color to the target RGB value.
8. The method according to claim 1 or 2, characterized in that, When the marquee is a monochrome or limited color LED, the steps of converting the source RGB value to the HSL color space to obtain the source HSL value, calculating the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library, and selecting the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value are executed. When the running light is an RGB three-channel LED, the source RGB value is directly sent to the running light driver circuit.
9. A device for controlling the color of a marquee light based on screen color, characterized in that, include: The color acquisition module is used to periodically acquire the color data corresponding to the content currently displayed on the screen; The primary color extraction module is used to extract source RGB values based on the color data, where the source RGB values represent the primary color of the content currently displayed on the screen. The color mapping module is used to convert the source RGB value to the HSL color space to obtain the source HSL value, calculate the weighted color distance between the source HSL value and the target HSL value corresponding to each target color in the preset target theme color library, and select the RGB value corresponding to the target color with the smallest weighted color distance as the target RGB value. The control execution module is used to send the target RGB value to the marquee driver circuit to drive the marquee to update its color.
10. A display device, characterized in that, include: Display screen; A scrolling marquee is mounted on at least one bezel of the display screen; The device for controlling the color of a marquee based on screen color as described in claim 9.
