CN115393330A - Camera image blur detection method and device, computer equipment and storage medium - Google Patents

Camera image blur detection method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115393330A
CN115393330A CN202211046744.8A CN202211046744A CN115393330A CN 115393330 A CN115393330 A CN 115393330A CN 202211046744 A CN202211046744 A CN 202211046744A CN 115393330 A CN115393330 A CN 115393330A
Authority
CN
China
Prior art keywords
image
variance
gray
camera
blurred
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211046744.8A
Other languages
Chinese (zh)
Inventor
陈斌
卫宣安
吴闽华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zhenyou Software Technology Co ltd
Original Assignee
Shenzhen Zhenyou Software Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Zhenyou Software Technology Co ltd filed Critical Shenzhen Zhenyou Software Technology Co ltd
Priority to CN202211046744.8A priority Critical patent/CN115393330A/en
Publication of CN115393330A publication Critical patent/CN115393330A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/73Deblurring; Sharpening
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a camera image blur detection method, a camera image blur detection device, computer equipment and a storage medium, wherein the method comprises the following steps: carrying out gray level processing on a color source image shot by a camera to convert the color source image into a gray level image; filtering the gray level image subjected to variance and mean calculation to obtain a first blurred image; calculating the variance and the mean value of the first blurred image, and preliminarily judging that the gray image is a blurred image when the difference value between the variance of the gray image and the variance of the first blurred image is in a first preset interval; carrying out dark channel prior deblurring on the gray level image which is judged to be blurred to obtain a deblurred image; comparing the variance of the gray scale map to the variance of the deblurred image; and when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval, judging that the color source image shot by the camera is a blurred image. The camera image blur detection method can quickly detect the camera with abnormal working state, thereby greatly improving the working efficiency.

Description

