A water body surface oil stain detection method based on color features

CN122597263APending Publication Date: 2026-08-18GUANGDONG PROPHET BIG DATA CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202610456940.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-08
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0010]为了解决传统依靠人工目视检查水体表面油污的效率低、成本高且难以实现连续监测的问题,以及现有水质传感器虽能检测油类物质含量但无法直观反映污染分布情况的缺陷,实现对水体表面油污的实时、可靠检测,提供一种基于颜色特征的水体表面油污检测方法

Benefits of technology

[0021]The beneficial effects of this invention are as follows: By fusing multi-color space features and employing an adaptive weighting strategy, it effectively solves the problem of detecting oil pollution on water surfaces under different lighting conditions; by using morphological processing and connected component analysis techniques, it significantly improves the accuracy and robustness of detection; experimental results show that the detection accuracy of this method reaches over 94.7%, the false detection rate is less than 3.2%, the false negative rate is about 2.1%, and the average processing speed reaches 32 fps, achieving real-time and reliable detection of oil pollution on water surfaces, providing technical support for sewage management, environmental law enforcement, and monitoring of the operation of treatment facilities. Compared with traditional manual visual inspection methods, this method significantly improves detection efficiency, reduces labor costs, and enables continuous monitoring around the clock; compared with existing water quality sensors, this method can intuitively reflect the distribution of oil pollution on the water surface, providing a more accurate decision-making basis for pollution source tracing and emergency response.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure QLYQS_2
    Figure QLYQS_2
  • Figure QLYQS_3
    Figure QLYQS_3
  • Figure QLYQS_4
    Figure QLYQS_4
Patent Text Reader

Abstract

The application discloses a water surface oil stain detection method based on color features, which comprises the following steps: collecting a water body image through a camera, and obtaining a water body region and converting to multiple color spaces by using a pre-trained model; judging the illumination state by calculating the gray mean value, standard deviation and over-limit index; calculating the light intensity feature and saturation feature; calculating the color deviation according to the illumination state and adaptively fusing the deviation of each channel in the HSV, Lab and YCbCr color spaces; binarizing the color deviation and performing morphological operation to obtain an optimized classification result; extracting a suspected oil stain area through connected domain analysis, and verifying and determining the final oil stain area based on area screening and hue diversity score. The method can effectively cope with complex illumination environment, accurately detect the water surface oil stain, and improve the water environment monitoring efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of water pollution monitoring, and specifically to a method for detecting oil pollution on the surface of water bodies based on color characteristics. Background Technology

[0002] With increasing environmental awareness, water pollution monitoring and control have become a global focus. Oil pollution on water surfaces, a common form of water pollution, not only seriously affects the aquatic ecosystem but also poses potential threats to water resource utilization and human health. Therefore, timely and effective detection of oil pollution on water surfaces is of great significance for environmental protection and pollution control.

[0003] Traditional methods for detecting oil contamination on water surfaces rely primarily on manual visual inspection. Staff must periodically patrol the waterways and visually assess the presence of oil. This method is not only inefficient and labor-intensive but also susceptible to subjective biases, making continuous monitoring and rapid response difficult. While advancements in sensor technology have enabled the detection of oil content in water, these devices are typically expensive and cannot directly visualize the spatial distribution of oil contamination.

[0004] In recent years, with the rapid development of computer vision and image processing technologies, image-based pollution detection methods have gradually attracted attention. CN117455913B discloses an intelligent detection method for hydraulic oil pollution based on image features. This method analyzes the color and brightness characteristics of hydraulic oil surface images to reduce interference caused by changes in lighting and accurately identify pollutants. However, this method is mainly applicable to static hydraulic oil samples and is difficult to directly apply to complex and variable natural aquatic environments.

