An Adaptive Color Filtering Method under a High-Contrast Background

By segmenting the image into sub-pictures and performing equalization processing and adaptive color filtering, the instability problem of image processing under high contrast background is solved, and the reliability and efficiency of image processing are improved.

CN119941595BActive Publication Date: 2025-07-08HANGZHOU DIANZI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510425354.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-07-08
Estimated Expiration
2045-04-07

AI Technical Summary

Technical Problem

In the image processing under high contrast background, the fixed threshold algorithm is susceptible to factors such as the light source state and local shadows, resulting in poor processing effects, affecting business efficiency and potentially pose a safety hazard.

Method used

The image is divided into multiple equal-size sub-graphs, the HSV value is adjusted through equalization processing and adaptive threshold algorithm, the sampling offset vector is calculated and the RGB value is adjusted, and the color filter is used using the adaptive scale coefficient, and finally the binary graph is obtained.

Benefits of technology

It effectively reduces the interference of overexposure and shadow factors on image processing results, improves the flexibility of threshold adjustment and the reliability of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119941595B_ABST
    Figure CN119941595B_ABST
Patent Text Reader

Abstract

The present invention discloses an adaptive color filtering method under a high-contrast background. The method includes: dividing a complete picture into several sub-pictures of equal size, selecting one of the sub-pictures as an equalization sample, calculating the average HSV value after defining a sampling space, and calculating the sampling offset vectors of other sub-pictures based on this value, and using these vectors to perform equalization processing on the sub-pictures; calculating the mean color difference of the equalized image, adjusting the color filtering ratio coefficient so that the target pixel points all fall within the filtering retention interval, and filling the default color at other positions to obtain the color filtering result of the sub-picture; finally, splicing all the filtered sub-pictures to obtain the color filtering result of the original picture. The present invention effectively reduces the interference of factors such as overexposure and shadows on the image processing result through equalization operations. At the same time, through the transfer and use of the ratio coefficient, the flexibility of threshold adjustment and the reliability and processing effect of the image processing result are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and particularly to an adaptive color filtering method under a high-contrast background. Background Art

[0002] Color filtering is one of the commonly used techniques in the field of image processing. Existing methods usually process the entire image by setting a fixed threshold, or divide the picture into several intervals, set processing thresholds for each interval, and finally merge the processing results. However, the fixed-threshold algorithm is easily affected by factors such as the light source state and local shadows, resulting in a significant reduction in the processing effect, which in turn affects the subsequent image processing process, reduces the overall business efficiency, and may even cause certain potential safety hazards. Therefore, in view of the defects of the existing technology, it is necessary to propose a technical solution to solve the technical problems existing in the existing technology. Summary of the Invention

[0003] The purpose of the present invention is to provide an adaptive color filtering method under a high-contrast background. After image segmentation and equalization processing of small images based on the sample space, color filtering of the image is performed according to the color difference algorithm of the adaptive threshold, and an available binary image is obtained and passed to the subsequent processing process to solve the problems raised in the above background art.

[0004] To solve the above technical problems, the present invention provides the following technical solution: An adaptive color filtering method under a high-contrast background, comprising the following steps:

[0005] S100: Segment a complete image with a high-contrast background into multiple sub-images of equal size;

[0006] Preferably, for image segmentation, a complete image with a high-contrast background needs to be divided into multiple sub-images of equal size. When the product box image contains 72 small boxes, the image can be approximately divided into 72 sub-images according to the size of the small boxes, and the size of each sub-image is slightly enlarged to ensure that each small box can completely fall within the sub-image.

[0007] S200: Adjust the HSV values of the pixel points in the sub-images to the standard HSV adjacent intervals defined according to the equalization samples, and perform image equalization processing;

[0008] Preferably, the image equalization processing specifically includes the following steps:

[0009] S201: Calculate the standard HSV: Define a sampling space with a size of from an equalization sample with a width of and a height of , and calculate the HSV values of each pixel point in the sampling space;

[0010] S202: Pixel point equalization: Based on the sampling space, calculate the HSV mean values of all sub - graphs within the sampling space, and calculate the difference between the sampled HSV values of each sub - graph and the standard HSV to obtain the sampled offset vector of the sub - graph , and adjust the HSV values of the sub - graph pixel points according to the sampled offset vector;

[0011] Preferably, calculating the HSV value of each pixel point in the sampling space further includes: calculating the standard HSV based on the HSV of all pixel points in the sampling space:

[0012]