Camera image blur detection method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for detecting blur of a camera image, a computer device, and a storage medium.
Background
With the development of science and technology and the continuous improvement of the living standard of people, the use of the camera is more and more popular.
With the development of smart city services, video services cannot be limited to the function of video monitoring, and new functions need to be developed in combination with market needs, such as: analyzing the content captured by the camera by using an image processing technology, and further finding out the camera with abnormal working state; there is no good way to find out the camera with abnormal working state in the prior art.
Thus, there is still a need for improvement and development of the prior art.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a method and an apparatus for detecting blur of camera image, a computer device and a storage medium, which can detect a camera with abnormal working state quickly and greatly improve the working efficiency.
The technical scheme adopted by the invention for solving the problems is as follows:
a camera image blur detection method, wherein the method comprises the following steps:
acquiring a color source image shot by a camera;
carrying out gray processing on the color source image to convert the color source image into a gray image;
calculating the variance and the mean of the gray level image, and filtering the gray level image subjected to the variance and mean calculation to obtain a first blurred image;
calculating the variance and the mean value of the first blurred image, and preliminarily judging that the gray image is a blurred image when the difference value between the variance of the gray image and the variance of the first blurred image is in a first preset interval;
carrying out dark channel prior deblurring on the gray level image which is judged to be blurred to obtain a deblurred image;
calculating a variance of the deblurred image and comparing the variance of the gray scale map with the variance of the deblurred image;
and when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval, judging that the color source image shot by the camera is a blurred image.
The camera image blur detection method comprises the following steps of:
and acquiring a color source image PicA shot by a camera, and storing the color source image PicA into a memory.
The camera image blur detection method comprises the following steps of carrying out gray level processing on the color source image and converting the color source image into a gray level image:
and carrying out gray processing on the color source image PicA by using an opencv function to convert the color source image PicA into a gray image PicB.
The camera image blur detection method comprises the following steps of calculating the variance and the mean of the gray-scale image, and performing filtering processing on the gray-scale image subjected to the variance and mean calculation, wherein the step of processing the gray-scale image into a first blurred image comprises the following steps:
calculating the variance and the mean of the gray scale image PicB;
filtering the gray level graph subjected to variance and mean calculation by using a 3x3 Laplacian operator; the processing is the first blurred image PicD.
The camera image blur detection method comprises the following steps of calculating the variance and the mean of a first blur image, and when the difference value between the variance of the gray-scale image and the variance of the first blur image is within a first preset interval value, preliminarily judging that the gray-scale image is a blur image, wherein the step comprises the following steps:
calculating the variance and the mean of the first fuzzy picture PicD;
calculating a variance difference value between the variance of the gray scale image PicB and the variance of the first blurred image PicD;
when the variance of the gray scale map PicB and the variance difference of the first blurred image PicD are in a first preset interval, preliminarily judging that the gray scale map PicB is a blurred image;
and when the difference value between the variance of the gray scale map PicB and the variance of the first blurred image PicD is not in a first preset interval, judging that the image is normal.
The camera image blur detection method, wherein when the variance difference between the gray scale map PicB and the deblurred image PicE is within a second predetermined interval, the step of determining that the color source image shot by the camera is a blurred image comprises:
when the variance difference value between the gray-scale image PicB and the deblurred image PicE is within a second preset interval, judging that the color source image shot by the camera is a blurred image;
and when the variance difference value between the variance of the gray-scale image PicB and the variance difference value of the deblurred image PicE is not in a second preset interval, judging that the color source image shot by the camera is not a blurred image.
The method for detecting image blur of a camera comprises the following steps of, when the difference between the variance of the gray-scale image and the variance of the deblurred image is within a second predetermined interval, determining that the color source image shot by the camera is a blurred image:
and finding out the camera taking the image as the blurred image according to the judged color source image taken by the camera as the blurred image, determining the camera taking the image as the blurred image as the camera with abnormal working state, and carrying out corresponding reminding.
A camera image blur detection apparatus, wherein the apparatus comprises:
the acquisition module is used for acquiring a color source image shot by the camera;
the gray processing module is used for carrying out gray processing on the color source image and converting the color source image into a gray image;
the calculation and filtering processing module is used for calculating the variance and the mean value of the gray level image, and filtering the gray level image subjected to the variance and mean value calculation to obtain a first blurred image;
the first judging module is used for calculating the variance and the mean value of the first blurred image, and when the difference value between the variance of the gray-scale image and the variance of the first blurred image is in a first preset interval, the gray-scale image is preliminarily judged to be the blurred image;
the deblurring processing module is used for deblurring the gray level image which is judged to be blurred by a dark channel prior method to obtain a deblurred image;
a calculation comparison module for calculating the variance of the deblurred image and comparing the variance of the gray scale map with the variance of the deblurred image;
and the second determination module is used for determining that the color source image shot by the camera is a blurred image when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval.
A computer apparatus comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to implement the steps of any of the methods when the one or more programs are executed by one or more processors.
A non-transitory computer readable storage medium having instructions therein, which when executed by a processor of an electronic device, enable the electronic device to perform any of the methods.
The invention has the beneficial effects that: the embodiment of the invention provides a camera image blur detection method, a camera image blur detection device, computer equipment and a storage medium, wherein a color source image shot by a camera is obtained; carrying out gray level processing on the color source image to convert the color source image into a gray level image; calculating the variance and the mean of the gray level image, and filtering the gray level image subjected to the variance and mean calculation to obtain a first blurred image; calculating the variance and the mean value of the first blurred image, and preliminarily judging that the gray image is a blurred image when the difference value between the variance of the gray image and the variance of the first blurred image is in a first preset interval; carrying out dark channel prior deblurring on the gray level image which is judged to be blurred to obtain a deblurred image; calculating a variance of the deblurred image and comparing the variance of the gray scale map to the variance of the deblurred image; and when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval, judging that the color source image shot by the camera is a blurred image. According to the method, the images collected by the camera are analyzed through a detection algorithm, and then the fuzzy camera is found out; and deducing camera blur from the image blur to find a bad camera. The camera with abnormal working state can be quickly detected by the invention, and the working efficiency is greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a camera image blur detection method according to an embodiment of the present invention.
Fig. 2 is a comparison diagram of the gray scale map PicB and the gray scale map PicB filtered by the laplacian operator according to the camera image blur detection method provided in the embodiment of the present invention.
Fig. 3 is a schematic diagram of a dark channel prior deblurring process of the camera image blur detection method provided by the embodiment of the present invention.
Fig. 4 is a schematic diagram of determining an image as a blurred image in the camera image blur detection method according to the embodiment of the present invention.
Fig. 5 is a schematic block diagram of a camera image blur detection apparatus according to an embodiment of the present invention.
Fig. 6 is a schematic block diagram of an internal structure of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It should be noted that, if directional indications (such as up, down, left, right, front, and back … …) are involved in the embodiment of the present invention, the directional indications are only used to explain the relative position relationship between the components, the motion situation, and the like in a specific posture (as shown in the drawing), and if the specific posture is changed, the directional indications are changed accordingly.
With the development of smart city services, video services cannot be limited to video monitoring functions, and new functions need to be developed in combination with market needs, such as: analyzing the content captured by the camera by using an image processing technology, and further finding out the camera with abnormal working state; there is no good way to find out the camera with abnormal working state in the prior art.
In order to solve the problems in the prior art, the invention provides a camera image blur detection method.
Exemplary method
As shown in fig. 1, an embodiment of the present invention provides a camera image blur detection method, including the following steps:
s100, acquiring a color source image shot by a camera;
the embodiment of the invention mainly analyzes the images shot by the camera and analyzes whether the images shot by the camera have blurred images. Firstly, a color source image PicA shot by a camera is obtained, the color source image PicA is stored in a memory, and a corresponding relation can be correspondingly established between the shot color source image PicA and the corresponding shooting camera, namely, the corresponding color source image PicA is recorded by which camera, so that the shooting source can be conveniently searched and confirmed later.
Step S200, carrying out gray scale processing on the color source image (PicA) to convert the color source image (PicA) into a gray scale image (PicB);
in the embodiment of the invention, the gray level processing is carried out on the color source image to convert the color source image into a gray level image. Specifically, for example, the color source image PicA is subjected to gray scale processing using an opencv function, and converted into a gray scale map PicB.
In specific implementation, for example, a component method may be adopted, the brightness of three components in the color source image is used as the gray value of three gray images, and one gray image may be selected according to application requirements.
Step S300, calculating the variance and the mean value of the gray level image (PicB), and carrying out filtering processing on the gray level image subjected to the variance and mean value calculation to obtain a first blurred image (PicD);
in the embodiment of the invention, the variance and the mean of the gray level image are calculated. The mean value of the gray scale represents the brightness of the image, the variance represents the deviation between all pixel values, that is, the deviation between the brightness value of the gray scale image and all pixel values is calculated in the embodiment of the present invention, and the gray scale image subjected to the variance and mean calculation is filtered to be processed into the first blurred image.
Specifically, for example, the variance and the mean of the gradation map PicB are calculated; filtering the gray level graph subjected to variance and mean calculation by using a 3x3 Laplacian operator; the processing is the first blurred image PicD. As shown in fig. 2, the left image and the right image of fig. 2 are respectively a comparison image of the gray scale map PicB and the gray scale map PicB after being filtered by the laplace operator.
Step S400, calculating the variance and the mean value of a first fuzzy image (PicD), and preliminarily judging that the grey scale image (PicB) is a fuzzy image when the difference value of the variance of the grey scale image (PicB) and the variance of the first fuzzy image (PicD) is in a first preset interval;
in the embodiment of the invention, the variance and the mean of the first blurred image are calculated, and when the difference value between the variance of the gray-scale image and the variance of the first blurred image is within a first preset interval value, the gray-scale image is preliminarily judged to be the blurred image.
Specifically, the variance and the mean of the first blur map PicD are calculated; then calculating the variance difference value between the variance of the gray-scale image PicB and the variance of the first blurred image PicD;
when the variance of the gray scale map PicB and the variance difference of the first blurred image PicD are within a first preset interval, preliminarily judging that the gray scale map PicB is a blurred image; in the embodiment of the present invention, the first predetermined interval may be determined according to an actual scene, for example, the value of the first predetermined interval is (0.3-0.8), and the first predetermined interval may also be changed according to a scene requirement.
When the difference between the variance of the gray scale map PicB and the variance of the first blurred image PicD is not within a first predetermined interval (0.3-0.8), it is determined that the image is normal, i.e., not a blurred image.
The average value of the image indicates the brightness of the entire image, and the image is brighter as the average value of the image is larger. The standard deviation represents the contrast degree of the light and shade change in the image, and the larger the standard deviation is, the more obvious the light and shade change in the image is.
The variance and mean calculation of the image in the present embodiment can be calculated by a method common in the prior art, and the present invention provides an algorithm in the opencv library, for example, the variance and mean calculation of the image by voidmeans stdev (InputArray src, outputArray mean, outputArray stddev, inputArray mask = nonarray ())
Wherein, src: inputting a matrix, which should be 1-4 channel;
mean: output parameters, calculate mean
stddev: output parameters, calculate standard deviation
mask: and (6) selecting parameters.
Step S500, carrying out dark channel prior deblurring on the gray scale image (PicB) which is judged to be blurred to obtain a deblurred image;
in the embodiment of the invention, the gray scale image (PicB) which is judged to be fuzzy is deblurred by a dark channel prior method to obtain a deblurred image. The so-called dark channel is a basic assumption that in most non-sky local areas there are some pixels (dark pixels) that have very low values in at least one color channel, approaching 0. The dark channel is actually obtained by taking the minimum value in the three rgb channels to form a gray map and then performing a minimum value filtering.
And carrying out dark channel prior deblurring (defogging) on the gray scale image (PicB) judged to be blurred, and specifically adopting a defogging algorithm to realize deblurring on the obtained deblurred image. As shown in fig. 3, fig. 3 is a schematic diagram of a dark channel prior deblurring flow of a camera image blur detection method provided in an embodiment of the present invention, where an input image is divided into two parts, one part calculates an atmospheric light component value, and the other part calculates a transmittance, for example, according to a formula, a defogging algorithm may be interpreted as: when fog exists, the image acquired by the camera is composed of two parts, one part is light rays emitted by a shot object and passing through the haze, and the other part is light rays reflected by the haze. The shot object emits light f (x) and passes through haze, the haze transmittance is t (x), and then the value of the shot object light after reaching the camera is f (x) × t (x). The original atmospheric light value is A, the direction of the atmospheric light can be regarded as completely opposite to the light of the shot object, one part of the atmospheric light penetrates through haze, one part of the atmospheric light is reflected by the haze, and the reflected light value is A-A x t (x)). Then, a defogging result graph is obtained.
Step S600, calculating the variance of the deblurred image (PicE) and comparing the variance of the grey-scale map (PicB) with the variance of the deblurred image.
I.e. the variance of the deblurred image (PicE) is calculated in an embodiment of the invention and compared to the variance of the deblurred image (PicB).
And step S700, when the variance difference value between the gray scale image (PicB) and the deblurred image (PicE) is in a second preset interval, judging that the color source image shot by the camera is a blurred image.
In the embodiment of the present invention, when the difference between the variance of the gray-scale map PicB and the variance of the deblurred image PicE is within a second predetermined interval (preferably, in a partial scene, the second predetermined interval is (0.4-0.6)), it is determined that the color source image captured by the camera is a blurred image.
Specifically, for example, when the variance of the grayscale map PicB and the variance difference of the deblurred image PicE are within a second predetermined interval (0.4-0.6), the color source image captured by the camera is determined as a blurred image, and the image shown in fig. 4 is determined as a blurred image. The method has the advantages that the accuracy of the determined fuzzy image is improved, the fuzzy image can be detected by the method, and missing detection is avoided. And the detection of 2 pictures can be completed within 3s, and the detection efficiency is high.
And when the variance difference value between the variance of the gray-scale image PicB and the variance difference value of the deblurred image PicE is not in a second preset interval (0.4-0.6), judging that the color source image shot by the camera is not a blurred image.
Further: according to the method, the camera which shoots the image as the fuzzy image is found out according to the fact that the color source image shot by the camera is the fuzzy image, the camera which shoots the image as the fuzzy image is determined to be the camera with abnormal working state, and corresponding reminding is carried out.
Exemplary device
As shown in fig. 5, an embodiment of the present invention provides a camera image blur detection apparatus, including:
an obtaining module 510, configured to obtain a color source image captured by a camera;
a gray processing module 520, configured to perform gray processing on the color source image to convert the color source image into a gray map;
a calculation and filtering processing module 530, configured to calculate a variance and a mean of the grayscale image, and perform filtering processing on the grayscale image subjected to the variance and mean calculation to obtain a first blurred image;
a first determining module 540, configured to calculate a variance and a mean of the first blurred image, and preliminarily determine that the grayscale image is a blurred image when a difference between the variance of the grayscale image and the variance of the first blurred image is within a first predetermined interval;
a deblurring processing module 550, configured to perform dark channel prior deblurring on the gray scale image determined as blurred, so as to obtain a deblurred image;
a calculation comparison module 560 for calculating the variance of the deblurred image and comparing the variance of the gray map with the variance of the deblurred image;
the second determining module 570 is configured to determine that the color source image captured by the camera is a blurred image when the difference between the variance of the grayscale image and the variance of the deblurred image is within a second predetermined interval, which is specifically described above.
Based on the above embodiments, the present invention further provides a computer device, whose functional block diagram may be as shown in fig. 6. The computer equipment comprises a processor, a memory, a network interface, a display screen and a temperature sensor which are connected through a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a camera image blur detection method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the temperature sensor of the computer equipment is arranged in the computer equipment in advance and used for detecting the operating temperature of the internal equipment.
It will be appreciated by those skilled in the art that the schematic block diagram shown in fig. 6 is only a block diagram of a portion of the structure associated with the inventive arrangements and is not intended to limit the computing devices to which the inventive arrangements may be applied, and that a particular computing device may include more or less components than those shown, or may have some components combined, or may have a different arrangement of components.
In one embodiment, a computer apparatus is provided that includes a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for:
acquiring a color source image shot by a camera;
carrying out gray level processing on the color source image to convert the color source image into a gray level image;
calculating the variance and the mean of the gray level image, and filtering the gray level image subjected to the variance and mean calculation to obtain a first blurred image;
calculating the variance and the mean value of the first blurred image, and preliminarily judging that the gray image is a blurred image when the difference value between the variance of the gray image and the variance of the first blurred image is in a first preset interval;
carrying out dark channel prior deblurring on the gray level image which is judged to be blurred to obtain a deblurred image;
calculating a variance of the deblurred image and comparing the variance of the gray scale map to the variance of the deblurred image;
and when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval, judging that the color source image shot by the camera is a blurred image.
The computer program of the embodiment of the invention is executed by a processor to realize a camera image blur detection method, and the implementation of the camera image blur detection method program of the invention is further described in detail through specific application embodiments as follows:
step one, selecting a proper development environment tool to develop a program of the camera image blur detection method. E.g., selecting an appropriate development tool; under Windows, the opencv4.5.3 library is required to be used for developing VScode, under Linux, a Linux development environment is developed by remotely connecting VScode with Linux, and under Centos 7, the opencv4.5.3 library is also required to be prepared.
The advantage of this step is that VScode is a powerful tool, which can improve the working efficiency; opencv, a computer vision library developed by intel corporation, provides many image processing related functions such as image enhancement, edge detection, huffman transform, etc.
Step two: the invention sets a high-efficiency detection target, and the detection method of the invention has the following characteristics:
1. the method is accurate, and most of detected images can be guaranteed to be problematic images;
2. the efficiency is high; the detection of 2 pictures can be completed within 3 s;
3. robustness; the program can not be crashed due to external reasons;
4. general adaptation; it is suitable for various environments such as roads, factories, forests and the like.
Step three, designing a program target of the image blur detection method:
in the above step, the characteristics that the implemented algorithm should have are clarified, and the following procedure is performed to design the image blur detection method:
characteristic 1 is accurate, and in order to achieve this characteristic, pre-processing and pre-analysis of the image is required;
using other algorithms before the whole processing algorithm flow, and skipping the detected images without blurs; in the image with the problem detected and processed by the algorithm, the judgment condition is modified into a reasonable value by combining actual observation and visual observation;
the characteristic 2 is high-efficiency, in order to realize the characteristic, the analysis flow of the algorithm needs to be reasonably designed, a time-consuming processing stage is needed, and judgment conditions are increased, so that the efficiency is integrally improved, and a user is satisfied;
the characteristic 3 is robust, and in order to realize the characteristic, it is necessary to process the abnormality occurring in the algorithm analysis process, for example, the input image is a single-channel image, and for example, the image input is empty.
The characteristic 4 is universal, and due to complex and various environments, various abnormal conditions need to be considered and abnormal processing needs to be performed as much as possible, so that the algorithm can complete detection under the adverse conditions of non-uniform image size, non-uniform image type, non-uniform image content and the like.
The method for realizing the image blur detection by actually using the program comprises the following steps:
(1) Reading a color chart (PicA) to a memory and judging whether the reading is successful;
(2) Graying an original image color map (PicA) by using an opencv function, and converting the color map (PicA) into a gray map (PicB);
(3) Calculating the variance of the gray scale map (PicB) at the moment;
(4) Filtering the gray-scale image (PicB) with the calculated variance by using a Laplacian operator of 3x3 to blur the image, and naming the image as a blurred image PicD;
(5) Calculating the mean and variance of the processed blur map PicD, and if the variance difference between the PicB image and the blur map PicD is within a first predetermined interval (0.3-0.8), determining that the image is blurred; otherwise, ending the algorithm to show that the image is normal;
(6) Deblurring the gray scale image (PicB) which is judged to be blurred by a dark channel prior method to obtain a deblurred image; and calculating the variance of the deblurred image (PicE), comparing the variance of the gray-scale image (PicB) with the variance of the deblurred image (comparing PicB with PicE), and judging that the color source image shot by the camera is a blurred image when the difference value of the variance of the gray-scale image (PicB) and the variance of the deblurred image (PicE) is within a second preset interval (0.4-0.6). And finding out the camera taking the image as the blurred image according to the judged color source image taken by the camera as the blurred image, determining the camera taking the image as the blurred image as the camera with abnormal working state, and carrying out corresponding reminding.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, databases, or other media used in embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct Rambus Dynamic RAM (DRDRAM), and Rambus Dynamic RAM (RDRAM), among others.
In summary, the present invention discloses a method, an apparatus, a computer device and a storage medium for detecting blur of camera images, wherein a color source image shot by a camera is obtained; carrying out gray level processing on the color source image to convert the color source image into a gray level image; calculating the variance and the mean of the gray level image, and filtering the gray level image subjected to the variance and mean calculation to obtain a first blurred image; calculating the variance and the mean value of the first blurred image, and preliminarily judging that the gray image is a blurred image when the difference value between the variance of the gray image and the variance of the first blurred image is in a first preset interval; carrying out dark channel prior deblurring on the gray level image which is judged to be blurred to obtain a deblurred image; calculating a variance of the deblurred image and comparing the variance of the gray scale map to the variance of the deblurred image; and when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval, judging that the color source image shot by the camera is a blurred image. According to the method, the images collected by the camera are analyzed through a detection algorithm, and then the fuzzy camera is found out; and deducing camera blur from the image blur to find a bad camera. The camera with abnormal working state can be quickly detected by the invention, and the working efficiency is greatly improved.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.