[0005] CN109087363B proposes a wastewater discharge detection method based on the HSV color space. This method converts video frames to the HSV color space and locates the water discharge area by calculating the cumulative difference map of the cleanliness space. This method has achieved some results in the detection of pollutants in flowing water, but it is mainly aimed at monitoring wastewater discharge at outlets, and its effectiveness in detecting floating oil on the water surface is limited.

[0006] CN115100212B introduces a method for detecting the degree of lubricating oil contamination. This method analyzes the distorted image of the object behind the lubricating oil, constructs a two-dimensional histogram, and performs pixel enhancement to detect the degree of lubricating oil contamination. However, this method is mainly applicable to lubricating oil samples with high transparency and is difficult to apply to the detection of oil contamination in natural water bodies.

[0007] CN112016552B discloses a method for identifying mixed flotation conditions based on foam color. This method extracts the target region of interest from the foam image, calculates the chromaticity, saturation, and brightness of pixels, and extracts feature vectors for condition identification. This color feature-based identification approach has some reference value for oil pollution detection on water surfaces, but its application scenarios differ significantly from those for detecting oil pollution on water surfaces.

[0008] CN121481929A proposes an image processing system and device for an intelligent water inspection robot. This system repairs reflective areas in the original image through pixel restoration and extracts water quality features through image segmentation and edge detection. While this system has some application value in water inspection, it still lacks a targeted solution for feature extraction and identification of oil stains on the water surface.

[0009] Existing technologies have the following shortcomings: First, traditional methods relying on manual visual inspection of oil stains on water surfaces are inefficient, costly, and difficult to implement continuous monitoring. Second, while existing water quality sensors can detect oil content, they cannot visually reflect the distribution of pollution. Third, existing image processing-based methods are mostly designed for specific scenarios, such as hydraulic oil, lubricating oil, or sewage discharge, lacking specific detection technologies for oil stains on natural water surfaces. Fourth, the lighting conditions on water surfaces are complex, with reflections and shadows significantly affecting detection accuracy, and existing methods struggle to effectively address these interferences. Fifth, the color characteristics of oil stains on the water surface overlap with the color characteristics of the water itself, making accurate detection difficult through simple color threshold segmentation. Therefore, there is an urgent need to develop an automatic detection method for oil stains on water surfaces that can adapt to complex lighting conditions and has high detection accuracy. Summary of the Invention

[0010] To address the problems of low efficiency, high cost, and difficulty in continuous monitoring of oil pollution on water surfaces using traditional manual visual inspection, as well as the shortcomings of existing water quality sensors that, while capable of detecting oil content, cannot intuitively reflect the distribution of pollution, this paper proposes a color-based method for detecting oil pollution on water surfaces to achieve real-time and reliable detection.

[0011] The technical solution adopted by this invention to solve its technical problem is: a method for detecting oil stains on the surface of water based on color characteristics, comprising the following steps: S1. Water body region acquisition and color space conversion: Water body image data is acquired in real time through a camera, and the water body region Ω in the image is obtained using a pre-trained water body detection model; the pixels in the water body region Ω are converted to HSV color space, Lab color space and YCbCr color space, and the coordinate values ​​of each color space are obtained. S2. Illumination status judgment: Calculate the gray mean μ, gray standard deviation σ, over-limit index over, and under-limit index of the pixels in the water body area Ω; Based on the comparison results of the gray standard deviation σ, over-limit index over, and under-limit index with the corresponding thresholds, determine whether the water body area is in a backlight state and generate a backlight state indicator. S3. Illumination Feature Calculation: Calculate the light intensity feature based on the grayscale mean μ; calculate the saturation feature based on the grayscale mean μ and the saturation component of the HSV color space; S4. Color deviation calculation: Calculate the deviation of each channel in the HSV color space, Lab color space and YCbCr color space respectively; based on the backlight status indicator, light intensity characteristics and saturation characteristics, use an adaptive weighting strategy to fuse the deviation of each color space and calculate the color deviation of each pixel. S5. Oil Stain Area Extraction and Verification: The water area is binarized based on the color deviation to obtain an initial classification result. Morphological opening operation for noise reduction and closing operation for hole filling are performed on the initial classification result to obtain an optimized classification result. Connectivity analysis is performed on the optimized classification result to extract suspected oil stain areas. The areas of suspected oil stain areas are screened to obtain the oil stain areas to be tested. The hue diversity score of the oil stain areas to be tested is calculated. The final oil stain areas are verified and determined based on the hue diversity score.

