Image fogging judgment method, device, electronic device and storage medium
By detecting the clarity and grayscale distribution of the surveillance camera screen, the problems of increasing hardware equipment, high cost and low detection accuracy in the prior art are solved, and efficient and accurate judgment of image fogging is achieved.
Patent Information
- Application Number
- CN202110700044.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-23
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2041-06-23
AI Technical Summary
In the prior art, fogging detection of surveillance camera screen requires adding hardware equipment, which is costly and has low detection accuracy.
By acquiring the clarity and grayscale distribution of the image to be detected, if the clarity is lower than the preset threshold and the grayscale distribution does not match the preset situation, it is judged that the image is fogged. This method does not require adding hardware devices, but only detects through image processing.
Accurate detection of fogging on camera screens is achieved, reducing costs and improving detection accuracy.
Smart Images

Figure CN113554596B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for determining image fogging. Background Art
[0002] The fogging of surveillance camera screen will cause a lot of important information to be lost. Therefore, it is necessary to detect and defog the screen in time when fogging occurs. There are usually two reasons that cause the camera screen to fog: one is fogging of the device itself, and the other is fogging of the external environment:
[0003] (1) There is a temperature difference between the inside and outside of the camera, and there is a certain amount of humidity in the air, which can easily cause fogging on the camera lens or glass cover, resulting in obvious fog in the picture. At this time, the depth of field of the picture will deteriorate, and the environmental information will be obviously lost;
[0004] (2) The external environment is foggy, resulting in obvious fog in the picture.
[0005] In order to detect whether the device is fogging, the current common practice is to integrate temperature and humidity sensors inside the camera, and use the results obtained from hardware detection to determine whether the camera may be fogged. However, this method requires additional hardware equipment, which is costly and has low detection accuracy.
[0006] There is no effective solution to the problem that fogging detection in related technologies requires additional hardware equipment, is costly, and has low detection accuracy. Summary of the invention
[0007] In this embodiment, a method, device, electronic device and storage medium for determining fogging in an image are provided to solve the problem in the related art that fogging detection requires additional hardware equipment, is costly and has low detection accuracy.
[0008] In a first aspect, a method for determining image fogging is provided in this embodiment, including:
[0009] Acquire an image to be detected, where the image to be detected is captured by a camera to be detected;
[0010] Obtaining the clarity and grayscale distribution of the image to be detected;
[0011] If the clarity is lower than a preset clarity threshold and the grayscale distribution does not match a preset grayscale distribution, it is determined that the image to be detected is fogged.
[0012] In some embodiments, obtaining the grayscale distribution of the image to be detected includes:
[0013] Acquire a grayscale histogram based on the image to be detected;
[0014] The grayscale distribution of the image to be detected is obtained based on the grayscale histogram.
[0015] In some embodiments, if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match a preset grayscale distribution, determining that the image to be detected is fogged includes:
[0016] If the clarity is lower than a preset clarity threshold, and the proportion of the dark area of the grayscale histogram is lower than a preset proportion threshold, it is determined that the image to be detected is fogged.
[0017] In some embodiments, after determining whether the image to be detected is fogged, the method further includes:
[0018] Generate defogging instructions and control the defogging module to perform defogging.
[0019] In some embodiments, generating a defogging instruction and controlling a defogging module to perform defogging includes:
[0020] Generate a defogging instruction to control the hardware defogging module to perform physical defogging, wherein the physical defogging includes heating and ventilation;
[0021] After a preset time, a first defogging detection image is acquired, and the image fogging condition is determined based on the first defogging detection image.
[0022] In some embodiments, the determining the image fogging condition based on the first defogging detection image includes:
[0023] If the first defogging detection image still has fogging, a defogging algorithm is used to defog the first defogging detection image.
[0024] In some embodiments, if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match a preset grayscale distribution, determining that the image to be detected is fogged includes:
[0025] If the clarity of the image to be detected for a continuous preset number of frames is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, it is determined that the image to be detected is fogged.
[0026] In a second aspect, in this embodiment, a device for determining fogging of an image is provided, comprising:
[0027] An image acquisition module is used to acquire an image to be detected, wherein the image to be detected is captured by a camera to be detected;
[0028] An image parameter acquisition module, used to acquire the clarity and grayscale distribution of the image to be detected;
[0029] The judgment module is used to judge whether the image to be detected is fogged if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match a preset grayscale distribution.
[0030] In a third aspect, an electronic device is provided in this embodiment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image fogging judgment method described in the first aspect when executing the computer program.
[0031] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored, and when the program is executed by a processor, the image fogging judgment method described in the first aspect is implemented.
[0032] Compared with the related art, the image fogging judgment method, device, electronic device and storage medium provided in this embodiment obtain an image to be detected, which is taken by a camera to be detected; obtain the clarity and grayscale distribution of the image to be detected; if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, then the way to judge whether the image to be detected is fogged is to detect the picture taken by the camera to determine whether it is fogged, without adding hardware equipment, and the cost is low, and a comprehensive judgment is made in combination with the clarity and grayscale distribution, and the judgment accuracy is high.
[0033] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0035] Figure 1 is a hardware structure block diagram of a terminal of an image fogging determination method according to an embodiment of the present invention;
[0036] Figure 2 1 is a flow chart of a method for determining image fogging according to an embodiment of the present invention;
[0037] Figure 3 is a flow chart of a method for determining image fogging according to another embodiment of the present invention;
[0038] Figure 4 It is a structural block diagram of an image fogging judgment device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0040] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0041] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 FIG. 1 is a hardware structure diagram of a terminal of the method for determining fogging of an image in this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 and memory 104 for storing data, wherein processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0042] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the image fogging judgment method in the present embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0043] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by the communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0044] In this embodiment, a method for determining image fogging is provided. Figure 2 FIG. 1 is a flow chart of the method for determining image fogging in this embodiment. Figure 2 As shown, the process includes the following steps:
[0045] Step S201, obtaining an image to be detected, where the image to be detected is captured by a camera to be detected.
[0046] It is understandable that the camera to be detected is the camera that needs to be tested for fogging. The camera captures real-time images. By detecting the parameters of the captured real-time images, it can be determined whether there is fog at this time. It is understandable that image fogging means that there is obvious fog in the image acquired by the camera, including fogging of the camera itself or environmental fogging. The fogging of the camera itself means that there is a temperature difference between the inside and outside of the camera, and there is a certain humidity in the air, which is easy to fog on the camera lens or glass cover, resulting in obvious fog in the image; environmental fogging means that the natural phenomenon of fogging occurs in the external environment, resulting in obvious fog in the image. In other embodiments, there may be other reasons that cause obvious fog in the image acquired by the camera, which are not specifically limited here.
[0047] Step S202, obtaining the clarity and grayscale distribution of the image to be detected.
[0048] For example, when an image is fogged, the image clarity of the same shooting scene will be significantly reduced, and the grayscale distribution will be significantly different from that of normal shooting. Therefore, by testing these two parameters, it is possible to determine whether the image is fogged. It is understandable that if fogging is judged only from the perspective of clarity, it is easy to cause misjudgment. For example, if a large-area flat object appears in the picture, it will also cause a significant decrease in clarity, but at this time it cannot be considered that the camera is fogged; therefore, the grayscale distribution is introduced, and a comprehensive judgment is made based on the changes in clarity and grayscale distribution to improve the accuracy of fogging judgment.
[0049] Grayscale value refers to the color value of each object when grayscale objects are converted to RGB. The logarithmic relationship between white and black is divided into several levels, called "grayscale levels". The range is generally from 0 to 255, with white being 255 and black being 0, so black and white images are also called grayscale images, which are widely used in the fields of medicine and image recognition. Grayscale distribution refers to the distribution of grayscale values of grayscale images, reflecting the most basic statistical characteristics of the image.
[0050] Step S203: If the clarity is lower than the preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, it is determined that the image to be detected is fogged.
[0051] In this embodiment, the preset clarity threshold is obtained based on historical data or experience. When the image clarity is lower than the preset clarity threshold, it indicates that the image condition is abnormal and fogging may occur. The preset grayscale distribution is the grayscale distribution when the image is not fogged. If the grayscale distribution of the image to be detected does not match the preset condition, it indicates that the image condition is abnormal and fogging may occur. It can be understood that the preset grayscale distribution can be one or more. If the detection requirement is to determine whether the image is normal or foggy, the preset grayscale distribution can be the grayscale distribution when there is no abnormal condition in the image; if the detection requirement is to avoid other abnormal conditions affecting the judgment of whether fogging occurs or not, the preset grayscale distribution can also be the grayscale distribution when other abnormal conditions exist in the image. Therefore, the preset grayscale distribution can be set according to the actual detection requirements, and no specific limitation is made here.
[0052] The above-mentioned image fogging judgment method obtains the image to be detected, which is captured by the camera to be detected; obtains the clarity and grayscale distribution of the image to be detected; if the clarity is lower than the preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, then the way to judge whether the image to be detected is fogged is to detect the picture captured by the camera to determine whether it is fogged, without adding hardware equipment, and the cost is low. In addition, a comprehensive judgment is made based on the clarity and grayscale distribution, and the judgment accuracy is high.
[0053] In another embodiment, obtaining the grayscale distribution of the image to be detected includes the following steps:
[0054] Step 1, obtaining a grayscale histogram based on the image to be detected;
[0055] Step 2: Obtain the grayscale distribution of the image to be detected based on the grayscale histogram.
[0056] Grayscale histogram is a function of grayscale distribution and a statistic of grayscale distribution in an image. Grayscale histogram counts the frequency of occurrence of all pixels in a digital image according to the size of the grayscale value. Grayscale histogram is a function of grayscale, which indicates the number of pixels with a certain grayscale in the image and reflects the frequency of occurrence of a certain grayscale in the image. If the total pixel brightness (grayscale level) of an image is regarded as a random variable, its distribution reflects the statistical characteristics of the image.
[0057] It is understandable that in other embodiments, other statistical methods may be used to obtain the grayscale distribution, which is not specifically limited here.
[0058] The above embodiment obtains the grayscale distribution of the image to be detected through the grayscale histogram, which is more intuitive and has better statistical effect.
[0059] In another embodiment, if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, determining whether the image to be detected is fogged includes the following steps:
[0060] If the clarity is lower than a preset clarity threshold and the proportion of the dark area of the grayscale histogram is lower than a preset proportion threshold, it is determined that the image to be detected is fogged.
[0061] Exemplarily, the image to be detected is judged to be fogged only when both the clarity and the grayscale distribution do not meet the preset conditions. If either of them meets the preset conditions, the image to be detected is not considered to be fogged.
[0062] In this embodiment, the grayscale distribution is determined by judging the proportion of dark areas in the grayscale histogram to determine whether it conforms to the preset grayscale distribution. It is understandable that when the image is fogged, the grayscale histogram of the image will shift to the right significantly, that is, the proportion of dark areas is significantly reduced, and more pixels are accumulated in the middle grayscale area and bright area of the histogram. Therefore, it is possible to judge whether the image is fogged based on the proportion of dark areas, and set a preset proportion threshold based on historical data or experience. When the proportion of dark areas in the grayscale histogram of the image to be detected is lower than the preset proportion threshold, it can be considered that the image condition is abnormal and fogging may occur.
[0063] In other embodiments, if there is a large area of monochrome object in the picture, the automatic exposure will adjust the overall brightness to the preset value, the histogram will be piled up in the middle gray area, the dark area and the bright area will be reduced at the same time, and the proportion of dark area will also become smaller, which is easy to cause confusion. Therefore, in order to avoid confusion, the proportion of bright area can be determined after the proportion of dark area is significantly reduced. If the proportion of dark area is reduced due to image fogging, the proportion of bright area will increase. If the proportion of dark area is reduced due to the presence of a large area of monochrome object, the proportion of bright area will also decrease. This method can be used to eliminate the interference of large area of monochrome object.
[0064] In other embodiments, the grayscale distribution may be determined by using a corresponding determination method according to the need to avoid other interference situations, which will not be described in detail here.
[0065] In another embodiment, after determining whether the image to be detected is fogged, the following steps are further included:
[0066] Generate defogging instructions and control the defogging module to perform defogging.
[0067] It is understandable that fogging of the surveillance camera image will cause a lot of important information to be lost. Therefore, after determining that the image to be detected is fogged, defogging processing is required.
[0068] In another embodiment, generating a defogging instruction and controlling the defogging module to perform defogging includes the following steps:
[0069] Step 1, generating a defogging instruction to control the hardware defogging module to perform physical defogging, which includes heating and ventilation;
[0070] Step 2: After a preset time, a first defogging detection image is obtained, and the image fogging condition is determined based on the first defogging detection image.
[0071] In this embodiment, when it is determined that the image is fogged, physical defogging is first performed by controlling the hardware defogging module, that is, heating, ventilation and other operations are performed to defog the camera components such as the camera cover and lens. If the image fogging is caused by fogging on the camera component, then after physical defogging, the image will gradually return to normal, and the image clarity and grayscale distribution will also meet the preset conditions after a period of time. Therefore, after the physical defogging continues for a preset time, the real-time image is acquired again, and the image fogging is judged based on the real-time image. If the image no longer has fogging, it means that the image fogging is caused by fogging on the camera component, and this abnormality has been eliminated after physical defogging; if the judgment result still shows fogging, it means that the image fogging is not caused by fogging on the camera component.
[0072] In the above embodiment, a physical defogging method is first used, and the image fogging condition is detected again after a preset time to determine the effect of the physical defogging. If the effect is not good, it can be discovered in time and other methods can be used for defogging to achieve better defogging effect.
[0073] In another embodiment, the method of determining the fogging condition of an image based on the first defogging detection image includes the following steps:
[0074] If the first defogging detection image still has fogging, a defogging algorithm is used to defog the first defogging detection image.
[0075] Exemplarily, if the first defogging detection image still has fogging, it means that the image fogging is not caused by fogging on the camera component, and it can be considered that the external environment is fogging, which causes the image fogging. At this time, the natural phenomenon of the external environment cannot be changed. Therefore, the software defogging method can be used, that is, the transparency of the image obtained by camera shooting is increased to reduce the impact of environmental fogging on the image quality. It can be understood that software defogging is to process the image through an image processing algorithm to reduce the impact of fogging on the image quality. The software defogging method includes a defogging method based on prior knowledge, mainly including a dark channel prior (Dark Channel Prior, DCP) method, a maximum contrast (Maximum Contrast, MC) method, a color attenuation prior (Color Attenuation Prior, CAP) method, a chromaticity inconsistency method, etc.; a neural network can also be used for defogging, for example, based on an atmospheric degradation model, a neural network is used to estimate the parameters in the model, or an input foggy image is used to directly output the defogging image. In other embodiments, other image processing methods can be used for defogging, which is not specifically limited here.
[0076] Exemplarily, the software defogging module is usually placed in the YUV domain of the ISP PipeLine. The degree of absence of the dark area of the RAW domain histogram can be used to determine the intensity of the software defogging module to turn on the defogging, and then the effect of the digital defogging module after processing can be determined through the histogram of the YUV domain, forming a negative feedback system. It can be understood that the intensity of the software defogging is determined according to the degree to which the clarity and grayscale distribution of the image to be detected deviate from the preset situation. Specifically, the more serious the deviation of the clarity and grayscale distribution of the image to be detected from the preset situation, the greater the impact of fogging on the image quality, and the intensity of the software defogging needs to be increased accordingly. At the same time, the clarity and grayscale distribution of the image to be detected during the defogging process are detected in real time, and the intensity of the software defogging is adjusted based on the real-time changes in the clarity and grayscale distribution. For example, if the clarity and grayscale distribution of high-intensity software defogging are significantly biased towards the preset situation after a period of time, the intensity of the software defogging can be reduced; if the clarity and grayscale distribution of medium-intensity software defogging are not significantly changed after a period of time, the intensity of the software defogging can be increased. In other embodiments, the adjustment method of the software defog intensity can be set according to actual needs and is not specifically limited here.
[0077] In another embodiment, if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, determining whether the image to be detected is fogged includes the following steps:
[0078] If the clarity of the image to be detected for a continuous preset number of frames is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, it is determined that the image to be detected is fogged.
[0079] It is understandable that the image to be detected can be a single-frame image or multiple-frame images. If only the clarity and grayscale distribution of a single-frame image are detected, misjudgment may occur. In this embodiment, the clarity and grayscale distribution of the image to be detected for a continuous preset number of frames are detected, and the image is judged to be fogged only when the clarity of the image to be detected for a continuous preset number of frames is lower than the preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution. The judgment accuracy is higher. In other embodiments, the specific selection of several frames of images for detection can be selected according to the actual situation, and no specific limitation is made here.
[0080] See also Figure 3 , Figure 3The flowchart of the method for judging the fogging of an image according to another embodiment of the present invention is shown in FIG. In this embodiment, the clarity of the image to be detected is first obtained. If the clarity of the image decreases but does not decrease below the preset clarity threshold, no adjustment is made and the system works normally. If the clarity of the image decreases below the preset clarity, the grayscale histogram of the image to be detected is obtained, and the grayscale distribution is obtained according to the grayscale histogram to determine whether it does not match the preset grayscale distribution. Specifically, it is determined whether the proportion of the dark area of the grayscale histogram is lower than the preset proportion threshold. If it is not lower than the preset proportion threshold, no adjustment is made and the system works normally. If the proportion of the dark area of the grayscale histogram is lower than the preset proportion threshold, the image to be detected is judged to be fogged, and the hardware defogging module is first controlled to perform physical defogging, that is, the optical system in the camera is heated and ventilated. During the physical defogging process, real-time detection is performed. The clarity and grayscale distribution of the image to be detected change. If, after a period of time, the clarity and grayscale distribution of the image to be detected show obvious improvement, physical defogging will continue until the clarity and grayscale distribution of the image to be detected meet the preset conditions, and it is judged that the image to be detected has completed defogging; if, after a period of time, the clarity and grayscale distribution of the image to be detected do not show obvious improvement, the software defogging module is controlled to perform defogging, that is, the image is processed through the image processing algorithm to reduce the impact of fogging on the image quality, and the intensity of the software defogging is adjusted according to the degree to which the clarity and grayscale distribution of the image to be detected deviate from the preset conditions, and the defogging effect is detected in real time to determine whether the image to be detected has completed defogging.
[0081] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0082] In this embodiment, a device for determining fogging of an image is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been given will not be repeated. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation in hardware, or a combination of software and hardware, is also possible and conceivable.
[0083] Figure 4 is a structural block diagram of the image fogging judgment device of this embodiment. Figure 4 As shown, the device comprises:
[0084] The image acquisition module 40 is used to acquire the image to be detected. The image to be detected is obtained by photographing the camera to be detected.
[0085] The image parameter acquisition module 50 is used to obtain the clarity and grayscale distribution of the image to be detected.
[0086] The image parameter acquisition module is also used to:
[0087] Obtaining a grayscale histogram based on the image to be detected;
[0088] The grayscale distribution of the image to be detected is obtained based on the grayscale histogram.
[0089] The judgment module 60 is used to judge whether the image to be detected is fogged if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution.
[0090] The judgment module 60 is further configured to judge whether the image to be detected is fogged if the clarity is lower than a preset clarity threshold and the proportion of the dark area in the grayscale histogram is lower than a preset proportion threshold.
[0091] The judgment module 60 is further configured to judge that the image to be detected is fogged if the clarity of the image to be detected for a continuous preset number of frames is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution.
[0092] The image fogging judgment device also includes: a defogging control module.
[0093] The defogging control module is used to generate defogging instructions and control the defogging module to perform defogging.
[0094] The defogging control module is also used for:
[0095] Generate defogging instructions to control the hardware defogging module to perform physical defogging, which includes heating and ventilation;
[0096] After a preset time, a first defogging detection image is acquired, and the image fogging condition is determined based on the first defogging detection image.
[0097] The defogging control module is further used to use a defogging algorithm to defog the first defogging detection image if the first defogging detection image still has fogging.
[0098] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0099] In this embodiment, an electronic device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0100] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0101] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0102] S1, obtaining an image to be detected, where the image to be detected is captured by a camera to be detected.
[0103] S2, obtaining the clarity and grayscale distribution of the image to be detected.
[0104] S3: If the clarity is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, it is determined that the image to be detected is fogged.
[0105] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.
[0106] In addition, in combination with the image fogging determination method provided in the above embodiments, a storage medium may be provided in this embodiment to implement the method. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the image fogging determination methods in the above embodiments is implemented.
[0107] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.
[0108] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.
[0109] The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various locations in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.
[0110] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the scope of protection of the present application. Therefore, the scope of protection of the present application shall be subject to the attached claims.
Claims
1. A method for determining image fogging, characterized in that: include: Acquire an image to be detected, where the image to be detected is captured by a camera to be detected; Obtaining the clarity and grayscale distribution of the image to be detected; The step of obtaining the grayscale distribution of the image to be detected includes: obtaining a grayscale histogram based on the image to be detected; obtaining the grayscale distribution of the image to be detected based on the grayscale histogram; judging the dark area ratio and the bright area ratio of the grayscale histogram to judge whether the grayscale distribution conforms to the preset grayscale distribution; after judging that the dark area ratio is reduced, judging whether the bright area ratio is reduced; if the dark area and the bright area are reduced at the same time, there is a large-area monochrome object; If the clarity is lower than a preset clarity threshold and the grayscale distribution does not match a preset grayscale distribution, then it is determined that the image to be detected is fogged; Generate a defogging instruction and control the defogging module to perform defogging; the generating of the defogging instruction and controlling the defogging module to perform defogging includes: generating a defogging instruction and controlling the hardware defogging module to perform physical defogging, wherein the physical defogging includes heating and ventilation; after a preset time, obtain a first defogging detection image, and judge the image fogging condition based on the first defogging detection image.
2. The image fogging judgment method according to claim 1, characterized in that: If the clarity is lower than a preset clarity threshold and the grayscale distribution does not match a preset grayscale distribution, determining that the image to be detected is fogged includes: If the clarity is lower than a preset clarity threshold, and the proportion of the dark area of the grayscale histogram is lower than a preset proportion threshold, it is determined that the image to be detected is fogged.
3. The image fogging determination method according to claim 1, characterized in that: The step of determining the fogging condition of the image based on the first defogging detection image includes: If the first defogging detection image still has fogging, a defogging algorithm is used to defog the first defogging detection image.
4. The image fogging determination method according to claim 1, characterized in that: If the clarity is lower than a preset clarity threshold and the grayscale distribution does not match a preset grayscale distribution, determining that the image to be detected is fogged includes: If the clarity of the image to be detected for a continuous preset number of frames is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, it is determined that the image to be detected is fogged.
5. An image fogging judgment device, characterized in that: include: An image acquisition module is used to acquire an image to be detected, wherein the image to be detected is captured by a camera to be detected; An image parameter acquisition module, used to acquire the clarity and grayscale distribution of the image to be detected; The step of obtaining the grayscale distribution of the image to be detected includes: obtaining a grayscale histogram based on the image to be detected; The grayscale distribution of the image to be detected is obtained based on the grayscale histogram, and after determining that the proportion of the dark area is reduced, whether the proportion of the bright area is reduced is determined. If the dark area and the bright area are reduced at the same time, a large-area monochrome object exists; A judgment module, used to judge whether the grayscale distribution conforms to a preset grayscale distribution by judging the dark area ratio and the bright area ratio of the grayscale histogram; if the clarity is lower than a preset clarity threshold and the grayscale distribution does not match the preset grayscale distribution, then it is judged that the image to be detected is fogged; The defogging control module is used to generate defogging instructions and control the defogging module to perform defogging. The defogging control module is also used to generate defogging instructions and control the hardware defogging module to perform physical defogging, and physical defogging includes heating and ventilation. After a preset time, a first defogging detection image is obtained, and the image fogging condition is judged based on the first defogging detection image.
6. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the image fogging determination method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the image fogging determination method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Electronic equipment
CN104123700A
Self-adaptive image defogging method based on resolution evaluation
CN107767353A