Claims (10)

1. A camera image blur detection method is characterized by comprising the following steps:
acquiring a color source image shot by a camera;
carrying out gray level processing on the color source image to convert the color source image into a gray level image;
calculating the variance and the mean of the gray level image, and filtering the gray level image subjected to the variance and mean calculation to obtain a first blurred image;
calculating the variance and the mean value of the first blurred image, and preliminarily judging that the gray image is a blurred image when the difference value between the variance of the gray image and the variance of the first blurred image is in a first preset interval;
carrying out dark channel prior deblurring on the gray level image which is judged to be blurred to obtain a deblurred image;
calculating a variance of the deblurred image and comparing the variance of the gray scale map to the variance of the deblurred image;
and when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval, judging that the color source image shot by the camera is a blurred image.
2. The camera image blur detection method according to claim 1, wherein the step of acquiring the color source image captured by the camera comprises:
and acquiring a color source image PicA shot by a camera, and storing the color source image PicA into a memory.
3. The camera image blur detection method according to claim 1, wherein the step of converting the color source image into a gray map by performing gray processing comprises:
and carrying out gray processing on the color source image PicA by using an opencv function, and converting the color source image PicA into a gray map PicB.
4. The camera image blur detection method according to claim 1, wherein the step of calculating the variance and the mean of the gray-scale image and performing filtering processing on the gray-scale image subjected to the variance and mean calculation to obtain a first blurred image comprises:
calculating the variance and the mean of the gray scale image PicB;
filtering the gray level graph subjected to variance and mean calculation by using a Laplacian of 3x 3; the processing is the first blurred image PicD.
5. The camera image blur detection method according to claim 1, wherein the step of calculating the variance and the mean of the first blur image, and when the difference between the variance of the gray scale image and the variance of the first blur image is within a first predetermined interval, preliminarily determining the gray scale image as the blur image comprises:
calculating the variance and the mean of the first fuzzy picture PicD;
calculating a variance difference value between the variance of the gray scale image PicB and the variance of the first blurred image PicD;
when the variance of the gray scale map PicB and the variance difference of the first blurred image PicD are in a first preset interval, preliminarily judging that the gray scale map PicB is a blurred image;
and when the difference value between the variance of the gray scale map PicB and the variance of the first blurred image PicD is not in a first preset interval, judging that the image is normal.
6. The method for detecting camera image blur according to claim 1, wherein the step of determining that the color source image captured by the camera is a blurred image when the variance of the gray scale map PicB and the variance difference of the deblurred image PicE are within a second predetermined interval comprises:
when the variance difference value between the gray-scale image PicB and the deblurred image PicE is within a second preset interval, judging that the color source image shot by the camera is a blurred image;
and when the variance difference value between the gray scale map PicB and the deblurred image PicE is not in a second preset interval, judging that the color source image shot by the camera is not a blurred image.
7. The camera image blur detection method according to claim 1, wherein the step of determining the color source image captured by the camera as a blurred image when the difference between the variance of the gray scale image and the variance of the deblurred image is within a second predetermined interval further comprises:
and finding out the camera taking the image as the blurred image according to the judged color source image taken by the camera as the blurred image, determining the camera taking the image as the blurred image as the camera with abnormal working state, and carrying out corresponding reminding.
8. A camera image blur detection device, characterized in that the device comprises:
the acquisition module is used for acquiring a color source image shot by the camera;
the gray processing module is used for carrying out gray processing on the color source image and converting the color source image into a gray image;
the calculation and filtering processing module is used for calculating the variance and the mean value of the gray level image, and filtering the gray level image subjected to the variance and mean value calculation to obtain a first blurred image;
the first judging module is used for calculating the variance and the mean value of the first blurred image, and when the difference value between the variance of the gray-scale image and the variance of the first blurred image is in a first preset interval, the gray-scale image is preliminarily judged to be the blurred image;
the deblurring processing module is used for deblurring the gray level image which is judged to be blurred by a dark channel prior method to obtain a deblurred image;
a calculation comparison module for calculating the variance of the deblurred image and comparing the variance of the gray scale map with the variance of the deblurred image;
and the second determination module is used for determining that the color source image shot by the camera is a blurred image when the variance of the gray-scale image and the variance difference of the deblurred image are in a second preset interval.
9. A computer device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to perform the steps of the method of any one of claims 1-7 when the one or more programs are executed by one or more processors.
10. A non-transitory computer readable storage medium having instructions therein, which when executed by a processor of an electronic device, enable the electronic device to perform the method of any one of claims 1-7.
CN202211046744.8A 2022-08-30 2022-08-30 Camera image blur detection method and device, computer equipment and storage medium Pending CN115393330A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211046744.8A CN115393330A (en) 2022-08-30 2022-08-30 Camera image blur detection method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211046744.8A CN115393330A (en) 2022-08-30 2022-08-30 Camera image blur detection method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115393330A true CN115393330A (en) 2022-11-25

