Agricultural machinery unmanned driving camera contamination detection method, system, medium and equipment
By combining traditional machine vision and deep learning methods, and employing a three-channel image processing and dirt recognition model, the stability and robustness issues of camera dirt detection in unmanned agricultural machinery were resolved, achieving real-time dirt detection and closed-loop processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-26
- Publication Date
- 2026-04-14
AI Technical Summary
In the field of unmanned agricultural machinery, existing technologies for camera-based dirt detection suffer from poor stability and unstable target detection in complex environments. In particular, in farmland environments, traditional machine vision and deep learning algorithms are difficult to effectively accommodate different forms of dirt and resist environmental changes.
By combining traditional machine vision and deep learning methods, real-time detection of dirt in front of the camera is achieved through three-channel image processing, dynamic threshold segmentation, histogram equalization, and a dirt recognition model.
It achieves accurate detection of camera dirt in complex farmland environments, generates alarm signals and transmits them to the autonomous driving platform, improves the stability of traditional methods and the robustness of deep learning, and realizes closed-loop processing.
Smart Images

Figure CN115578366B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing, and in particular relates to a method, system, medium and equipment for detecting dirt in unmanned agricultural machinery cameras. Background Technology
[0002] Visual detection is a crucial component of the perception module in autonomous driving systems. In the field of agricultural machinery autonomous driving, visual systems perceive the environment surrounding agricultural machinery, facilitating obstacle detection and avoidance, wheat lodging detection and identification, and unmanned spraying of corn seedlings during autonomous driving. However, due to the harsh operating environment of agricultural machinery, large amounts of dust, mud, and other contaminants often adhere to the camera, easily obstructing the image captured by the camera and interfering with the accuracy and stability of the visual detection system's image quality. This can lead to serious economic losses or even endanger personal safety. Therefore, designing a dirt detection system based on cameras for agricultural machinery autonomous driving plays a vital role in the safe and reliable operation of the perception system for agricultural machinery autonomous driving.
[0003] Current camera-based dirt detection methods are mainly divided into traditional machine vision dirt detection and methods using neural network deep learning. In traditional machine vision detection, patent CN111970506A uses image partitioning and total area calculations, combining regional grayscale values for comprehensive detection. Patent CN12261403A discloses a device based on a feature module and a region filtering module, finally fitting probability density in a noise calculation module to determine dirt detection accuracy. Patent CN109241977A discloses a method based on binocular depth histogram information to determine the accuracy of camera dirt and other occlusion detection. Regarding neural networks, patent CN114359253A discloses a method based on convolutional neural networks to detect factors affecting dirt detection, using training images as input. Patent CN110572636 discloses a method that converts two camera images into a one-dimensional sequence and then uses a convolutional neural network to calculate dirt detection features to achieve dirt detection.
[0004] On the one hand, current camera-based dirt detection only uses traditional machine vision or only uses deep learning neural networks. On the other hand, there is basically no relevant content on camera-based dirt detection systems in the field of unmanned agricultural machinery. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a method, system, medium and equipment for detecting dirt in unmanned agricultural machinery cameras.
[0006] The technical solution of this invention to solve the above-mentioned technical problems is as follows: A method for detecting dirt and grime using an unmanned agricultural machinery camera, comprising:
[0007] Step 1: For each image captured by the camera, the images are processed according to three channels to obtain the image corresponding to each captured image in each channel;
[0008] Step 2: Obtain the grayscale value of each pixel in each channel of any acquired image, and extract the first pixel with a grayscale value less than the threshold from each channel of the acquired image using a dynamic threshold segmentation method, until the first pixel in each channel of each acquired image is obtained;
[0009] Step 3: Based on the first pixel of each channel corresponding to any acquired image, form multiple connected components on the image of each channel corresponding to the acquired image, until multiple connected components are formed on the image of each channel corresponding to each acquired image;
[0010] Step 4: Perform histogram equalization on each connected component of the image under each channel corresponding to any acquired image to obtain the equalized image corresponding to that acquired image, until the equalized image under each channel corresponding to each acquired image is obtained.
[0011] Step 5: Input each equalized image into the dirt recognition model to determine whether there is a dirty area. If the dirty area exists, generate an alarm message.
[0012] The beneficial effects of this invention are: it provides a dirt detection algorithm for a camera-based environmental perception system in an unmanned agricultural machinery operation environment. It enables real-time detection of dirt interference in front of the camera. This improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention can transmit a dirt alarm signal to the unmanned platform system, achieving closed-loop processing.
[0013] Based on the above technical solution, the present invention can be further improved as follows.
[0014] Furthermore, the image acquisition from the camera specifically refers to the acquisition of images in real time by the visual sensor according to the image acquisition frame rate (fps) set by the camera.
[0015] Furthermore, the dynamic threshold segmentation method specifically includes:
[0016] S = S[x,y,p(x,y),f(x,y)];
[0017] Where p(x,y) represents the local property of point (x,y), x represents the x-coordinate of the point on the image, y represents the y-coordinate of the point on the image, f(x,y) represents the original image, and S represents the threshold.
[0018] Furthermore, step 4 specifically involves:
[0019] Calculate the gray-level histogram for each connected component, perform cumulative distribution function calculation on each gray-level histogram, and perform histogram equalization on the cumulative distribution function calculation results to obtain different equalized images for each channel.
[0020] Furthermore, the specific method for constructing the dirt recognition model is as follows:
[0021] A dirt recognition model is constructed using an input end, a backbone network, a neck structure, and an output end. The input end is used to preprocess the input image, including improving contrast, reducing noise, and rotating it. The output end is used to output the processing result of the dirt recognition model.
[0022] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: A dirt detection system for unmanned agricultural machinery cameras, comprising:
[0023] The channel-splitting module is used to extract and process each image captured by the camera according to three channels;
[0024] The extraction module is used to obtain the gray value of each pixel in each channel of any acquired image, and extract the first pixel with a gray value less than the threshold from the image in each channel of the acquired image using a dynamic threshold segmentation method, until the first pixel in each channel of each acquired image is obtained.
[0025] The forming module is used to form multiple connected components on the image of each channel corresponding to any acquired image based on the first pixel point of each channel corresponding to any acquired image, until multiple connected components are formed on the image of each channel corresponding to each acquired image;
[0026] The equalization module is used to perform histogram equalization on each connected component of the image under each channel corresponding to any acquired image to obtain the equalized image corresponding to the acquired image, until the equalized image under each channel corresponding to each acquired image is obtained.
[0027] The recognition module is used to input each equalized image into the dirt recognition model to determine whether there is a dirty area. If the dirty area exists, an alarm message is generated.
[0028] The beneficial effects of this invention are: it provides a dirt detection algorithm for a camera-based environmental perception system in an unmanned agricultural machinery operation environment. It enables real-time detection of dirt interference in front of the camera. This improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention can transmit a dirt alarm signal to the unmanned platform system, achieving closed-loop processing.
[0029] Furthermore, the image acquisition from the camera specifically refers to the image being acquired in real time by the visual sensor according to the image acquisition frame rate (fps) set by the camera.
[0030] Furthermore, the dynamic threshold segmentation method specifically includes:
[0031] S = S[x,y,p(x,y),f(x,y)];
[0032] Where p(x,y) represents the local property of point (x,y), x represents the x-coordinate of the point on the image, y represents the y-coordinate of the point on the image, f(x,y) represents the original image, and S represents the threshold.
[0033] Furthermore, the equalization module is specifically used for:
[0034] Calculate the gray-level histogram for each connected component, perform cumulative distribution function calculation on each gray-level histogram, and perform histogram equalization on the cumulative distribution function calculation results to obtain different equalized images for each channel.
[0035] Furthermore, the specific method for constructing the dirt recognition model is as follows:
[0036] A dirt recognition model is constructed using an input end, a backbone network, a neck structure, and an output end. The input end is used to preprocess the input image, including improving contrast, reducing noise, and rotating it. The output end is used to output the processing result of the dirt recognition model.
[0037] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a storage medium storing instructions, wherein when a computer reads the instructions, the computer executes a method for detecting dirt in an unmanned agricultural machinery camera as described in any of the above claims.
[0038] The beneficial effects of this invention are: it provides a dirt detection algorithm for a camera-based environmental perception system in an unmanned agricultural machinery operation environment. It enables real-time detection of dirt interference in front of the camera. This improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention can transmit a dirt alarm signal to the unmanned platform system, achieving closed-loop processing.
[0039] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: an electronic device, including the above-mentioned storage medium and a processor that executes the instructions in the above-mentioned storage medium.
[0040] The beneficial effects of this invention are: it provides a dirt detection algorithm for a camera-based environmental perception system in an unmanned agricultural machinery operation environment. It enables real-time detection of dirt interference in front of the camera. This improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention can transmit a dirt alarm signal to the unmanned platform system, achieving closed-loop processing. Attached Figure Description
[0041] Figure 1 This is a flowchart illustrating an embodiment of a method for detecting dirt using an unmanned camera on agricultural machinery according to the present invention.
[0042] Figure 2 This is a structural framework diagram of a dirt detection system for unmanned agricultural machinery provided by the present invention;
[0043] Figure 3 This is a schematic diagram of the algorithm design process provided in an embodiment of the dirt detection method for unmanned agricultural machinery using a camera according to the present invention;
[0044] Figure 4 This is a schematic diagram of the three-channel component results provided in an embodiment of the dirt detection method for unmanned agricultural machinery using a camera according to the present invention;
[0045] Figure 5 This is a comparative schematic diagram of histogram equalization processing provided in an embodiment of the dirt detection method for unmanned agricultural machinery cameras according to the present invention;
[0046] Figure 6 This is a schematic diagram of the Yolov-6.0 network structure provided in an embodiment of the method for detecting dirt and grime using an unmanned camera on agricultural machinery according to the present invention.
[0047] Figure 7 This is an example diagram showing the final detection effect of a method for detecting dirt using an unmanned camera on agricultural machinery according to an embodiment of the present invention. Detailed Implementation
[0048] The principles and features of the present invention are described below. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0049] like Figure 1 As shown, a method for detecting dirt using an unmanned agricultural machinery camera includes:
[0050] Step 1: For each image captured by the camera, the images are processed according to three channels to obtain the image corresponding to each captured image in each channel;
[0051] Step 2: Obtain the grayscale value of each pixel in each channel of any acquired image, and extract the first pixel with a grayscale value less than the threshold from each channel of the acquired image using a dynamic threshold segmentation method, until the first pixel in each channel of each acquired image is obtained;
[0052] Step 3: Based on the first pixel of each channel corresponding to any acquired image, form multiple connected components on the image of each channel corresponding to the acquired image, until multiple connected components are formed on the image of each channel corresponding to each acquired image;
[0053] Step 4: Perform histogram equalization on each connected component of the image under each channel corresponding to any acquired image to obtain the equalized image corresponding to that acquired image, until the equalized image under each channel corresponding to each acquired image is obtained.
[0054] Step 5: Input each equalized image into the dirt recognition model to determine whether there is a dirty area. If the dirty area exists, generate an alarm message.
[0055] In some possible implementations, a dirt detection algorithm for a camera-based environmental perception system is provided for use in unmanned agricultural machinery operation environments. This algorithm enables real-time detection of dirt interference in front of the camera. It improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention transmits a dirt alarm signal to the unmanned platform system, achieving closed-loop processing.
[0056] It should be noted that there are currently few solutions for dirt detection algorithms based on visual perception in the field of agricultural machinery. Existing image dirt detection algorithms based on general cameras mainly fall into two categories: traditional machine vision image processing dirt detection and deep learning-based dirt detection. Traditional machine vision dirt detection methods typically detect dirt through threshold segmentation, feature extraction, and feature classification. This mainly utilizes the different grayscale ranges occupied by the background and the target; some patents claim to achieve dirt detection directly through grayscale range detection. However, this approach is only suitable for situations where the histogram has obvious valleys, and its performance is poor in complex agricultural machinery environments.
[0057] Deep learning has developed rapidly in recent years, and deep learning models based on convolutional neural networks are widely used to detect various objects. Given a large enough dataset, deep learning can be compatible with images of varying degrees of dirt and grime, reducing interference from changes in weather or scene conditions.
[0058] In the complex field of unmanned agricultural machinery, off-road environments differ greatly from traditional on-road unmanned driving environments, especially in the field of visual environmental perception applications. There is currently no solution for camera-based visual dirt detection in unmanned agricultural machinery operations.
[0059] Traditional machine vision image detection methods for dirt detection face two main problems: 1) Due to the diverse forms of dirt, traditional image algorithms are often incompatible with different types of dirt; 2) Traditional machine vision image algorithms are sensitive to changes in lighting intensity, meaning they are easily affected by weather conditions. Therefore, using only traditional image algorithms for dirt detection is unlikely to achieve stable results. Regarding deep learning for dirt detection, the complex farmland environment, significant background interference, and insufficient information contained within the dirt itself result in poor target recognition capabilities and a tendency to overtrain and fit, requiring substantial data accumulation. Therefore, using either traditional machine vision image algorithms or deep learning alone for dirt detection is insufficient to achieve satisfactory results in complex farmland environments.
[0060] like Figure 3 As shown, this paper proposes a complete solution that combines traditional machine vision image processing algorithms with deep learning algorithms, taking into account the advantages and disadvantages of traditional machine vision image processing algorithms and deep learning algorithms, to achieve accurate detection of dirt in cameras during unmanned driving in agricultural machinery environments.
[0061] Step 1, the specific processing procedure for extracting and processing each image captured by the camera according to three channels can be found in the following example:
[0062] In environmental perception, the visual sensor transmits image data in real time according to the camera's set frame rate (fps), acquiring the image matrix A input from the camera sensor. i,j .in, i,j These represent the number of pixels horizontally and vertically in the image, respectively.
[0063] like Figure 4 As shown, the image is divided into three channels: blue (B), green (G), and red (R). The grayscale values RGrayval of the three channels are obtained. Each channel of the three-channel image is a two-dimensional digital matrix. The pixel grayscale value of each channel is 0-255. The larger the value, the brighter the image in that channel, which is reflected in the three channels as a darker color.
[0064] Step 2, obtaining the grayscale value of the acquired image for each channel, and extracting the first pixel whose grayscale value is less than the threshold for each channel using a dynamic threshold segmentation method, can be seen in the following example:
[0065] Because the dirt affecting cameras in agricultural machinery operation environments is generally black or brown, resulting in low BGR pixel values, dynamic thresholding is used to segment the image matrix A in order to distinguish between background interference pixels and the main dirty pixels. i,j Points with a BGR value less than the threshold are extracted. Thresholding can be viewed as a function operation, specifically written as S = S[x,y,p(x,y),f(x,y)], where p(x,y) represents the local property of point (x,y). The thresholded image a(x,y) can be defined as:
[0066]
[0067] Pixels marked as 1 represent grayscale values primarily within the threshold of the dirty portion, and are the main objects to be retained after segmentation. Pixels marked as 0 mainly represent other background parts present in the image, and are primarily used to filter the background.
[0068] Step 3, the specific process of forming multiple connected components for each channel based on the first pixel of each channel is as follows:
[0069] Connected component processing refers to grouping pixels with similar values and adjacent positions in an image into regions. After image segmentation, it can be represented as generating multiple connected components {x1, x2, ..., x...}. n This method can remove some background interference.
[0070] Step 4 involves performing histogram equalization on each connected component of each channel to obtain different equalized images for each channel. The specific process can be found in the following example:
[0071] For the connected components {x1, x2, ... x} after partitioning... n The algorithm calculates the histogram of each connected component in the three channels and performs equalization processing on it. This transforms the original input histogram into a distribution across the entire grayscale range (0-255), ensuring that pixels in the image are evenly distributed across equalized grayscale values of 0-255, thereby enhancing image contrast and improving image clarity. Figure 5 As shown, the specific process is as follows: for the connected component {x1, x2, ... x...} n Calculate the gray-level histogram P(r). For a real gray value x, calculate the cumulative distribution function Fx(x) = P(X≤x) for each gray-level histogram. Based on the cumulative distribution function Fx(x) and the histogram equalization principle, obtain the mapping relationship between the input gray value and the output transformed gray value. Finally, based on the mapping relationship, obtain the connected component result S after image transformation. k The mapping method is specifically described as follows:
[0072]
[0073] S k The value is the gray level of the current gray-level histogram P(r) mapped by the cumulative distribution function. k refers to the upper bound, j refers to the lower bound, and the lower bound is calculated from 0. n is the sum of all gray-level pixels in the image. j This refers to the number of pixels in the grayscale image before transformation, where L refers to the total number of grayscale levels in the image. The thresholding operation performed previously is then applied again to each connected component, generating new connected components {a1, a2, ... a...}. n}
[0074] Step 5 involves inputting each equalized image into the dirt recognition model to obtain the dirty areas and generate alarm information. The specific process can be found in the following example:
[0075] The image {a1, a2...a...} generated after equalization processing n Input the following into the Yolov5-6.0 deep learning network structure: Figure 6 As shown, the network structure mainly consists of four parts: the input end, the backbone network, the Neck structure, and the final output end, Prediction. The input end primarily involves preprocessing the image samples, applying methods such as brightness, contrast, noise reduction, and rotation adjustments to enhance the richness of the training samples. The backbone network's main function is to extract training features, while the Neck structure further enhances feature extraction capabilities by fusing the extracted main features. The output end, Prediction, primarily performs classification prediction and outputs the bounced box coordinates.
[0076] like Figure 7 As shown, after training the detection using a YOLOv5 deep learning model, a real-time dirt detection function combining machine vision and deep learning is achieved. Dirty areas will generate bounding boxes (note that bounding boxes are only generated for marked dirty areas after YOLOv5 deep learning training; previous steps only involved multiple processing steps on the original image to facilitate deep learning detection). Although the image undergoes the above processing steps, the image size itself remains unchanged. The dirt regression boxes generated from the detection results are mapped back to the original input image A based on the pixel-image size correspondence. i,j In this system, the regression detection box can detect the presence of dirty areas in video images in real time (the detection box can detect the presence of dirt in real time, and the presence of dirt is determined by judging the size of the regression box area). The generated detection box can trigger an alarm by setting a threshold for the pixel area size of the dirt detection box. Once the threshold is reached, a dirt alarm signal is sent to the unmanned agricultural machinery platform via CAN message for timely handling.
[0077] Preferably, in any of the above embodiments, the image acquisition for the camera specifically refers to: the image acquired in real time by the visual sensor according to the image acquisition frame rate value fps set by the camera.
[0078] Preferably, in any of the above embodiments, the dynamic threshold segmentation method specifically comprises:
[0079] S = S[x,y,p(x,y),f(x,y)];
[0080] Where p(x,y) represents the local property of point (x,y), x represents the x-coordinate of the point on the image, y represents the y-coordinate of the point on the image, f(x,y) represents the original image, and S represents the threshold.
[0081] It should be noted that the local properties refer to the image after thresholding.
[0082] Preferably, in any of the above embodiments, step 4 specifically comprises:
[0083] Calculate the gray-level histogram for each connected component, perform cumulative distribution function calculation on each gray-level histogram, and perform histogram equalization on the cumulative distribution function calculation results to obtain different equalized images for each channel.
[0084] Preferably, in any of the above embodiments, the dirt recognition model is constructed as follows:
[0085] A dirt recognition model is constructed using an input end, a backbone network, a neck structure, and an output end. The input end is used to preprocess the input image, including improving contrast, reducing noise, and rotating it. The output end is used to output the processing result of the dirt recognition model.
[0086] like Figure 2 As shown, a dirt detection system for unmanned agricultural machinery using cameras includes:
[0087] The channel-splitting module 100 is used to extract and process each image captured by the camera according to three channels;
[0088] The extraction module 200 is used to obtain the gray value of each pixel in each channel of any acquired image, and extract the first pixel with a gray value less than the threshold from the image in each channel of the acquired image using a dynamic threshold segmentation method, until the first pixel in each channel of each acquired image is obtained.
[0089] The forming module 300 is used to form multiple connected components on the image of each channel corresponding to any acquired image based on the first pixel point of each channel corresponding to any acquired image, until multiple connected components are formed on the image of each channel corresponding to each acquired image.
[0090] The equalization module 400 is used to perform histogram equalization processing on each connected component of the image under each channel corresponding to any acquired image to obtain the equalized image corresponding to the acquired image, until the equalized image under each channel corresponding to each acquired image is obtained.
[0091] The recognition module 500 is used to input each equalized image into the dirt recognition model to determine whether there is a dirty area. If the dirty area exists, an alarm message is generated.
[0092] In some possible implementations, a dirt detection algorithm for a camera-based environmental perception system is provided for use in unmanned agricultural machinery operation environments. This algorithm enables real-time detection of dirt interference in front of the camera. It improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention transmits a dirt alarm signal to the unmanned platform system, achieving closed-loop processing.
[0093] Preferably, in any of the above embodiments, the image acquisition for the camera specifically refers to: the image acquired in real time by the visual sensor according to the image acquisition frame rate value fps set by the camera.
[0094] Furthermore, the dynamic threshold segmentation method specifically includes:
[0095] S = S[x,y,p(x,y),f(x,y)];
[0096] Where p(x,y) represents the local property of point (x,y), x represents, y represents, f(x,y) represents, and S represents.
[0097] Preferably, in any of the above embodiments, the equalization module 400 is specifically used for:
[0098] Calculate the gray-level histogram for each connected component, perform cumulative distribution function calculation on each gray-level histogram, and perform histogram equalization on the cumulative distribution function calculation results to obtain different equalized images for each channel.
[0099] Preferably, in any of the above embodiments, the dirt recognition model is constructed as follows:
[0100] A dirt recognition model is constructed using an input end, a backbone network, a neck structure, and an output end. The input end is used to preprocess the input image, including improving contrast, reducing noise, and rotating it. The output end is used to output the processing result of the dirt recognition model.
[0101] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a storage medium storing instructions, wherein when a computer reads the instructions, the computer executes a method for detecting dirt in an unmanned agricultural machinery camera as described in any of the above claims.
[0102] In some possible implementations, a dirt detection algorithm for a camera-based environmental perception system is provided for use in unmanned agricultural machinery operation environments. This algorithm enables real-time detection of dirt interference in front of the camera. It improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention transmits a dirt alarm signal to the unmanned platform system, achieving closed-loop processing.
[0103] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: an electronic device, including the above-mentioned storage medium and a processor that executes the instructions in the above-mentioned storage medium.
[0104] In some possible implementations, a dirt detection algorithm for a camera-based environmental perception system is provided for use in unmanned agricultural machinery operation environments. This algorithm enables real-time detection of dirt interference in front of the camera. It improves upon the poor stability of traditional machine vision image processing algorithms and the instability of deep learning algorithms in complex environments. Upon detecting dirt in the front camera, this invention transmits a dirt alarm signal to the unmanned platform system, achieving closed-loop processing.
[0105] Readers should understand that in the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0106] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the method embodiments described above are merely illustrative. For instance, the division of steps is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple steps may be combined or integrated into another step, or some features may be ignored or not executed.
[0107] If the above methods are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0108] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. An agricultural unmanned camera lens contamination detection method, characterized in that, include: Step 1: For each image captured by the camera, the images are processed according to three channels to obtain the image corresponding to each captured image in each channel; Step 2: Obtain the grayscale value of each pixel in each channel of any acquired image, and extract the first pixel with a grayscale value less than the threshold from each channel of the acquired image using a dynamic threshold segmentation method, until the first pixel in each channel of each acquired image is obtained; Step 3: Based on the first pixel of each channel corresponding to any acquired image, form multiple connected components on the image of each channel corresponding to the acquired image, until multiple connected components are formed on the image of each channel corresponding to each acquired image; Step 4: Perform histogram equalization on each connected component of the image under each channel corresponding to any acquired image to obtain the equalized image corresponding to that acquired image, until the equalized image under each channel corresponding to each acquired image is obtained. Step 5: Input each equalized image into the dirt recognition model to determine whether there is a dirty area. If the dirty area exists, generate an alarm message.
2. The unmanned camera dirty detection method for agricultural machinery according to claim 1, characterized in that, The images captured by the camera are specifically images acquired in real time by the visual sensor according to the frame rate (fps) set by the camera.
3. The unmanned camera dirty detection method for agricultural machinery according to claim 1, characterized in that, The dynamic threshold segmentation method is specifically as follows: S = S[x,y,p(x,y),f(x,y)]; Where p(x,y) represents the local property of point (x,y), x represents the x-coordinate of the point on the image, y represents the y-coordinate of the point on the image, f(x,y) represents the original image, S represents the threshold, and the local property is the image after thresholding.
4. The unmanned camera dirty detection method for agricultural machinery according to claim 1, characterized in that, Step 4 specifically involves: Calculate the gray-level histogram of each connected component in each channel of any acquired image, and perform cumulative distribution function calculation on each gray-level histogram. Then, perform histogram equalization on the cumulative distribution function calculation results to obtain the equalized image corresponding to the acquired image, until the equalized image for each channel of each acquired image is obtained.
5. The unmanned camera dirty detection method for agricultural machinery according to claim 1, characterized in that, The specific method for constructing the dirt recognition model is as follows: A dirt recognition model is constructed using an input end, a backbone network, a neck structure, and an output end. The input end is used to preprocess the input image, including improving contrast, reducing noise, and rotating it. The output end is used to output the processing result of the dirt recognition model.
6. An agricultural unmanned camera dirty detection system, characterized in that, include: The channel-splitting module is used to extract and process the images captured by each camera according to three channels, so as to obtain the image of each captured image in each channel. The extraction module is used to obtain the gray value of each pixel in each channel of any acquired image, and extract the first pixel with a gray value less than the threshold from the image in each channel of the acquired image using a dynamic threshold segmentation method, until the first pixel in each channel of each acquired image is obtained. The forming module is used to form multiple connected components on the image of each channel corresponding to any acquired image based on the first pixel point of each channel corresponding to any acquired image, until multiple connected components are formed on the image of each channel corresponding to each acquired image; The equalization module is used to perform histogram equalization on each connected component of the image under each channel corresponding to any acquired image to obtain the equalized image corresponding to the acquired image, until the equalized image under each channel corresponding to each acquired image is obtained. The recognition module is used to input each equalized image into the dirt recognition model to determine whether there is a dirty area. If the dirty area exists, an alarm message is generated.
7. The unmanned camera dirty detection system for agricultural machinery according to claim 6, characterized in that, The images captured by the camera are specifically images acquired in real time by the visual sensor according to the frame rate (fps) set by the camera.
8. The unmanned camera dirty detection system for agricultural machinery according to claim 6, characterized in that, The dynamic threshold segmentation method is specifically as follows: S = S[x,y,p(x,y),f(x,y)]; Where p(x,y) represents the local property of point (x,y), x represents the x-coordinate of the point on the image, y represents the y-coordinate of the point on the image, f(x,y) represents the original image, S represents the threshold, and the local property is the image after thresholding.
9. A storage medium, characterized in that, The medium stores instructions that, when read by a computer, cause the computer to execute a method for detecting dirt in an unmanned agricultural machinery camera as described in any one of claims 1 to 5.
10. An electronic device, characterized in that, Includes the storage medium of claim 9 and a processor that executes instructions within the storage medium.
Citation Information
Patent Citations
A method for detecting camera lens occlusion
CN109241977A
Lens dirt detection method and device and terminal device
CN110766679A
Lens dirt detection method for camera module
TW202224404A