Camera stain identification method and device, vehicle and storage medium
By acquiring current and historical images from the camera and weather information, combined with a weather recognition model and a meteorological server, the system accurately identifies camera stains, solving the problem of difficulty in identifying stains while the vehicle is in motion, ensuring driving safety and timely cleaning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GREAT WALL MOTOR CO LTD
- Filing Date
- 2022-11-09
- Publication Date
- 2026-06-26
AI Technical Summary
When the vehicle is in motion, dirt on the camera is difficult to identify accurately, causing the vehicle's intelligent driving system to fail to correctly recognize the driving environment and affecting driving safety.
By acquiring images from the camera at current and historical moments, and combining them with current and historical weather information, the camera's stain recognition results are determined. Weather information is obtained using a weather recognition model and a meteorological server, and the judgment is made by combining image clarity and weather probability.
It enables accurate identification of whether there are stains on the camera under different weather conditions, ensuring driving safety, and performing timely cleaning operations when necessary, thereby improving the accuracy of the vehicle's intelligent driving system.
Smart Images

Figure CN115761668B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of vehicle technology, and in particular relates to a method, device, vehicle and storage medium for stain recognition using a camera. Background Technology
[0002] With the rapid development of intelligent vehicles, vehicles typically rely on multiple onboard cameras to collect information about their surroundings. This information assists the vehicle's intelligent driving system in correctly identifying the driving environment and reducing traffic accidents. Therefore, determining whether the cameras in the onboard cameras are dirty is particularly important.
[0003] Currently, the detection of stains on cameras is mainly based on the car owner's assessment of images captured by the in-vehicle camera. However, when the vehicle is in motion, and due to weather conditions, the image quality is often poor, making it impossible to accurately identify whether there are stains on the camera. Summary of the Invention
[0004] This application provides a method, apparatus, vehicle, and storage medium for identifying dirt in a camera, which can solve the problem that vehicles cannot accurately identify whether there are dirt in the camera.
[0005] In a first aspect, embodiments of this application provide a method for identifying dirt using a camera, applied to a vehicle, the method comprising:
[0006] Acquire the first image captured by the camera at the current moment and the second image captured at a historical moment;
[0007] Obtain the current weather information and determine the probability that the camera is the first target with dirt at the current moment based on the current weather information;
[0008] Acquire historical weather information at historical moments, and determine the probability that the camera has a second target with dirt at historical moments based on the historical weather information;
[0009] Determine the first sharpness of the first image and the second sharpness of the second image;
[0010] The stain recognition result of the camera is determined based on the first resolution, the second resolution, the first target probability, and the second target probability.
[0011] Secondly, embodiments of this application provide a stain recognition device for a camera, applied to a vehicle, the device comprising:
[0012] The first acquisition module is used to acquire the first image captured by the camera at the current moment and the second image captured at a historical moment;
[0013] The second acquisition module is used to acquire the current weather information at the current moment, and determine the probability that the camera has a first target with dirt at the current moment based on the current weather information;
[0014] The third acquisition module is used to acquire historical weather information at historical times and determine the probability of a second target with dirt on the camera at historical times based on the historical weather information.
[0015] The first determining module is used to determine the first sharpness of the first image and the second sharpness of the second image;
[0016] The second determining module is used to determine the stain recognition result of the camera based on the first resolution, the second resolution, the first target probability, and the second target probability.
[0017] Thirdly, embodiments of this application provide a vehicle including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect above.
[0019] Fifthly, embodiments of this application provide a computer program product that, when run on a vehicle, causes the vehicle to perform the method described in the first aspect.
[0020] The beneficial effects of this application embodiment compared to the prior art are as follows: First, a first image captured by the camera at the current moment and a second image captured at a historical moment are acquired. Then, the current weather information at the current moment is acquired, and a first target probability of dirt being present in the camera under the current weather information is determined. Next, historical weather information at historical moments is acquired, and a second target probability of dirt being present in the camera under historical weather information is determined. Afterwards, a first sharpness of the first image and a second sharpness of the second image are determined, and the dirt recognition result of the camera is determined based on the first and second sharpness. Therefore, when determining whether a camera has dirt, the judgment is not only based on the sharpness between the two frames, but also combines the weather information at the time the two frames were acquired, thus accurately obtaining the dirt recognition result. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart illustrating the implementation of a stain recognition method for a camera according to an embodiment of this application;
[0023] Figure 2 This is a schematic diagram illustrating one implementation method of obtaining current weather information in a stain recognition method for a camera provided in an embodiment of this application;
[0024] Figure 3 This is a schematic diagram illustrating one implementation of a stain recognition method for a camera according to an embodiment of this application, which determines the stain recognition result.
[0025] Figure 4 This is a schematic diagram illustrating an application scenario of a camera-based stain recognition method provided in an embodiment of this application, where the camera captures an image when stains are present.
[0026] Figure 5 This is a schematic diagram illustrating an application scenario of a camera capturing an image after a stain removal process, as provided in an embodiment of the stain recognition method for cameras according to this application.
[0027] Figure 6 This is a schematic diagram of the structure of a stain recognition device for a camera according to an embodiment of this application;
[0028] Figure 7 This is a schematic diagram of the structure of a vehicle provided in one embodiment of this application. Detailed Implementation
[0029] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0030] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0031] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0032] Vehicles typically use multiple onboard cameras to collect information about their surroundings, assisting the vehicle's intelligent driving system in correctly identifying the driving environment and reducing traffic accidents. Currently, this is mainly achieved by the driver judging the images captured by the onboard cameras to determine if there are any stains on the cameras. However, when the vehicle is in motion, weather conditions may result in poor image quality, preventing the driver from promptly noticing stains on the cameras. This can cause the vehicle's intelligent driving system to fail to correctly identify the driving environment, compromising driving safety.
[0033] Therefore, in order to accurately identify whether there are stains on a camera, this application provides a stain identification method for a camera, applied to a vehicle. A vehicle typically has multiple camera devices installed, and the vehicle can execute the above method on the camera of any of these devices.
[0034] See Figure 1 , Figure 1 The following is a flowchart illustrating the implementation of a stain recognition method for a camera according to an embodiment of this application. The method includes the following steps:
[0035] S101, acquire the first image captured by the camera at the current moment and the second image captured at a historical moment.
[0036] In one embodiment, the aforementioned historical moment can be the previous moment before the current moment, in which case the first image and the second image are two adjacent frames. Alternatively, the historical moment can be a moment that is separated from the current moment by a preset time interval, in which case the first image and the second image will be separated by multiple frames. In this embodiment, either adjacent first and second images can be selected, or first and second images separated by a preset number of frames can be selected; there is no limitation on this.
[0037] The vehicle can acquire and store images captured by the camera in real time. Therefore, the vehicle can directly access the second image mentioned above.
[0038] S102. Obtain the current weather information at the current moment, and determine the probability that the camera has a first target with dirt at the current moment based on the current weather information.
[0039] In one embodiment, weather information includes, but is not limited to, one or more of the following: light intensity, temperature, rain, snow, fog, sandstorm, etc. The current weather information refers to the weather information acquired at the current moment. The aforementioned stains include, but are not limited to, dust, dirt, and other objects that easily adhere to the camera.
[0040] It should be noted that images captured by video equipment are typically affected by weather conditions such as sunlight, rain, snow, fog, and sandstorms, but less so by temperature. Therefore, weather information can usually be primarily comprised of these factors.
[0041] However, since the captured images are used for stain recognition, and the intensity of light usually does not cause stains to appear on the camera, in this embodiment, the aforementioned weather information can specifically be information such as rain, snow, fog, or sandstorms, and is not limited thereto.
[0042] Specifically, the vehicle can be based on, for example Figure 2 The steps S201-S205 shown determine the current weather information.
[0043] Details are as follows:
[0044] S201. Process the first image according to the preset weather recognition model to obtain the first weather information.
[0045] In one embodiment, the weather recognition model described above is a model used to process the first image and output the first weather information. This model can be pre-trained. The weather recognition model can be a Region Selection and Concurrency Model (RSCM) or a network model built using the YouOnlyLookOnce (YOLO) algorithm; there is no limitation on the specific model. In this embodiment, the weather recognition model is primarily an RSCM model.
[0046] S202. Obtain the vehicle's current location information.
[0047] S203. Send a weather information request containing the current location information to the preset weather server.
[0048] S204. Receive the second weather information returned by the meteorological server based on the weather information request.
[0049] In one embodiment, the aforementioned current location information refers to the vehicle's current location information, which can be determined based on a pre-set positioning device. For example, the Global Positioning System (GPS) or the BeiDou Navigation Satellite System are not limited to this.
[0050] In one embodiment, the aforementioned meteorological server is used to acquire local weather information from meteorological sensors across the country and publish it externally. The meteorological sensors include, but are not limited to, one or more sensors such as anemometers, wind vanes, rain gauges, hygrometers, and barometers. Each meteorological sensor, after collecting local weather information, can send the weather information and the corresponding area range to the meteorological server. Based on this, the meteorological server can determine the corresponding weather information for the following day based on the current location information included in the weather information request and send it to the vehicle.
[0051] S205. The first and second weather information are determined as the current weather information.
[0052] In one embodiment, the vehicle can determine both the first weather information and the second weather information as the current weather information.
[0053] It should be noted that the first weather information obtained by processing the first image using a weather recognition model is more real-time than the second weather information obtained directly through internet functions or steps S202-S204 described above. Furthermore, the second weather information obtained through internet functions or steps S202-S204 described above has higher accuracy than the first weather information obtained by processing the first image using a weather recognition model.
[0054] Based on this, in this embodiment, the first weather information and the second weather information are obtained by combining two methods, namely weather recognition model and meteorological server, respectively. This allows for the determination of the current weather information from multiple dimensions, making the obtained current weather information accurate and real-time.
[0055] In one embodiment, after determining the current weather information, the vehicle can determine a first target probability corresponding to the current weather information based on the pre-set correlation between each type of weather information and a preset probability. For example, the first target probability corresponding to the current weather information of light rain is usually less than the first target probability corresponding to the weather information of moderate or heavy rain.
[0056] In this embodiment, as described in S201-S205 above, the current weather information includes first weather information and second weather information. Based on this, when determining the first target probability, the vehicle can determine the first probability corresponding to the first weather information and the second probability corresponding to the second weather information according to the correlation between preset weather information and preset probabilities. Then, the average of the first probability and the second probability is determined as the first target probability.
[0057] At this point, the aforementioned first target probability can be used to comprehensively characterize the probability that the camera has stains under the current weather information.
[0058] S103. Obtain historical weather information at historical times, and determine the probability that the camera has a second target with stains at historical times based on the historical weather information.
[0059] In one embodiment, the aforementioned historical weather information is weather information obtained by processing a second image acquired by the vehicle at a historical time. The method of obtaining the historical weather information and the second target probability is similar to that of obtaining the current weather information and the first target probability in step S102 above, and will not be described further.
[0060] S104. Determine the first sharpness of the first image and the second sharpness of the second image.
[0061] In one embodiment, the aforementioned sharpness is used to characterize the clarity of the displayed image. Typically, a vehicle can detect the edge contours of objects (people, items, animals, or plants, etc.) in an image and determine the sharpness of the edge contours as the image sharpness. Alternatively, the vehicle can also zoom in on the image, detect texture details in the image, and determine the richness of texture details as the image sharpness; there is no limitation on this.
[0062] It is understandable that when the camera is dirty, the edge information detected from the image is usually less and the pixel value is lower; and when the camera is clean, the edge information detected from the image is usually more and the pixel value is relatively higher.
[0063] In this embodiment, the vehicle can acquire the grayscale value of each pixel in the first image; then, it calculates the average grayscale value of all pixels in the first image and determines the average grayscale value as the first sharpness.
[0064] In one embodiment, grayscale value refers to the pixel value in an image captured by a monochrome camera, ranging from 0 to 255, a total of 256 levels. Typically, the first and second images captured by the camera are color images, and the color of each pixel in both images is composed of the three primary colors: red, green, and blue (R, G, B). Therefore, the grayscale value of each pixel can also be calculated based on its RGB values.
[0065] Specifically, the vehicle can calculate the grayscale value of each pixel based on the following formula:
[0066] Gray = R * 0.3 + G * 0.59 + B * 0.11;
[0067] Where Gray represents the grayscale value; R, G, and B represent the red, green, and blue pixel values of the pixel, respectively.
[0068] In other embodiments, the vehicle may also determine the grayscale value of each pixel using methods such as averaging or taking only the green color value as the grayscale value; there is no limitation on this.
[0069] In one embodiment, after determining the grayscale values of all pixels, the vehicle can calculate the average pixel value of all pixels to obtain the mean grayscale value. This mean grayscale value is then determined as the first sharpness.
[0070] It should be added that, in order to avoid the calculated first resolution being too large, the grayscale values can be normalized after obtaining the grayscale values of each pixel in the first image.
[0071] The calculation of the second image's second sharpness is similar to the calculation of the first sharpness, and will not be explained further.
[0072] S105. Determine the stain recognition result of the camera based on the first resolution, the second resolution, the first target probability, and the second target probability.
[0073] In one embodiment, the stain identification result is either that the camera has stains or that the camera does not have stains. Specifically, the vehicle can, for example, Figure 3 Steps S301-S303, as shown, determine the stain identification results, detailed below:
[0074] S301. Determine the target sharpness difference between the first image and the second image based on the first sharpness, the second sharpness, the first target probability, and the second target probability.
[0075] In one embodiment, after obtaining the first sharpness, the second sharpness, the first target probability, and the second target probability, the vehicle can calculate the first product of the first sharpness and the first target probability, and the second product of the second sharpness and the second target probability. Finally, the difference between the first product and the second product is determined as the target sharpness difference.
[0076] Specifically, the vehicle can calculate the target sharpness difference using the following formula:
[0077] H = W j-1 *H j-1 -W j *H j
[0078] Where H is the target sharpness difference; j is the first image, W j H represents the probability of the first target in the first image; j j-1 represents the first image's resolution; j-1 represents the second image, W j-1H represents the probability of the second target in the second image; j-1 This represents the second level of clarity for the second image.
[0079] In another embodiment, the vehicle can directly use the difference between the first sharpness and the second sharpness as the target sharpness difference to reduce the vehicle's computational load. However, the purpose of using the target sharpness calculated in step S301 above is to ensure that the vehicle considers the impact of weather on the camera when taking pictures, thereby improving the accuracy of the final calculated target sharpness difference.
[0080] S302. If the difference in target clarity is greater than the preset difference, then the stain recognition result is determined to be that there is a stain in the camera.
[0081] S303. If the difference in target clarity is less than or equal to the preset difference, the stain recognition result is determined to be that there is no stain in the camera.
[0082] In one embodiment, the preset difference value can be set according to actual conditions and is not limited thereto. For example, the preset difference value can be 0.34. When the target sharpness difference value is greater than the preset difference value, the vehicle can determine that the stain recognition result indicates that there is a stain on the camera. And, when the target sharpness difference value is less than or equal to the preset difference value, the vehicle can determine that the stain recognition result indicates that there is no stain on the camera.
[0083] In this embodiment, the vehicle first acquires a first image captured by the camera at the current moment and a second image captured at a historical moment. Then, it acquires the current weather information and determines a first probability that the camera has stains under the current weather conditions. It also acquires historical weather information and determines a second probability that the camera has stains under the historical weather conditions. Next, it determines a first level of sharpness in the first image and a second level of sharpness in the second image to determine the stain recognition result of the camera based on the first and second levels of sharpness. Therefore, when determining whether the camera has stains, the judgment is not only based on the sharpness between the two frames but also incorporates the weather information at the time the two frames were acquired, thus accurately obtaining the stain recognition result.
[0084] In another embodiment, if dirt is detected on the camera while the vehicle is in motion, the dirt usually cannot be removed in a timely manner. Otherwise, it not only threatens driving safety, but also makes it difficult to clean dirt that has remained for a longer period of time.
[0085] Therefore, in order to promptly clean the camera and ensure driving safety, the vehicle can obtain its speed when the dirt detection result indicates that the camera is dirty. Then, when the speed is less than or equal to a preset speed, a preset dirt removal device is activated to clean the camera. When the speed exceeds the preset speed, a dirt warning command is generated to remind the driver to slow down.
[0086] In one embodiment, the aforementioned cleaning device can be pre-set by the vehicle owner. In this embodiment, there are no limitations on the working principle, structure, or location of the cleaning device.
[0087] The preset speed can be 60 km / s or other values; there are no restrictions. It should be noted that the cleaning device is most effective at cleaning the camera when the driving speed is less than or equal to the preset speed, compared to when the driving speed is greater than the preset speed.
[0088] Specifically, refer to Figure 4 and Figure 5 ,in, Figure 4 This is a schematic diagram illustrating an application scenario of a camera-based stain recognition method provided in an embodiment of this application, where the camera captures an image when stains are present. Figure 5 This is a schematic diagram illustrating an application scenario of a camera image captured after cleaning, according to an embodiment of the dirt recognition method for cameras provided in this application. (Comparison) Figure 4 and Figure 5 It can be seen that, Figure 5 The corresponding image has a much higher resolution than Figure 4 The corresponding image clarity.
[0089] In one embodiment, the aforementioned stain reminder instruction is used to remind the driver to slow down. The reminder method includes, but is not limited to, voice or horn.
[0090] Please see Figure 6 , Figure 6 This is a structural block diagram of a stain recognition device for a camera provided in an embodiment of this application. The stain recognition device for the camera in this embodiment includes modules for performing... Figures 1 to 3 The steps in the corresponding embodiments. Please refer to the details. Figures 1 to 3 as well as Figures 1 to 3 The relevant descriptions in the corresponding embodiments are shown below. For ease of explanation, only the parts relevant to this embodiment are shown. See also... Figure 6 The stain recognition device 600 for the camera may include: a first acquisition module 610, a second acquisition module 620, a third acquisition module 630, a first determination module 640, and a second determination module 650, wherein:
[0091] The first acquisition module 610 is used to acquire a first image captured by the camera at the current moment and a second image captured at a historical moment.
[0092] The second acquisition module 620 is used to acquire the current weather information at the current moment, and determine the probability that the camera has a first target with dirt at the current moment based on the current weather information.
[0093] The third acquisition module 630 is used to acquire historical weather information at historical times and determine the probability that the camera has a second target with stains at historical times based on the historical weather information.
[0094] The first determining module 640 is used to determine the first sharpness of the first image and the second sharpness of the second image.
[0095] The second determining module 650 is used to determine the stain recognition result of the camera based on the first resolution, the second resolution, the first target probability, and the second target probability.
[0096] In one embodiment, the second acquisition module 620 is further configured to:
[0097] The first image is processed according to a preset weather recognition model to obtain first weather information; the current location information of the vehicle is obtained; a weather information request containing the current location information is sent to a preset meteorological server; the second weather information returned by the meteorological server based on the weather information request is received; and the first weather information and the second weather information are determined as the current weather information.
[0098] In one embodiment, the second acquisition module 620 is further configured to:
[0099] Based on the correlation between preset weather information and preset probabilities, the first probability corresponding to the first weather information and the second probability corresponding to the second weather information are determined respectively; the average of the first probability and the second probability is determined as the first target probability.
[0100] In one embodiment, the first determining module 640 is further configured to:
[0101] Obtain the grayscale value of each pixel in the first image; calculate the average grayscale value of all pixels in the first image; determine the average grayscale value as the first sharpness.
[0102] In one embodiment, the second determining module 650 is further configured to:
[0103] Based on the first sharpness, the second sharpness, the first target probability, and the second target probability, the target sharpness difference between the first image and the second image is determined; if the target sharpness difference is greater than a preset difference, the stain recognition result is determined to be that there is a stain in the camera; if the target sharpness difference is less than or equal to the preset difference, the stain recognition result is determined to be that there is no stain in the camera.
[0104] In one embodiment, the second determining module 650 is further configured to:
[0105] Calculate the first product of the first sharpness and the first target probability; calculate the second product of the second sharpness and the second target probability; determine the difference between the first product and the second product as the target sharpness difference.
[0106] In one embodiment, the stain recognition device for the camera further includes:
[0107] The fourth acquisition module is used to acquire the vehicle's speed if the stain recognition result indicates that there is a stain in the camera.
[0108] The control module is used to control a preset cleaning device to perform a cleaning operation on the camera if the driving speed is less than or equal to a preset speed.
[0109] The reminder module generates a stain reminder command if the driving speed exceeds a preset speed; the stain reminder command is used to remind the driver to slow down.
[0110] When it is understood that, Figure 6 In the structural block diagram of the camera-based stain recognition device shown, each module is used to perform... Figures 1 to 3 The steps in the corresponding embodiments, and for Figures 1 to 3 The steps in the corresponding embodiments have been explained in detail in the above embodiments. Please refer to them for details. Figures 1 to 3 as well as Figures 1 to 3 The relevant descriptions in the corresponding embodiments will not be repeated here.
[0111] Figure 7 This is a structural block diagram of a vehicle provided in one embodiment of this application. For example... Figure 7 As shown, the vehicle 700 of this embodiment includes: a processor 710, a memory 720, and a computer program 730 stored in the memory 720 and executable by the processor 710, such as a program for a camera-based stain recognition method. When the processor 710 executes the computer program 730, it implements the steps of each embodiment of the aforementioned camera-based stain recognition method, for example... Figure 1 S101 to S104 are shown. Alternatively, the processor 710 implements the above when executing the computer program 730. Figure 5 The functions of each module in the corresponding embodiments, for example, Figure 5For details on the functions of modules 510 to 540 shown, please refer to [link / reference]. Figure 5 The relevant descriptions in the corresponding embodiments.
[0112] For example, the computer program 730 can be divided into one or more modules, one or more of which are stored in the memory 720 and executed by the processor 710 to implement the camera stain recognition method provided in this embodiment. One or more modules can be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program 730 in the vehicle 700. For example, the computer program 730 can implement the camera stain recognition method provided in this embodiment.
[0113] Vehicle 700 may include, but is not limited to, processor 710 and memory 720. Those skilled in the art will understand that... Figure 7 This is merely an example of vehicle 700 and does not constitute a limitation on vehicle 700. It may include more or fewer components than shown, or combine certain components, or different components. For example, a vehicle may also include input / output devices, network access devices, buses, etc.
[0114] The processor 710 may be a central processing unit, or it may be other general-purpose processors, digital signal processors, application-specific integrated circuits, off-the-shelf programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0115] The memory 720 can be an internal storage unit of the vehicle 700, such as a hard drive or memory of the vehicle 700. The memory 720 can also be an external storage device of the vehicle 700, such as a plug-in hard drive, smart memory card, flash memory card, etc., installed on the vehicle 700. Furthermore, the memory 720 can include both internal storage units and external storage devices of the vehicle 700.
[0116] This application provides a computer-readable storage medium, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the camera stain recognition method as described in the above embodiments.
[0117] This application provides a computer program product that, when run on a vehicle, causes the vehicle to execute the camera stain recognition method described in the above embodiments.
[0118] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for stain recognition using a camera, characterized in that, Applied to vehicles, the method includes: Acquire the first image captured by the camera at the current moment and the second image captured at a historical moment; Obtain the current weather information at the current moment, and determine the first target probability that the camera has stains at the current moment based on the current weather information; Obtain historical weather information at the historical moment, and determine the probability that the camera has a second target with stains at the historical moment based on the historical weather information; Determine the first sharpness of the first image and the second sharpness of the second image; The stain recognition result of the camera is determined based on the first resolution, the second resolution, the first target probability, and the second target probability; The step of determining the stain recognition result of the camera based on the first resolution, the second resolution, the first target probability, and the second target probability includes: The target sharpness difference between the first image and the second image is determined based on the first sharpness, the second sharpness, the first target probability, and the second target probability. If the difference in target sharpness is greater than a preset difference, then the stain recognition result is determined to be that there is a stain in the camera; If the difference in target clarity is less than or equal to a preset difference, then the stain recognition result is determined to be that the camera does not have any stains. The step of determining the target sharpness difference between the first image and the second image based on the first sharpness, the second sharpness, the first target probability, and the second target probability includes: Calculate the first product of the first sharpness and the first target probability; Calculate the second product of the second sharpness and the second target probability; The difference between the first product and the second product is determined as the target sharpness difference.
2. The method according to claim 1, characterized in that, The step of obtaining the current weather information at the current moment includes: The first image is processed according to a preset weather recognition model to obtain the first weather information; Obtain the current location information of the vehicle; send a weather information request containing the current location information to a preset weather server; receive second weather information returned by the weather server based on the weather information request; The first weather information and the second weather information are determined as the current weather information.
3. The method according to claim 2, characterized in that, Determining the probability that the camera has a first target with stains at the current time based on the current weather information includes: Based on the correlation between preset weather information and preset probabilities, the first probability corresponding to the first weather information and the second probability corresponding to the second weather information are determined respectively. The average of the first probability and the second probability is determined as the first target probability.
4. The method according to claim 1, characterized in that, Determining the first sharpness of the first image includes: Obtain the grayscale value of each pixel in the first image; Calculate the average grayscale value of all pixels in the first image; The average grayscale value is determined as the first sharpness.
5. The method according to any one of claims 1-4, characterized in that, After determining the stain recognition result of the camera based on the first resolution, the second resolution, the first target probability, and the second target probability, the method further includes: If the stain recognition result indicates that there is a stain on the camera, then the vehicle's driving speed is obtained; If the driving speed is less than or equal to the preset speed, the preset cleaning device is controlled to perform a cleaning operation on the camera. If the driving speed is greater than the preset speed, a stain reminder instruction is generated; the stain reminder instruction is used to remind the driver to slow down.
6. A stain recognition device for a camera, characterized in that, Applied to vehicles, the device includes: The first acquisition module is used to acquire the first image captured by the camera at the current moment and the second image captured at a historical moment; The second acquisition module is used to acquire the current weather information at the current moment, and determine the probability of a first target with dirt on the camera at the current moment based on the current weather information; The third acquisition module is used to acquire historical weather information at the historical time and determine the probability that the camera has a second target with stains at the historical time based on the historical weather information. The first determining module is used to determine the first sharpness of the first image and the second sharpness of the second image; The second determining module is used to determine the stain recognition result of the camera based on the first clarity, the second clarity, the first target probability, and the second target probability; The second determining module is also used for: The target sharpness difference between the first image and the second image is determined based on the first sharpness, the second sharpness, the first target probability, and the second target probability. If the difference in target sharpness is greater than a preset difference, then the stain recognition result is determined to be that there is a stain in the camera; If the difference in target clarity is less than or equal to a preset difference, then the stain recognition result is determined to be that the camera does not have any stains. The second determining module is also used for: Calculate the first product of the first sharpness and the first target probability; Calculate the second product of the second sharpness and the second target probability; The difference between the first product and the second product is determined as the target sharpness difference.
7. A vehicle comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 5.