[0013] wherein, represents the standard hue value, represents the standard saturation value, represents the standard lightness value, represents the position coordinates of the corresponding pixel, represents the number of pixel points within the sample space.

[0014] Preferably, adjusting the HSV values of the sub - graph pixel points according to the sampled offset vector includes: for a given tolerance threshold , when the condition is not satisfied, append the color feature offsets that do not meet the requirements to all pixel points, that is, when , then for all pixel points in the sub - graph, its saturation will all be updated to: .

[0015] S203: HSV to RGB conversion: For the HSV values after pixel point equalization, convert them back to RGB values and fill them in the image.

[0016] Preferably, the HSV to RGB conversion specifically includes: when the saturation is 0, the RGB values are all the same as the brightness V, otherwise take the fractional part of , and calculate through the following formula:

[0017]

[0018] is the calculated intermediate value, and calculate the RGB value of this pixel point based on the integer part of :

[0019]

[0020] And draw the new RGB channel values onto the image for the next step of processing.

[0021] S300: Perform adaptive color filtering based on the average color difference of the image, that is, select the color filtering ratio coefficient and generalize it to all sub-images, and process to obtain the color filtering results of all sub-images;

[0022] Preferably, performing the adaptive color filtering specifically includes the following steps:

[0023] S301: Calculate the average color difference: Calculate the average value of the color difference vectors of all pixel points that meet the preset conditions, and use this value as the average color difference of the image;

[0024] Preferably, calculating the average color difference specifically includes: For any pixel point in the image, when its RGB values all fall within the pre-set RGB processing interval then this pixel point participates in the calculation of the average color difference, and its color difference vector can be expressed as: , and the average value of the color difference vectors of all eligible pixel points is the average color difference of this image.

[0025] S302: Obtain the adaptive ratio coefficient: By adjusting the adaptive ratio coefficient, change the pixel retention interval, and select the optimal coefficient to make as many target points as possible fall within the retention interval;

[0026] Preferably, obtaining the adaptive ratio coefficient specifically includes: For the pixel points to be retained, calculate their color difference vectors , and adjust the adaptive ratio coefficient interval such that for the average color difference vector , the following three constraint conditions are all satisfied:

[0027]

[0028] And for the pixel points to be filtered out, their color difference vectors satisfy one of the following constraint conditions:

[0029]

[0030] S303: Color filtering: Retain all pixel points that meet the constraint conditions, and fill the other pixel points with the default color to obtain the color filtering results of all sub-images.

[0031] S400: Sequentially splice all sub-images to obtain the binary image after color filtering processing of the original image.

[0032] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: The present invention divides a complete picture into several sub - pictures of equal size, selects one of the sub - pictures as an equilibrium sample, calculates the average HSV value after defining the sampling space, calculates the sampling offset vectors of other sub - pictures based on this value, uses these vectors to perform equalization processing on the sub - pictures, calculates the color difference mean value of the equalized image, adjusts the color filtering ratio coefficient so that the target pixel points all fall within the filtering and retention interval, fills the other positions with the default color to obtain the color filtering result of the sub - pictures; finally, splices all the filtered sub - pictures to obtain the color filtering result of the original picture. Compared with the prior art, the present invention effectively reduces the interference of factors such as over - exposure and shadows on the image processing result through equalization operations, and at the same time improves the flexibility of threshold adjustment by migrating and using the ratio coefficient, which can improve the reliability of the image processing result. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the present invention, and do not constitute a limitation to the present invention. In the accompanying drawings:

[0034] Figure 1 is a flow chart of an adaptive color filtering method under a high - contrast background provided by an embodiment of the present invention;

[0035] Figure 2 is a flow chart of an image equalization method provided by an embodiment of the present invention;

[0036] Figure 3 is a flow chart of an adaptive color filtering method provided by an embodiment of the present invention;

[0037] Figure 4 is the product box grid image targeted by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0039] The embodiments of the present invention are combined with Figures 1 to 4 , and provide the following technical solutions: An adaptive color filtering method under a high - contrast background, including the following steps:

[0040] S100: Segment a complete image with a high - contrast background into multiple sub - pictures of equal size;

[0041] Exemplarily, for image segmentation, a complete image with a high-contrast background needs to be divided into multiple sub-images of equal size. For example, if the product box image in this embodiment contains 72 small boxes, the image can be approximately divided into 72 sub-images according to the size of the small boxes, and the size of each sub-image can be slightly enlarged to ensure that each small box can fall completely within the sub-image.

[0042] S200: Adjust the HSV values of the pixel points in the sub-image to the standard HSV adjacent interval defined according to the balanced sample, and perform image equalization processing;

[0043] In this embodiment, one of the multiple sub-images of equal size divided is selected as the balanced sample, and an area is delimited as the sampling space therein. The hue-saturation-brightness (HSV) values of the pixel points in the space are used as the standard HSV, and the HSV values of the pixel points in other sub-images are adjusted to the proximity interval of the standard HSV;

[0044] Exemplarily, in combination with Figure 2 shown, the specific steps for performing image equalization processing include the following:

[0045] S201: Calculate the standard HSV: From the balanced sample with a width of and a height of , delimit a sampling space with a size of , and calculate the HSV values of each pixel point in the sampling space. The calculation formula is as follows:

[0046]

[0047]

[0048]

[0049] where is the brightness of the color, is the saturation, is the hue;

[0050] Further, calculate the standard HSV based on the HSV of all pixel points in the sampling space:

[0051]

[0052] where represents the standard hue value, represents the standard saturation value, represents the standard brightness value, represents the position coordinates of the corresponding pixel, represents the number of pixel points in the sample space.

[0053] Preferably, the defined balanced sample sampling space needs to select the most representative color regions as much as possible, and reduce the proportion of abnormal pixel points such as overexposed points and shadow points. For example, for the product box image as shown in Figure 4 the sampling space selects the middle area inside the small box to avoid including the shadow area generated by the inclined illumination of the light source.

[0054] S202: Pixel point equalization: According to the sampling space defined in S201, calculate the HSV mean value of all sub-images within the sampling space, and subtract the sampled HSV value of each sub-image from the standard HSV to obtain the sampling offset vector of the sub-image , for a given tolerance threshold , when the condition is not met, append the color feature offsets that do not meet the requirements to all pixel points, that is, when , then for all pixel points in the sub-image, its saturation will be updated to: ;

[0055] Preferably, not all color feature offsets need to be used. For sub-images with large feature differences themselves, equalizing their hue (H) and saturation (S) may damage the color coordination of the sub-images themselves. For the product box image described in this embodiment, because the content of the divided sub-images has strong similarity, the three color features of hue, saturation, and brightness can be equalized.

[0056] S203: HSV to RGB conversion: For the HSV values after pixel point equalization, they need to be reconverted to RGB values and filled in the image. If the saturation is 0, the RGB values are all the same as the brightness V. Otherwise, take the fractional part , and calculate through the following formula:

[0057]

[0058] is the calculated intermediate value, and then according to integer part , obtain the RGB value of this pixel point:

[0059]

[0060] And draw the new RGB channel values onto the image for the next step of processing.

[0061] S300: Based on the average color difference of the image, perform adaptive color filtering, that is, select the color filtering ratio coefficient and generalize it to all sub-images, and process to obtain the color filtering results of all sub-images.

[0062] Exemplarily, select the equalized sub-image, calculate the color differences between every two of the RGB color channels of all its pixels and obtain the average color difference, select an appropriate ratio coefficient threshold, so that the color differences of the pixels to be retained fall between the product of the threshold and the average color difference, and use the default color to fill the pixels whose color differences do not belong to this interval to obtain the color filtering result image, and generalize the ratio coefficient used in the threshold sample to all sub-images, and process to obtain the filtering results of all sub-images.

[0063] Further, as shown in Figure 3 the adaptive color filtering specifically includes the following steps:

[0064] S301: Calculate the average color difference: Calculate the average value of the color difference vectors of all pixels that meet the preset conditions, and use this value as the average color difference of the image;

[0065] Exemplarily, for any pixel in the image, if its RGB values all fall within the pre-set RGB processing range , then this pixel participates in the calculation of the average color difference, and its color difference vector can be expressed as: , and the average value of the color difference vectors of all pixels that meet the conditions is the average color difference of this image.

[0066] S302: Obtain the adaptive ratio coefficient: By adjusting the adaptive ratio coefficient, change the pixel retention interval, and select the optimal coefficient to make as many target points as possible fall within the retention interval;

[0067] Exemplarily, for the pixels to be retained, calculate its color difference vector , adjust the adaptive ratio coefficient range so that for the average color difference vector , the following three constraint conditions are all satisfied:

[0068]

[0069] And for the pixels to be filtered out, its color difference vector satisfies one of the following constraint conditions:

[0070]

[0071] S303: Color filtering: Use the ratio coefficient range set in S302 Apply it to all sub - graphs, retain all pixel points that meet the constraint conditions, and fill the other pixel points with the default color, then the color filtering results of all sub - graphs can be obtained.

[0072] S400: Sequentially splice all sub - graphs to obtain a binary image after color filtering of the original image;

[0073] Exemplarily, delete the expanded parts of all sub - graphs in S100, and sequentially splice all sub - graphs to obtain a binary image after color filtering of the original image.

[0074] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non - exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device.

[0075] Finally, it should be noted that the above are only preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. An adaptive color filtering method under a high-contrast background, characterized in that: It includes the following steps: S100: Segment the complete image with a high-contrast background into multiple sub-images of equal size; S200: Adjust the HSV values of the pixel points in the sub-images to the standard HSV adjacent intervals defined according to the balanced samples for image equalization processing; S300: Perform adaptive color filtering based on the average color difference of the image, that is, select the color filtering ratio coefficient and generalize it to all sub-images to obtain the color filtering results of all sub-images; The specific steps for performing adaptive color filtering include the following: S301: Calculate the average color difference: Calculate the average value of the color difference vectors of all pixel points that meet the preset conditions and use this value as the average color difference of the image; The specific calculation of the average color difference includes: for any pixel point in the image, when its RGB values all fall within a pre-set RGB processing range then this pixel point participates in the calculation of the average color difference, and its color difference vector can be expressed as: , and the average value of the color difference vectors of all qualified pixel points is the average color difference of this image; S302: Obtain the adaptive ratio coefficient: Change the pixel point retention interval by adjusting the adaptive ratio coefficient, and select the optimal coefficient to make as many target points fall into the retention interval as possible; The specific process of obtaining the adaptive proportionality coefficient includes: for the pixels to be retained, calculating their color difference vectors , and adjusting the interval of the adaptive proportionality coefficient such that for the average color difference vector , the following three constraint conditions are all satisfied: ; And for the pixel points that need to be filtered out, their color difference vectors satisfy one of the following constraint conditions: ; S303: Color filtering: Keep all pixel points that meet the constraint conditions, and fill the other pixel points with the default color to obtain the color filtering results of all sub-images; S400: Sequentially splice all sub-images to obtain the binary image after color filtering processing of the original image.

2. The adaptive color filtering method under a high-contrast background according to claim 1, wherein: The specific steps for performing image equalization processing include the following: S201: Calculate the standard HSV: From the equalized samples with a width of and a height of , delimit a sampling space with a size of , and calculate the HSV value of each pixel point in the sampling space; S202: Pixel point equalization: According to the sampling space, calculate the HSV mean values of all subgraphs within the sampling space, and subtract the sampled HSV values of each subgraph from the standard HSV to obtain the sampling offset vector of the subgraph , and adjust the HSV values of the subgraph pixel points according to the sampling offset vector; S203: HSV to RGB conversion: For the HSV values of the pixel points after equalization, convert them back to RGB values and fill them in the image.

3. The adaptive color filtering method in a high-contrast background according to claim 2, wherein: The calculation formula for calculating the HSV value of each pixel point in the sampling space is as follows: ; ; ; Among them, is the lightness of the color, is the saturation, is the hue.

4. The adaptive color filtering method in a high-contrast background according to claim 3, characterized in that: The calculation of the HSV value of each pixel point in the sampling space also includes: calculating the standard HSV based on the HSV of all pixel points in the sampling space; ; Among them, represents the standard hue value, represents the standard saturation value, represents the standard lightness value, represents the position coordinates of the corresponding pixel, represents the number of pixel points in the sample space.

5. The adaptive color filtering method under a high-contrast background according to claim 2, characterized in that: Adjusting the HSV values of sub-pixels according to the sampling offset vector includes: for a given tolerance threshold , when the condition is not satisfied, append the color feature offsets that do not meet the requirements to all pixel points, that is, when , then for all pixel points in the sub-image, their saturation will all be updated to: .

6. The adaptive color filtering method under a high-contrast background according to claim 5, wherein: The specific HSV-to-RGB conversion includes: when the saturation is 0, the RGB values are all the same as the brightness V; otherwise, take the fractional part , and calculate through the following formula: ; For the calculated intermediate value, based on the integer part of calculate the RGB value of this pixel point: ; And draw the new RGB channel values onto the image for the next step of processing.

Citation Information

Patent Citations

  • Bandwidth adaption rule for adaptive noise filter for inverse filtering with improved speed

    GB0212778D0

  • Image processing device, image processing method, and image processing program

    WO2006106750A1