[0012] Preferably, the water body detection model in step S1 is trained using the YOLO target detection algorithm; the coordinates of each color space include: coordinates of the HSV color space (h i,j s i,j v i,j ), coordinates of the Lab color space (l i,j a i,j b i,j ), coordinates of the YCbCr color space (y i,j , cb i,j ,cr i,j ).

[0013] Preferably, the method for determining whether the water area is in a backlit state in step S2 includes: calculating the gray value of each pixel within the water area Ω. i,j; Calculate the mean gray value μ: Where n1 is the total number of pixels in the water region Ω; Calculate the grayscale standard deviation σ: When σ > ts1, over > ts2, and under > ts3 are simultaneously satisfied, the water area is determined to be in a backlighting state, and a backlighting state indicator g is set. is =1; otherwise, set the backlight status flag g. is =0; Wherein, ts1 is the first judgment threshold, with a default value of 60; ts2 is the second judgment threshold, with a default value of 0.05; and ts3 is the third judgment threshold, with a default value of 0.1.

[0014] Preferably, the calculation method for the overlimit upper bound index "over" and the overlimit lower bound index "under" includes: Calculate the overlimit upper bound exponent: ; Among them, g1 i,j Score the upper bound of the out-of-bounds condition for pixel (i,j): ; Calculate the lower bound exponent under: ; Among them g2 i,j Score the lower bound of the out-of-bounds condition for pixel (i,j): .

[0015] Preferably, in step S3: the light intensity feature g li The formula for calculating g is: li =μ; the saturation feature g st The calculation formula is: .

[0016] Preferably, in step S4, the method for calculating the deviation of each color space channel includes: HSV color space deviation calculation: Calculate H channel deviation hd i,j : ; Where hm is the weighted mean of the H channels: ; Where h hm Mean value of surface oil-free wastewater images collected historically in the H channel: Calculate the S-channel deviation sd i,j : ; Where sm is the weighted average of the S channels: ; shm Mean value of the S-channel for historically collected images of surface oil-free wastewater: Calculate the V-channel deviation vd i,j : ; Where vm is the weighted average of the V channels: ; v hm Mean value in the V channel for historically collected images of surface oil-free wastewater; Calculate HSV spatial deviation hsv i,j : ; Lab color space deviation calculation: Calculate L-channel deviation ld i,j : ; Where lm is the weighted average of the L channels: ; l hm Mean value in the L channel for historically collected images of surface oil-free wastewater; Calculate the deviation of channel a (ad) i,j : ; Where am is the weighted average of channel a: ; a hm The mean value of surface oil-free wastewater images collected historically in channel a; Calculate the deviation of channel bd i,j : ; Where bm is the weighted average of the b-channel: ; b hm Mean value of surface oil-free wastewater images collected historically in the b channel; Calculate Lab spatial deviation i,j : ; YCbCr color space deviation calculation: Calculate the Y-channel deviation yd i,j : ; Where ym is the weighted average of the Y channel: ; y hm Mean value in the Y channel of historically collected images of surface oil-free wastewater; Calculate the Cb channel deviation (cbd) i,j : ; Where cbm is the weighted average of the Cb channels: ; cb hm Mean value in the Cb channel for historically collected images of surface-free oily wastewater; Calculate the Cr channel deviation (crd) i,j : ; Where crm is the weighted average of the Cr channels: ; cr hm Mean value in the cr channel for historically collected images of surface oil-free wastewater; Calculate the spatial deviation ybr of YCbCr i,j : .

[0017] Preferably, the adaptive weighting strategy includes: According to the backlight status indicator g is Light intensity characteristics g li The comparison results with the fourth judgment threshold special ts4, and the saturation feature g st Based on the comparison with the fifth judgment threshold ts5, the weighting coefficients are adaptively selected, and the color deviation d is calculated. i,j : ; Among them, ts4 is the fourth judgment threshold, representing the strong light boundary, with a default value of 150; ts5 is the fifth judgment threshold, representing the saturation boundary, with a default value of 100; and ts6 is the sixth judgment threshold, representing the weak light boundary, with a default value of 80.

[0018] Preferably, step S5 includes: Based on color deviation d i,j Binarization is performed to obtain the classification score gd for pixel (i,j). i,j : ; Among them, ts7 is the seventh judgment threshold, which represents the deviation boundary between the oil stain and the water surface, with a default value of 0.25; Obtain the classification score set Θ={gd} of all pixels in the water area. i,j The set Θ' is processed by morphological opening operation using a 5×5 elliptical structural element to remove small noise points, resulting in the processed classification score set Θ'. A morphological closing operation is performed on the set Θ' using a 5×5 elliptical structuring element to fill the holes, resulting in the classification score set Θ'' after the holes are filled.

[0019] Preferably, the connected component analysis and area filtering include: Connectivity analysis was performed on the classification score set Θ'' using the 8-connectivity rule to extract all independent white regions, resulting in the set of suspected oil stain regions {Г1,..., }, where n2 is the number of suspected oil spill areas; For any suspected oil contamination area Г k The area Y is identified as the oil stain to be tested when the following conditions are met. p : , ts8 is the eighth judgment threshold, which represents the pixel area corresponding to the smallest oil stain area. The default value is 100.

[0020] Preferably, the method for calculating the hue diversity score includes: For the oil stain area Y to be tested p Calculate the hue vector (hx) for each pixel (i,j). i,j hy i,j ): ; Calculate the average vector within the region: ; Among them, n3 p For region Y p The number of pixels in the image; Calculate the average vector length: ; Calculate the hue diversity score: ; When gd p When >ts9, the area Y of the oil stain to be tested is determined. p The area is an oily area; where ts9 is the ninth judgment threshold, representing the minimum diversity score for the presence of oily color features, with a default value of 0.357. All areas identified as oil contamination are grouped together to form the oil contamination area Φ within the water body area.

[0021] The beneficial effects of this invention are as follows: By fusing multi-color space features and employing an adaptive weighting strategy, it effectively solves the problem of detecting oil pollution on water surfaces under different lighting conditions; by using morphological processing and connected component analysis techniques, it significantly improves the accuracy and robustness of detection; experimental results show that the detection accuracy of this method reaches over 94.7%, the false detection rate is less than 3.2%, the false negative rate is about 2.1%, and the average processing speed reaches 32 fps, achieving real-time and reliable detection of oil pollution on water surfaces, providing technical support for sewage management, environmental law enforcement, and monitoring of the operation of treatment facilities. Compared with traditional manual visual inspection methods, this method significantly improves detection efficiency, reduces labor costs, and enables continuous monitoring around the clock; compared with existing water quality sensors, this method can intuitively reflect the distribution of oil pollution on the water surface, providing a more accurate decision-making basis for pollution source tracing and emergency response. Detailed Implementation

[0022] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to embodiments. The content mentioned in the embodiments is not intended to limit the present invention.

[0023] Example 1 A method for detecting oil contamination on water surfaces based on color characteristics, specifically including the following steps: S1: Water Area Acquisition and Color Space Conversion A high-definition camera is set up opposite the water body to be detected to collect water image data in real time. The camera resolution is no less than 1920×1080, and the frame rate is no less than 25fps to ensure real-time performance and accuracy. A pre-trained YOLO (YouOnly Look Once) object detection algorithm is used to process the acquired images, automatically identifying and extracting the water region Ω from the images. The YOLO model is trained on a large number of labeled water images and can accurately distinguish between water and non-water areas (such as shore buildings, sky reflections, etc.). Let the number of pixels contained in the water region Ω be n1. For each pixel (i,j) ∈ Ω within the water region Ω, a color space conversion is performed to obtain the following color space coordinates: HSV color space coordinates (h... i,j s i,j v i,j ), coordinates of the Lab color space (l i,j a i,j b i,j ), coordinates of the YCbCr color space (y i,j , cb i,j ,cr i,j At the same time, a luminance meter is set up to obtain the actual brightness of the camera detection area to assist in the lighting assessment.

[0024] S2: Illumination status judgment First, the water region Ω is converted to grayscale space to obtain the grayscale value of each pixel. i,j Calculate the grayscale mean. Where n1 is the total number of pixels within the water region Ω. Calculate the grayscale standard deviation σ: When σ > ts1, over > ts2, and under > ts3 are simultaneously satisfied, the water area is determined to be in a backlighting state, and a backlighting state indicator g is set. is =1; otherwise, set the backlight status flag g. is =0. Backlight detection logic: When the following three conditions are met simultaneously, the water area is determined to be in a backlight state, and a backlight state flag g is set. is =1: σ > ts1 (standard deviation greater than the first threshold, default value is 60), over > ts2 (over-limit upper bound exponent greater than the second threshold, default value is 0.05), under > ts3 (over-limit lower bound exponent greater than the third threshold, default value is 0.1); otherwise, set g is =0.

[0025] S3: Calculation of Illumination Features The light intensity characteristics are calculated based on the grayscale mean μ; the saturation characteristics are calculated based on the grayscale mean μ and the saturation components of the HSV color space. The calculation methods for the over and under indices are as follows: Calculate the overlimit upper bound exponent: ; Among them, g1 i,j Score the upper bound of the out-of-bounds condition for pixel (i,j): ; Calculate the lower bound exponent under: ; Among them g2 i,j Score the lower bound of the out-of-bounds condition for pixel (i,j): ; Calculate the light intensity characteristic g li :g li =μ. Calculate the saturation characteristic g. st : These features will be used in subsequent adaptive weighting strategies.

[0026] S4: Color Deviation Calculation Color deviation calculation: Calculate the deviation of each channel in the HSV color space, Lab color space and YCbCr color space respectively; based on the backlight status indicator, light intensity characteristics and saturation characteristics, use an adaptive weighting strategy to fuse the deviation of each color space and calculate the color deviation of each pixel. First, calculate the HSV color space deviation.

[0027] Calculate H channel deviation hd i,j : ; Where hm is the weighted mean of the H channels: ; Where h hm Mean value of surface oil-free wastewater images collected historically in the H channel: Calculate the S-channel deviation sd i,j : ; Where sm is the weighted average of the S channels: ; s hm Mean value of the S-channel for historically collected images of surface oil-free wastewater: Calculate the V-channel deviation vd i,j : ; Where vm is the weighted average of the V channels: ; v hm Mean value in the V channel for historically collected images of surface oil-free wastewater; Calculate HSV spatial deviation hsv i,j : ; Then calculate the Lab color space deviation: Calculate L-channel deviation ld i,j : ; Where lm is the weighted average of the L channels: ; l hm Mean value in the L channel for historically collected images of surface oil-free wastewater; Calculate the deviation of channel a (ad) i,j : ; Where am is the weighted average of channel a: ; a hm The mean of surface images of oily wastewater collected historically in channel a; Calculate the deviation of channel bd i,j : ; Where bm is the weighted average of the b-channel: ; b hm Mean value of surface oil-free wastewater images collected historically in the b channel; Calculate Lab spatial deviation i,j : .

[0028] Next, calculate the YCbCr color space deviation: Calculate the Y-channel deviation yd i,j : ; Where ym is the weighted average of the Y channel: ; y hm Mean value in the Y channel of historically collected images of surface oil-free wastewater; Calculate the Cb channel deviation (cbd) i,j : ; Where cbm is the weighted average of the Cb channels: ; cb hm Mean value in the Cb channel for historically collected images of surface-free oily wastewater; Calculate the Cr channel deviation (crd) i,j : ; Where crm is the weighted average of the Cr channels: ; cr hm Mean value in the Cr channel for historically collected images of surface oil-free wastewater; Calculate the spatial deviation ybr of YCbCr i,j : .

[0029] Finally, the weighting coefficients are adaptively selected based on the lighting conditions, and the overall color deviation d is calculated. i,j : ; Among them, ts4 is the fourth judgment threshold, representing the strong light boundary, with a default value of 150; ts5 is the fifth judgment threshold, representing the saturation boundary, with a default value of 100; and ts6 is the sixth judgment threshold, representing the weak light boundary, with a default value of 80.

[0030] S5: Extraction and Verification of Oily Areas First, binarization is performed to obtain the classification score gd for pixel (i,j). i,j : ts7 is the seventh threshold, representing the deviation boundary between the oil stain and the water surface; the default value is 0.25. The classification score set Θ={gd} of all pixels in the water area is obtained. i,j The set Θ' is processed by morphological opening using a 5×5 elliptical structuring element to remove small noise points, resulting in the processed classification score set Θ'. Then, the set Θ' is processed by morphological closing using a 5×5 elliptical structuring element to fill the holes, resulting in the hole-filled classification score set Θ''.

[0031] Connectivity analysis was performed on the classification score set Θ'' using the 8-connectivity rule to extract all independent white regions, resulting in a set of suspected oil stain areas. Where n2 is the number of suspected oil spill areas. For any suspected oil spill area Г k When Σ is satisfied (i,j) ∈Г k When 1 > ts8 (summation range (i,j) ∈ Г) k The area identified as oil stain Y was determined to be the area to be tested. p ts8 is the eighth threshold, representing the pixel area corresponding to the smallest oil stain region, with a default value of 100.

[0032] For the oil stain area Y to be tested p Calculate the hue vector (hx) for each pixel (i,j). i,j hy i,j ): Calculate the average vector within the region: , where n3 p For region Y p The number of pixels in the vector. Calculate the average vector length: Calculate the hue diversity score: . When gd p When ts9 > , the area of ​​oil stain to be tested is determined to be Y. pThe area is defined as an oil-contaminated region; where ts9 is the ninth judgment threshold, representing the minimum diversity score for the presence of oil-contaminated color features, with a default value of 0.357. All regions judged as oil-contaminated are grouped into a set, which is the oil-contaminated region Φ within the water body area.

[0033] This method effectively addresses the problem of detecting oil contamination on water surfaces under varying lighting conditions through multi-color space feature fusion and an adaptive weighting strategy, demonstrating high detection accuracy, particularly in complex environments such as backlighting, strong light, and weak light. Furthermore, a hue diversity verification mechanism effectively reduces false detection rates and improves detection reliability.

[0034] The above are all preferred embodiments of this application and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A method for detecting oil contamination on the surface of water bodies based on color characteristics, characterized in that: Includes the following steps: S1. Water body region acquisition and color space conversion: Water body image data is acquired in real time through a camera, and the water body region Ω in the image is obtained using a pre-trained water body detection model; the pixels in the water body region Ω are converted to HSV color space, Lab color space and YCbCr color space, and the coordinate values ​​of each color space are obtained. S2. Illumination status judgment: Calculate the gray mean μ, gray standard deviation σ, over-limit index over, and under-limit index of the pixels in the water body area Ω; Based on the comparison results of the gray standard deviation σ, over-limit index over, and under-limit index with the corresponding thresholds, determine whether the water body area is in a backlight state and generate a backlight state indicator. S3. Illumination Feature Calculation: Calculate the light intensity feature based on the grayscale mean μ; calculate the saturation feature based on the grayscale mean μ and the saturation component of the HSV color space; S4. Color deviation calculation: Calculate the deviation of each channel in the HSV color space, Lab color space and YCbCr color space respectively; based on the backlight status indicator, light intensity characteristics and saturation characteristics, use an adaptive weighting strategy to fuse the deviation of each color space and calculate the color deviation of each pixel. S5. Oil pollution area extraction and verification: The water area is binarized according to the color deviation to obtain the initial classification result. The initial classification result is then subjected to morphological opening operation for noise reduction and closing operation for hole filling to obtain the optimized classification result. Connectivity analysis is performed on the optimized classification results to extract suspected oil pollution areas. The areas to be tested are selected based on the area of ​​the suspected oil pollution areas. The hue diversity score of the areas to be tested is calculated. The final oil pollution areas are verified and determined based on the hue diversity score.

2. The method for detecting oil stains on the surface of water based on color features according to claim 1, characterized in that: The water body detection model described in step S1 is trained using the YOLO target detection algorithm; The coordinates of each color space include: coordinates of the HSV color space (h i,j s i,j v i,j ), coordinates of the Lab color space (l i,j a i,j b i,j ), coordinates of the YCbCr color space (y i,j , cb i,j ,cr i,j ).

3. The method for detecting oil stains on the surface of water based on color features according to claim 1, characterized in that: The method for determining whether the water area is in a backlit state in step S2 includes: calculating the gray value of each pixel within the water area Ω. i,j ; Calculate the mean gray value μ: Where n1 is the total number of pixels in the water region Ω; Calculate the grayscale standard deviation σ: When σ > ts1, over > ts2, and under > ts3 are simultaneously satisfied, the water area is determined to be in a backlighting state, and a backlighting state indicator g is set. is =1; otherwise, set the backlight status flag g. is =0; Wherein, ts1 is the first judgment threshold; ts2 is the second judgment threshold; and ts3 is the third judgment threshold.

4. The method for detecting oil stains on the surface of water based on color features according to claim 3, characterized in that: The calculation methods for the overlimit upper bound index "over" and the overlimit lower bound index "under" include: Calculate the overlimit upper bound exponent: ; Among them, g1 i,j Score the upper bound of the out-of-bounds condition for pixel (i,j): ; Calculate the lower bound exponent under: ; Among them g2 i,j Score the lower bound of the out-of-bounds condition for pixel (i,j): 。 5. The method for detecting oil stains on the surface of water based on color features according to claim 1, characterized in that: In step S3: the light intensity feature g li The formula for calculating g is: li =μ; the saturation feature g st The calculation formula is: 。 6. The method for detecting oil stains on the surface of water based on color features according to claim 1, characterized in that: In step S4, the calculation method for the deviation of each color space channel includes: HSV color space deviation calculation: Calculate H channel deviation hd i,j : ; Where hm is the weighted mean of the H channels: ; Where h hm Mean value of surface oil-free wastewater images collected historically in the H channel; Calculate the S-channel deviation sd i,j : ; Where sm is the weighted average of the S channels: ; s hm Mean value of the S-channel for historically collected images of surface oil-free wastewater: Calculate the V-channel deviation vd i,j : ; Where vm is the weighted average of the V channels: ; v hm Mean value in the V channel for historically collected images of surface oil-free wastewater; Calculate HSV spatial deviation hsv i,j : ; Lab color space deviation calculation: Calculate L-channel deviation ld i,j : ; Where lm is the weighted average of the L channels: ; l hm Mean value in the L channel for historically collected images of surface oil-free wastewater; Calculate the deviation of channel a (ad) i,j : ; Where am is the weighted average of channel a: ; a hm The mean value of surface oil-free wastewater images collected historically in channel a; Calculate the deviation of channel bd i,j : ; Where bm is the weighted average of the b-channel: ; b hm Mean value of surface oil-free wastewater images collected historically in the b channel; Calculate Lab spatial deviation lad i,j : ; YCbCr color space deviation calculation: Calculate the Y-channel deviation yd i,j : ; Where ym is the weighted average of the Y channel: ; y hm Mean value in the Y channel of historically collected images of surface oil-free wastewater; Calculate the Cb channel deviation (cbd) i,j : ; Where cbm is the weighted average of the Cb channels: ; cb hm Mean value in the Cb channel for historically collected images of surface-free oily wastewater; Calculate the Cr channel deviation (crd) i,j : ; Where crm is the weighted average of the Cr channels: ; cr hm Mean value in the Cr channel for historically collected images of surface oil-free wastewater; Calculate the spatial deviation ybr of YCbCr i,j : 。 7. The method for detecting oil stains on the surface of water based on color features according to claim 6, characterized in that: The adaptive weighting strategy includes: According to the backlight status indicator g is Light intensity characteristics g li The comparison results with the fourth decision threshold ts4, and the saturation feature g st Based on the comparison with the fifth judgment threshold ts5, the weighting coefficients are adaptively selected, and the color deviation d is calculated. i,j : ; Among them, ts4 is the fourth judgment threshold, representing the strong light boundary; ts5 is the fifth judgment threshold, representing the saturation boundary; and ts6 is the sixth judgment threshold, representing the weak light boundary.