Family

ID=84125482

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211046744.8A Pending CN115393330A (en) 2022-08-30 2022-08-30 Camera image blur detection method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115393330A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115880300A (en) * 2023-03-03 2023-03-31 北京网智易通科技有限公司 Image blur detection method, image blur detection device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115880300A (en) * 2023-03-03 2023-03-31 北京网智易通科技有限公司 Image blur detection method, image blur detection device, electronic equipment and storage medium
CN115880300B (en) * 2023-03-03 2023-05-09 北京网智易通科技有限公司 Image blurring detection method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
JP3951984B2 (en) Image projection method and image projection apparatus
US11156564B2 (en) Dirt detection on screen
CN109997351B (en) Method and apparatus for generating high dynamic range images
CN110661977B (en) Subject detection method and apparatus, electronic device, and computer-readable storage medium
EP2187620A1 (en) Digital image processing and enhancing system and method with function of removing noise
EP3798975B1 (en) Method and apparatus for detecting subject, electronic device, and computer readable storage medium
EP3176751A1 (en) Information processing device, information processing method, computer-readable recording medium, and inspection system
CN110796041B (en) Principal identification method and apparatus, electronic device, and computer-readable storage medium
CN112419420B (en) Camera calibration method and device, electronic equipment and storage medium
CN108989699B (en) Image synthesis method, image synthesis device, imaging apparatus, electronic apparatus, and computer-readable storage medium
CN114764775A (en) Infrared image quality evaluation method, device and storage medium
CN115393330A (en) Camera image blur detection method and device, computer equipment and storage medium
CN113781393B (en) Screen defect detection method, device, equipment and storage medium
CN109447942B (en) Image ambiguity determining method, apparatus, computer device and storage medium
US20070009173A1 (en) Apparatus and method for shading correction and recording medium therefore
CN114049549A (en) Underwater visual recognition method, system and computer readable storage medium
CN111932462B (en) Training method and device for image degradation model, electronic equipment and storage medium
CN109785343B (en) Definition-based face matting picture optimization method and device
CN115278103B (en) Security monitoring image compensation processing method and system based on environment perception
CN113450335B (en) Road edge detection method, road edge detection device and road surface construction vehicle
CN115578291A (en) Image brightness correction method, storage medium and electronic device
CN114841943A (en) Part detection method, device, equipment and storage medium
JP2009258770A (en) Image processing method, image processor, image processing program, and imaging device
RU2346331C1 (en) Method of automatic estimate of lcd data display correctness
CN115604567A (en) Method and device for detecting camera shading by green leaves and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination