A video lamp strip color identification method and system based on weighted HSV space analysis

By performing zonal analysis and dynamic brightness threshold adjustment on the light strip image, combined with inter-frame stabilization control, the problem of unstable main color extraction in dynamic video streams of video light strip systems was solved, achieving smooth output and a consistent lighting atmosphere, thus improving the user experience.

CN122244183APending Publication Date: 2026-06-19TIANJIN HUAJUWULIAN TECHNOLOGY LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TIANJIN HUAJUWULIAN TECHNOLOGY LTD
Filing Date
2026-04-08
Publication Date
2026-06-19

Smart Images

  • Figure CN122244183A_ABST
    Figure CN122244183A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for color recognition of video LED strips based on weighted HSV color space analysis, belonging to the field of image data processing technology. The method includes the following steps: acquiring an image of the LED strip and dividing it into multiple sub-region image blocks; converting the color value of each pixel from the RGB color space to the HSV color space; adaptively adjusting the dynamic brightness threshold; acquiring valid samples; calculating the saturation and brightness weights for the pixels of the valid samples, and constructing a weighted hue histogram based on the accumulated values ​​of the saturation and brightness weights to determine the candidate primary color of the currently selected region; calculating the comprehensive difference value; if the comprehensive difference value is greater than a preset tolerance threshold, the candidate primary color of the currently selected region is used for output; if the comprehensive difference value is less than or equal to the preset tolerance threshold, the candidate primary color of the previously selected region is maintained for output. This invention achieves accurate extraction and smooth output of the primary color of the region corresponding to the LED strip beads.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image data processing technology, and in particular to a method and system for color recognition of video light strips based on weighted HSV spatial analysis. Background Technology

[0002] With the development of display technology, creating an immersive viewing experience has become a trend. Video light strip systems, which analyze screen content and control the color of surrounding lights, are a key technology for achieving this experience. The core challenge lies in how to extract the dominant color tone representing the current scene's atmosphere from a dynamic and complex video stream in real time and stably. Currently, a common approach is to calculate the average or mode of the color of all pixels within a region as the output. Another improved approach is to set a fixed brightness threshold, filtering out excessively dark pixels before averaging. However, these approaches have significant shortcomings: fixed averaging algorithms cannot distinguish the visual importance of pixels; fixed brightness thresholds are poorly adaptable to changes in overall screen brightness, easily leading to abrupt output changes, and lack smoothing of the output sequence, resulting in unpleasant flickering or jitter. Summary of the Invention

[0003] The technical problem to be solved by the present invention is to provide a video light strip color recognition method and system based on weighted HSV spatial analysis. By performing partition analysis on the target area image of the light strip, adaptively adjusting the dynamic brightness threshold, and controlling the inter-frame stability, the method achieves accurate extraction and smooth output of the main color of the corresponding area of ​​the light strip LED beads.

[0004] This invention is achieved through the following technical solution: A video light strip color recognition method based on weighted HSV spatial analysis includes the following steps: S1: Obtain the image of the light strip and divide the target area image of the light strip into the same number of sub-region image blocks according to the physical layout number of the LED beads in the light strip; S2: Traverse each pixel in the current sub-region image block, convert the color value of each pixel from the RGB color space to the HSV color space, and obtain the hue component, saturation component and lightness component of each pixel. S3: Set a dynamic brightness threshold based on the overall brightness of the image, calculate the average brightness of each frame, and compare the average brightness of the current frame with the average brightness of the previous frame. If the average brightness of the current frame is not equal to the average brightness of the previous frame, the dynamic brightness threshold is adaptively adjusted. S4: Compare the pixel brightness of the current frame image with the adjusted dynamic brightness threshold. If the pixel brightness of the current frame image is greater than the adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be a valid sample. If the pixel brightness of the current frame image is less than or equal to the adaptively adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be an invalid sample. S5: Calculate the saturation and brightness weights for the pixels of the valid samples, and construct a weighted hue histogram based on the cumulative value of the saturation and brightness weights. Select the hue component with the highest cumulative value of saturation and brightness weights in the weighted hue histogram as the candidate primary color of the current selected area. Combine the candidate primary color of the current selected area with the average or median of the saturation and brightness of all valid pixels in the current selected area to form a complete HSV color. S6: Calculate the comprehensive difference value based on the HSV color of the currently selected area, and compare the comprehensive difference value with the preset tolerance threshold. If the comprehensive difference value is greater than the preset tolerance threshold, the candidate primary color of the currently selected area is used for output. If the comprehensive difference value is less than or equal to the preset tolerance threshold, the candidate primary color of the previous selected area is maintained for output.

[0005] Furthermore, in step S2, the lightness component is calculated according to equation (1), the saturation component is calculated according to equation (2), and the hue component is calculated according to equation (3): (1); (2); (3); in: Indicates the lightness component. This represents the maximum value of the RGB components. This represents the maximum value within the range of RGB component values. Represents the saturation component. Represents the range of the RGB components. Indicates hue components, Indicates the red component. Indicates the green component. This represents the blue component.

[0006] The optimized version rounds the calculated hue, saturation, and lightness components to the nearest integer before outputting them.

[0007] In the optimized version, step S3 uses a two-dimensional lookup table method to adaptively adjust the dynamic brightness threshold based on the hue and saturation components of each pixel.

[0008] Furthermore, in step S5, the weights of saturation and brightness for the pixels of the effective samples are calculated according to equation (4): (4); in: Represents the saturation component. Indicates the lightness component. This indicates the weight of saturation and brightness.

[0009] Furthermore, in step S6, the comprehensive difference value is calculated based on the HSV color of the currently selected region according to equation (5): (5); in: This represents the overall difference value. This represents the weighting coefficient of the hue component. This represents the weighting coefficient of the saturation component. This represents the weighting coefficient for the brightness component. This indicates the difference in hue components between the currently selected area and the previously selected area. This indicates the difference in saturation components between the currently selected region and the previously selected region. This indicates the difference in brightness components between the currently selected area and the previously selected area.

[0010] In the optimized version, the preset tolerance threshold in step S6 is 100.

[0011] A video light strip color recognition system based on weighted HSV space analysis is used to execute a video light strip color recognition method based on weighted HSV space analysis as described above, which includes a light strip image acquisition module, a color space conversion module, a dynamic brightness threshold adaptive adjustment module, an effective sample establishment module, a complete HSV color formation module, and a candidate primary color output module. The LED strip image acquisition module is used to acquire LED strip images and divide the target area image of the LED strip into the same number of sub-region image blocks according to the physical layout number of LED beads in the LED strip. The color space conversion module is used to traverse each pixel in the current sub-region image block, convert the color value of each pixel from RGB color space to HSV color space, and obtain the hue component, saturation component and lightness component of each pixel. The dynamic brightness threshold adaptive adjustment module is used to calculate the average brightness of each frame image and compare the average brightness of the current frame image with the average brightness of the previous frame image. If the average brightness of the current frame image is not equal to the average brightness of the previous frame image, the dynamic brightness threshold is adaptively adjusted. The effective sample establishment module is used to compare the pixel brightness of the current frame image with the adjusted dynamic brightness threshold. If the pixel brightness of the current frame image is greater than the adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be a valid sample. The complete HSV color formation module is used to calculate the saturation and brightness weights of the pixels of the effective samples, and construct a weighted hue histogram based on the cumulative value of the saturation and brightness weights. The hue component with the highest cumulative value of saturation and brightness weights in the weighted hue histogram is selected as the candidate primary color of the current selected area. The candidate primary color of the current selected area is combined with the average or median of the saturation and brightness of all effective pixels in the current selected area to form a complete HSV color. The candidate primary color output module calculates a comprehensive difference value based on the HSV color of the currently selected area and compares the comprehensive difference value with a preset tolerance threshold. If the comprehensive difference value is greater than the preset tolerance threshold, the candidate primary color of the currently selected area is used for output. If the comprehensive difference value is less than or equal to the preset tolerance threshold, the candidate primary color of the previous selected area is maintained.

[0012] Beneficial effects of the invention: This invention filters out invalid pixels by adaptively adjusting the dynamic brightness threshold, avoiding recognition jumps at the transition between light and dark areas. Combined with adaptive saturation and brightness weights, it eliminates interference from dark areas, ensuring that the final extracted color always focuses on the most prominent and saturated area of ​​the image. This significantly improves the consistency between the lighting atmosphere and the main color of the image. Furthermore, the inter-frame stabilization strategy effectively smooths the output sequence, eliminating uncomfortable flickering and improving the user experience. It can handle various types of video content, from dark movies to bright animations, and has a wider range of applicability. Attached Figure Description

[0013] Figure 1 This is a schematic diagram of the process of this invention.

[0014] Figure 2 This is the weighted hue histogram of the present invention. Detailed Implementation

[0015] A method for color recognition of video light strips based on weighted HSV spatial analysis is illustrated in the flowchart below. Figure 1 As shown, it includes the following steps: S1: Obtain the image of the light strip and divide the target area image of the light strip into the same number of sub-region image blocks according to the physical layout number of the LED beads in the light strip; Specifically, images of the light strips can be obtained through a camera.

[0016] S2: Traverse each pixel in the current sub-region image block, convert the color value of each pixel from the RGB color space to the HSV color space, and obtain the hue component, saturation component and lightness component of each pixel. The RGB color space includes red, green, and blue components, while the HSV color space includes hue, saturation, and lightness components.

[0017] The values ​​of the red, green, and blue components in the RGB color space are preferably integers between 0 and 255.

[0018] Specifically, the lightness component can be calculated according to equation (1), the saturation component according to equation (2), and the hue component according to equation (3): (1); (2); (3); in: Indicates the lightness component. This represents the maximum value of the RGB components. This represents the maximum value within the range of RGB component values. Represents the saturation component. This represents the range of the RGB components, that is, the difference between the maximum and minimum values ​​of the RGB components. Indicates hue components, Indicates the red component. Indicates the green component. This represents the blue component.

[0019] The lightness component can be calculated according to formula (1) and normalized to the range of 0-100.

[0020] The hue component can be calculated according to equation (3), and the hue component can be segmented according to the channel where the maximum value of the RGB component is located.

[0021] When finally outputting the results, the calculated hue, saturation, and lightness components can be rounded to the nearest integer before outputting the HSV color space data.

[0022] The hue component can preferably be in the range of 0-360°, the saturation component can preferably be in the range of 0-100, and the lightness component can preferably be in the range of 0-100.

[0023] S3: Set a dynamic brightness threshold based on the overall brightness of the image, calculate the average brightness of each frame, and compare the average brightness of the current frame with the average brightness of the previous frame. If the average brightness of the current frame is not equal to the average brightness of the previous frame, the dynamic brightness threshold is adaptively adjusted. Specifically, a two-dimensional lookup table method can be used to adaptively adjust the dynamic brightness threshold. The two-dimensional lookup table is made based on the hue component and saturation component. The specific two-dimensional lookup table is shown in Table 1, but is not limited to the data shown in Table 1.

[0024] Table 1

[0025] In Table 1, the H index represents the range of hue components, and the S index is... , representing the saturation component index, can be obtained by calculate, This represents the floor function, since the saturation component ranges from 0 to 100. You can Limited to Within the range, that is It can take four values: 0, 1, 2, and 3. V threshold represents the value of the dynamic brightness threshold.

[0026] By setting a dynamic brightness threshold based on the overall brightness of the image, the algorithm can be adaptively adjusted according to changes in the overall brightness of the image, thereby improving its robustness to different brightness scenes and avoiding recognition jumps at the transition between light and dark areas.

[0027] S4: Compare the pixel brightness of the current frame image with the adjusted dynamic brightness threshold. If the pixel brightness of the current frame image is greater than the adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be a valid sample. If the pixel brightness of the current frame image is less than or equal to the adaptively adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be an invalid sample. Invalid samples are not involved in the subsequent color judgment. By adaptively adjusting the dynamic brightness threshold and combining adaptive saturation and brightness weights, invalid samples can be removed, eliminating interference from dark areas. This ensures that the final extracted color always focuses on the most striking and saturated area of ​​the image, significantly improving the consistency between the lighting atmosphere and the main color of the image.

[0028] S5: Calculate the saturation and brightness weights for the pixels of the valid samples, and construct a weighted hue histogram based on the cumulative value of the saturation and brightness weights. Select the hue component with the highest cumulative value of saturation and brightness weights in the weighted hue histogram as the candidate primary color of the current selected area. Combine the candidate primary color of the current selected area with the average or median of the saturation and brightness of all valid pixels in the current selected area to form a complete HSV color. Specifically, the weights of saturation and brightness of the effective samples can be calculated according to equation (4): (4); in: Represents the saturation component. Indicates the lightness component. This indicates the weight of saturation and brightness.

[0029] The design of saturation and brightness weights allows pixels with high saturation and high brightness to be given higher weights, thus playing a dominant role in color decision-making and ensuring that the extracted colors are closer to the visual focus of the human eye.

[0030] The specific weighted hue histogram constructed is as follows: Figure 2 As shown, by Figure 2 It can be seen that the cumulative value of saturation and brightness weights is the largest in the hue component range of 270-300°. Therefore, the 270-300° range is taken as the selection area, and the color of the candidate area is purple, so the candidate primary color is purple.

[0031] S6: Calculate the comprehensive difference value based on the HSV color of the currently selected area, and compare the comprehensive difference value with the preset tolerance threshold. If the comprehensive difference value is greater than the preset tolerance threshold, the candidate primary color of the currently selected area is used for output. If the comprehensive difference value is less than or equal to the preset tolerance threshold, the candidate primary color of the previous selected area is maintained for output.

[0032] Specifically, the comprehensive difference value can be calculated according to formula (5): (5); in: This represents the overall difference value. This represents the weighting coefficient of the hue component. This represents the weighting coefficient of the saturation component. This represents the weighting coefficient for the brightness component. This indicates the difference in hue components between the currently selected area and the previously selected area. This indicates the difference in saturation components between the currently selected region and the previously selected region. This indicates the difference in brightness components between the currently selected area and the previously selected area.

[0033] The preset tolerance threshold can preferably be 100.

[0034] The inter-frame stability processing method, which judges the output of candidate primary colors by comparing the comprehensive difference value with the preset tolerance threshold, can effectively filter out instantaneous color jumps caused by image noise, minor jitter, or rapid content switching. It achieves smooth transitions in lighting changes, eliminates uncomfortable flickering, and improves user experience. It can handle a variety of video content, from dark movies to bright animations, and has a wider range of applicability. It is particularly suitable for scenarios such as ambient lighting linkage systems, immersive display enhancement systems, and smart TV backlight synchronization systems.

[0035] A video light strip color recognition system based on weighted HSV space analysis is used to execute a video light strip color recognition method based on weighted HSV space analysis as described above, which includes a light strip image acquisition module, a color space conversion module, a dynamic brightness threshold adaptive adjustment module, an effective sample establishment module, a complete HSV color formation module, and a candidate primary color output module. The LED strip image acquisition module is used to acquire LED strip images and divide the target area image of the LED strip into the same number of sub-region image blocks according to the physical layout number of LED beads in the LED strip. The color space conversion module is used to traverse each pixel in the current sub-region image block, convert the color value of each pixel from RGB color space to HSV color space, and obtain the hue component, saturation component and lightness component of each pixel. The dynamic brightness threshold adaptive adjustment module is used to calculate the average brightness of each frame image and compare the average brightness of the current frame image with the average brightness of the previous frame image. If the average brightness of the current frame image is not equal to the average brightness of the previous frame image, the dynamic brightness threshold is adaptively adjusted. The effective sample establishment module is used to compare the pixel brightness of the current frame image with the adjusted dynamic brightness threshold. If the pixel brightness of the current frame image is greater than the adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be a valid sample. The complete HSV color formation module is used to calculate the saturation and brightness weights of the pixels of the effective samples, and construct a weighted hue histogram based on the cumulative value of the saturation and brightness weights. The hue component with the highest cumulative value of saturation and brightness weights in the weighted hue histogram is selected as the candidate primary color of the current selected area. The candidate primary color of the current selected area is combined with the average or median of the saturation and brightness of all effective pixels in the current selected area to form a complete HSV color. The candidate primary color output module calculates a comprehensive difference value based on the HSV color of the currently selected area and compares the comprehensive difference value with a preset tolerance threshold. If the comprehensive difference value is greater than the preset tolerance threshold, the candidate primary color of the currently selected area is used for output. If the comprehensive difference value is less than or equal to the preset tolerance threshold, the candidate primary color of the previous selected area is maintained.

[0036] In summary, the present invention provides a video light strip color recognition method and system based on weighted HSV spatial analysis. By performing partition analysis on the target area image of the light strip, adaptively adjusting the dynamic brightness threshold, and controlling inter-frame stability, it achieves accurate extraction and smooth output of the main color of the corresponding area of ​​the peripheral light strip beads, eliminates uncomfortable flickering, improves user experience, and can handle various types of video content from dark movies to bright animations. It has a wider range of applicability and is particularly suitable for scenarios such as ambient lighting linkage systems, immersive display enhancement systems, and smart TV backlight synchronization systems.

[0037] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A video light strip color recognition method based on weighted HSV spatial analysis, characterized in that: Includes the following steps: S1: Obtain the image of the light strip and divide the target area image of the light strip into the same number of sub-region image blocks according to the physical layout number of the LED beads in the light strip; S2: Traverse each pixel in the current sub-region image block, convert the color value of each pixel from the RGB color space to the HSV color space, and obtain the hue component, saturation component and lightness component of each pixel. S3: Set a dynamic brightness threshold based on the overall brightness of the image, calculate the average brightness of each frame, and compare the average brightness of the current frame with the average brightness of the previous frame. If the average brightness of the current frame is not equal to the average brightness of the previous frame, the dynamic brightness threshold is adaptively adjusted. S4: Compare the pixel brightness of the current frame image with the adjusted dynamic brightness threshold. If the pixel brightness of the current frame image is greater than the adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be a valid sample. If the pixel brightness of the current frame image is less than or equal to the adaptively adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be an invalid sample. S5: Calculate the saturation and brightness weights for the pixels of the valid samples, and construct a weighted hue histogram based on the cumulative value of the saturation and brightness weights. Select the hue component with the highest cumulative value of saturation and brightness weights in the weighted hue histogram as the candidate primary color of the current selected area. Combine the candidate primary color of the current selected area with the average or median of the saturation and brightness of all valid pixels in the current selected area to form a complete HSV color. S6: Calculate the comprehensive difference value based on the HSV color of the currently selected area, and compare the comprehensive difference value with the preset tolerance threshold. If the comprehensive difference value is greater than the preset tolerance threshold, the candidate primary color of the currently selected area is used for output. If the comprehensive difference value is less than or equal to the preset tolerance threshold, the candidate primary color of the previous selected area is maintained for output.

2. The video light strip color recognition method based on weighted HSV spatial analysis according to claim 1, characterized in that: In step S2, the lightness component is calculated according to equation (1), the saturation component is calculated according to equation (2), and the hue component is calculated according to equation (3): (1); (2); (3); in: Indicates the lightness component. This represents the maximum value of the RGB components. This represents the maximum value within the range of RGB component values. Represents the saturation component. Represents the range of the RGB components. Indicates hue components, Indicates the red component. Indicates the green component. This represents the blue component.

3. The video light strip color recognition method based on weighted HSV spatial analysis according to claim 2, characterized in that: The calculated hue, saturation, and lightness components are rounded to the nearest integer before being output.

4. The video light strip color recognition method based on weighted HSV spatial analysis according to claim 1, characterized in that: In step S3, a two-dimensional lookup table method is used to adaptively adjust the dynamic brightness threshold based on the hue and saturation components of each pixel.

5. The video light strip color recognition method based on weighted HSV spatial analysis according to claim 1, characterized in that: In step S5, the weights of saturation and brightness for the pixels of the valid samples are calculated according to equation (4): (4); in: Represents the saturation component. Indicates the lightness component. This indicates the weight of saturation and brightness.

6. The video light strip color recognition method based on weighted HSV spatial analysis according to claim 1, characterized in that: In step S6, the comprehensive difference value is calculated based on the HSV color of the currently selected region according to equation (5):  (5); in: This represents the overall difference value. This represents the weighting coefficient of the hue component. This represents the weighting coefficient of the saturation component. This represents the weighting coefficient for the brightness component. This indicates the difference in hue components between the currently selected area and the previously selected area. This indicates the difference in saturation components between the currently selected region and the previously selected region. This indicates the difference in brightness components between the currently selected area and the previously selected area.

7. The video light strip color recognition method based on weighted HSV spatial analysis according to claim 1, characterized in that: The preset tolerance threshold mentioned in step S6 is 100.

8. A video light strip color recognition system based on weighted HSV spatial analysis, used to execute the video light strip color recognition method based on weighted HSV spatial analysis as described in any one of claims 1 to 7, characterized in that: It includes a light strip image acquisition module, a color space conversion module, a dynamic brightness threshold adaptive adjustment module, an effective sample establishment module, a complete HSV color formation module, and a candidate primary color output module; The LED strip image acquisition module is used to acquire LED strip images and divide the target area image of the LED strip into the same number of sub-region image blocks according to the physical layout number of LED beads in the LED strip. The color space conversion module is used to traverse each pixel in the current sub-region image block, convert the color value of each pixel from RGB color space to HSV color space, and obtain the hue component, saturation component and lightness component of each pixel. The dynamic brightness threshold adaptive adjustment module is used to calculate the average brightness of each frame image and compare the average brightness of the current frame image with the average brightness of the previous frame image. If the average brightness of the current frame image is not equal to the average brightness of the previous frame image, the dynamic brightness threshold is adaptively adjusted. The effective sample establishment module is used to compare the pixel brightness of the current frame image with the adjusted dynamic brightness threshold. If the pixel brightness of the current frame image is greater than the adjusted dynamic brightness threshold, the pixel of the current frame image is determined to be a valid sample. The complete HSV color formation module is used to calculate the saturation and brightness weights of the pixels of the effective samples, and construct a weighted hue histogram based on the cumulative value of the saturation and brightness weights. The hue component with the highest cumulative value of saturation and brightness weights in the weighted hue histogram is selected as the candidate primary color of the current selected area. The candidate primary color of the current selected area is combined with the average or median of the saturation and brightness of all effective pixels in the current selected area to form a complete HSV color. The candidate primary color output module calculates a comprehensive difference value based on the HSV color of the currently selected area and compares the comprehensive difference value with a preset tolerance threshold. If the comprehensive difference value is greater than the preset tolerance threshold, the candidate primary color of the currently selected area is used for output. If the comprehensive difference value is less than or equal to the preset tolerance threshold, the candidate primary color of the previous selected area is maintained.