8. The method for detecting oil stains on the surface of water based on color features according to claim 1, characterized in that: Step S5 includes: Based on color deviation d i,j Binarization is performed to obtain the classification score gd for pixel (i,j). i,j : , Among them, ts7 is the seventh judgment threshold, which represents the deviation of the oil stain from the water surface; Obtain the classification score set Θ={gd} of all pixels in the water area. i,j The set Θ' is processed by morphological opening operation using a 5×5 elliptical structural element to remove small noise points, resulting in the processed classification score set Θ'. A morphological closing operation is performed on the set Θ' using a 5×5 elliptical structuring element to fill the holes, resulting in the classification score set Θ'' after the holes are filled.

9. The method for detecting oil stains on the surface of water based on color features according to claim 8, characterized in that: The connected component analysis and area filtering include: Connectivity analysis was performed on the classification score set Θ'' using the 8-connectivity rule to extract all independent white regions, resulting in the set of suspected oil stain regions {Г1,..., }, where n2 is the number of suspected oil spill areas; For any suspected oil contamination area Г k The area Y is identified as the oil stain to be tested when the following conditions are met. p : , ts8 is the eighth judgment threshold, which represents the pixel area corresponding to the smallest oil stain area. The default value is 100.

10. The method for detecting oil stains on the surface of water based on color features according to claim 9, characterized in that: The method for calculating the hue diversity score includes: For the oil stain area Y to be tested p Calculate the hue vector (hx) for each pixel (i,j). i,j hy i,j ): ; Calculate the average vector within the region: ; Among them, n3 p For region Y p The number of pixels in the image; Calculate the average vector length: ; Calculate the hue diversity score: ; When gd p When ts9 > , the area of ​​oil stain to be tested is determined to be Y. p The area is an oily area; where ts9 is the ninth judgment threshold, representing the minimum score for diversity of oily color features. All areas identified as oil contamination are grouped together to form the oil contamination area Φ within the water body area.

Citation Information

Patent Citations

  • A wastewater discharge detection method based on HSV color space

    CN109087363B

  • A method and system for identifying mixed flotation conditions based on foam color

    CN112016552B

  • A method for detecting the degree of contamination in lubricating oil

    CN115100212B

  • Intelligent detection method of hydraulic oil contamination based on image features

    CN117455913B

  • Image processing system and device of intelligent water affair inspection robot

    CN121481929A