Image detection method, device, electronic device and storage medium

By performing sub-image interception and mean square variance calculation on the surveillance video image, the problem of manual inspection in the prior art is solved, and more efficient and accurate image picture abnormality detection is achieved.

CN115278217BActive Publication Date: 2025-04-01SHENZHEN ZHENYOU SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210865307.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-21
Publication Date
2025-04-01
Estimated Expiration
2042-07-21

AI Technical Summary

Technical Problem

In the prior art, the color abnormality check of monitoring video images relies on manual observation, which takes a long time and is prone to missed inspection.

Method used

By acquiring the image to be detected, if its color is abnormal, the sub-image is cut off, the mean square difference between the sub-image and the image to be detected is calculated, and if the preset conditions are met, the image screen is determined to be abnormal.

Benefits of technology

It improves the accuracy of image screen detection, reduces the time and missed detection rate of manual inspection, and can detect each frame of the video one by one.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115278217B_ABST
    Figure CN115278217B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses an image screen detection method, device, electronic device and storage medium, the method comprising acquiring an image to be detected; when the color of the image to be detected is abnormal, cutting out at least one sub-image from the image to be detected; determining the number of sub-images with abnormal colors in the at least one sub-image, and determining the mean square error corresponding to the image to be detected and the at least one sub-image; if the number of sub-images with abnormal colors meets a preset condition, and the mean square errors corresponding to the image to be detected and the at least one sub-image are both within a first preset range, determining that the screen of the image to be detected is abnormal. Through the technical solution of the embodiment of the present invention, the detection of screen abnormalities of the image to be detected can be realized, and the efficiency and accuracy of the detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image picture detection method, device, electronic equipment and storage medium. Background Art

[0002] Nowadays, many places in the city are covered with surveillance cameras, such as factories, schools, roadsides, various government agencies, companies, schools, etc. Surveillance has become an indispensable part of maintaining the operation of the city. Teachers can supervise students through surveillance videos, factory workers can supervise mechanical equipment through surveillance videos, and so on. If the surveillance video is unclear due to abnormal color of the video image, it will have a great impact on the supervision and management work.

[0003] Currently, the existing method for checking color anomalies in video images is to manually observe whether the monitoring images have color anomalies. This method consumes a lot of human resources and is likely to cause missed detections. Summary of the invention

[0004] The embodiments of the present invention provide an image detection method, device, electronic device and storage medium to solve the technical problem that manual inspection is time-consuming and prone to missed inspections.

[0005] In a first aspect, an embodiment of the present invention provides an image picture detection method, the method comprising:

[0006] Acquire the image to be detected;

[0007] When the color of the image to be detected is abnormal, extracting at least one sub-image from the image to be detected;

[0008] Determining the number of sub-images with abnormal colors in the at least one sub-image, and determining the mean square error corresponding to the image to be detected and the at least one sub-image respectively;

[0009] If the number of sub-images with abnormal colors meets a preset condition, and the mean square errors corresponding to the image to be detected and the at least one sub-image are both within a first preset range, it is determined that the image to be detected is abnormal.

[0010] In a second aspect, an embodiment of the present invention further provides an image picture detection device, the device comprising:

[0011] An image acquisition module, used for acquiring an image to be detected;

[0012] A sub-image acquisition module, used for intercepting at least one sub-image from the image to be detected when the color of the image to be detected is abnormal;

[0013] A mean square error acquisition module, used to determine the number of sub-images with abnormal colors in the at least one sub-image, and determine the mean square errors corresponding to the image to be detected and the at least one sub-image respectively;

[0014] The image abnormality determination module is used to determine that the image to be detected is abnormal if the number of sub-images with color abnormalities meets a preset condition and the mean square errors corresponding to the image to be detected and the at least one sub-image are both within a first preset range.

[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0016] one or more processors;

[0017] a storage device for storing one or more programs,

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the image detection method as described in any one of the embodiments of the present invention.

[0019] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute the image picture detection method as described in any one of the embodiments of the present invention.

[0020] The technical solution of the embodiment of the present invention obtains the image to be detected, and in the case that the color of the entire image to be detected is abnormal, at least one sub-image is intercepted from the image to be detected. The number of sub-images with color abnormalities is determined in at least one sub-image, and the mean square error corresponding to the image to be detected and at least one sub-image is determined. If the number of sub-images with color abnormalities meets the preset conditions, and the mean square errors corresponding to the image to be detected and at least one sub-image are both within the first preset range, it is determined that the image to be detected is abnormal. The technical solution of the embodiment of the present invention first obtains whether the image to be detected is abnormal in color from the whole, and then determines whether the number of sub-images with color abnormalities meets the preset conditions, and whether the mean square error of the image to be detected and at least one sub-image is within the first preset range. If both are true, it is determined that the image to be detected is abnormal. The embodiment of the present invention analyzes the image to be detected from the whole and the part to improve the accuracy of image detection, and by using a computer to detect whether the image is abnormal, each frame of the video can be detected one by one. Compared with the manual inspection method, there will be no missed detection, and the detection efficiency can also be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] in:

[0023] Figure 1 1 is a flow chart of an image detection method according to an embodiment;

[0024] Figure 2 is a schematic flow chart of an image detection method in another embodiment;

[0025] Figure 3 is a schematic diagram of a sub-image in one embodiment;

[0026] Figure 4 is a schematic flow chart of an image detection method in another embodiment;

[0027] Figure 5 is a schematic structural diagram of an image picture detection device in one embodiment;

[0028] Figure 6 A schematic diagram of the structure of an electronic device in one embodiment. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] Before describing the technical solution of the embodiment of the present invention, the application scenario of the embodiment of the present invention is first exemplarily described:

[0031] Nowadays, monitoring devices have been integrated into people's lives and work, and monitoring videos have a great impact on people's lives and work. However, due to network transmission problems, abnormalities in the optical sensor of the camera, etc., the monitoring video images are abnormal, making the monitoring video unable to provide services for people. In the existing methods, it is usually necessary to manually screen out monitoring videos with abnormal images, which is time-consuming and labor-intensive.

[0032] In view of the above technical problems, an embodiment of the present invention proposes an image detection method. The embodiment of the present invention can be applied to the case of detecting abnormal images. The method can be executed by an image detection device. The image detection device can be an APP on a mobile phone or software on a computer. The image detection device can be applied on devices such as computers and servers. The device can be implemented in the form of software and / or hardware.

[0033] The technical solution of the embodiment of the present invention is described in detail below. The technical solution of the embodiment of the present invention can detect image abnormalities, such as being applied to detecting color abnormalities of surveillance videos, and then determining whether a surveillance device corresponding to the surveillance videos is faulty, and can also detect color abnormalities of face recognition images, and then determine whether a face recognition device is faulty, etc.

[0034] like Figure 1 As shown, the image picture detection method of the embodiment of the present invention specifically includes the following steps:

[0035] S110: Acquire an image to be detected.

[0036] The image to be detected refers to an image that needs to be detected for image anomalies, and may be a surveillance video image, or other images that need to be detected for image anomalies.

[0037] Specifically, the image to be detected is obtained to prepare for the subsequent abnormality detection of the image to be detected. Exemplarily, if the image to be detected is a surveillance video image, any video frame image is intercepted from the surveillance video as the image to be detected.

[0038] Optionally, the embodiment of the present invention does not specifically limit the size and format of the image to be detected. For example, the image may be in bmp format or jpg format.

[0039] S120: When the color of the image to be detected is abnormal, extract at least one sub-image from the image to be detected.

[0040] The color abnormality may refer to color cast, for example, the image is biased to red or blue.

[0041] Specifically, first, the color anomaly of the image to be detected as a whole is obtained. When the color anomaly exists in the image to be detected as a whole, at least one sub-image is cut out from the image to be detected. Exemplarily, at least one sub-image can be cut out from the image to be detected by an image segmentation method. It should be noted that the number of sub-images and their positions in the image to be detected can be set according to actual conditions. For example, if there are three sub-images, the image to be detected is divided into three equal parts from top to bottom to obtain three sub-images.

[0042] S130: Determine the number of sub-images with abnormal colors in the at least one sub-image, and determine the mean square error corresponding to the image to be detected and the at least one sub-image.

[0043] Specifically, color anomaly detection is performed on at least one sub-image, the number of sub-images with color anomalies is determined, and the mean square error between the image to be detected and at least one sub-image is obtained, so as to prepare for the subsequent determination of the number of sub-images with color anomalies and the determination of each mean square error.

[0044] The mean square error of the image to be detected and the at least one sub-image respectively includes the mean square error of the image to be detected and the mean square error of each sub-image; the mean square error of the image means the mean square error of each pixel value of the image. The mean square error can represent the difference of the pixel values ​​of all pixels.

[0045] For example, the pixel values ​​of each color channel of the image are obtained, and for each color channel, the mean square error of each pixel value of each color channel is calculated to obtain the mean square error of each color channel pair, and then the mean square error of each color channel is averaged to obtain the mean square error of the image.

[0046] S140: If the number of sub-images with abnormal colors meets a preset condition, and the mean square errors corresponding to the image to be detected and the at least one sub-image are both within a first preset range, it is determined that the image to be detected is abnormal.

[0047] The preset condition may be that the number reaches a preset number, or that the number of sub-images with color abnormalities accounts for a proportion of all sub-images that reaches a preset proportion, or that the ratio of the number of sub-images with color abnormalities to the number of sub-images without color abnormalities reaches a preset ratio. It should be understood that the preset number, the preset proportion, the preset ratio, and the first preset range can be set according to actual conditions and are not specifically limited here.

[0048] Specifically, since the sub-images are images of different regions cut out from the image to be detected, if the number of color anomalies in the sub-images meets the preset conditions, it means that there are color anomalies in the local area of ​​the image to be detected. However, due to the different selection positions of the sub-images and the different picture information in each image to be detected, the picture anomaly of the image to be detected cannot be determined only by the color anomaly of the sub-images. Therefore, it is necessary to detect the overall and local information in the image to be detected. The embodiment of the present invention determines whether the mean square error of the image to be detected and the sub-image is within the first preset range, and then obtains whether the image to be detected has color anomalies. When the image as a whole has color cast or color anomalies, the overall mean square error of the image and the mean square error of the local area are not much different, and the overall color is single or biased towards a certain color. For example, an image has an overall reddish color, and the overall mean square error of the image and the mean square error of the local area are not much different. Therefore, a first preset range is set, and when the mean square error of the image to be detected and at least one sub-image is within the first preset range, it means that the color of the image to be detected is abnormal. The judgment based on the sub-image with color abnormality is to judge whether the image to be detected has color abnormality locally. The judgment on the mean square error of the image to be detected and each sub-image is to judge whether the image to be detected has abnormality as a whole. Through the local judgment of the sub-image and the overall judgment of the sub-image and the image to be detected, the result of whether the picture of the image to be detected is abnormal is obtained, thereby improving the accuracy of the picture detection of the image to be detected.

[0049] Optionally, the mean square errors corresponding to the image to be detected and the at least one sub-image are both within the first preset range. There may be multiple situations. The first situation may be that the mean square errors corresponding to the image to be detected and the at least one sub-image are both within the first preset range, as described above.

[0050] The second case may be the difference between the mean square error of the image to be detected and at least one sub-image. When the at least one difference is within the first preset interpolation range, it means that the mean square error of the image to be detected and at least one sub-image at this time is within the first preset range. Specifically, the mean square error of the image to be detected and at least one sub-image is calculated by difference to obtain at least one difference. If the at least one difference is within the first preset difference range, it means that the mean square error of the image to be detected and at least one sub-image is within the first preset range. The difference in information carried by the image to be detected and at least one sub-image is determined by the difference. If at least one difference is within the first preset difference range, it means that the information carried by the image to be detected and at least one sub-image is not much different, that is, the information is similar. For example, the image to be detected is full of green plants, and a sub-image is intercepted which is also part of the green plants. The information carried by the two is similar, and the difference in the mean square error of the two is within the first preset difference range. The mean square error of the two is within the first preset range.

[0051] The technical solution of the embodiment of the present invention obtains the image to be detected, and in the case that the color of the entire image to be detected is abnormal, at least one sub-image is intercepted from the image to be detected. The number of sub-images with color abnormalities is determined in the at least one sub-image, and the mean square error corresponding to the image to be detected and the at least one sub-image is determined. If the number of sub-images with color abnormalities meets the preset conditions, and the mean square errors corresponding to the image to be detected and the at least one sub-image are both within the first preset range, the image to be detected is determined to be abnormal. That is, the color of the image to be detected is color cast. The technical solution of the embodiment of the present invention first obtains whether the image to be detected has color abnormalities as a whole, and then determines whether the number of sub-images with color abnormalities meets the preset conditions, and whether the mean square error of the image to be detected and the at least one sub-image is within the first preset range. If both are true, the image to be detected is determined to be abnormal. The embodiment of the present invention analyzes the image to be detected from the overall and local aspects to improve the accuracy of image detection, and by using a computer to detect whether the image is abnormal, each frame of the video can be detected one by one. Compared with the manual inspection method, there will be no missed detection, and the detection efficiency can also be improved.

[0052] In another embodiment of the present invention, the image to be detected is a surveillance video image; the method further includes: if it is detected that at least one image in the surveillance video corresponding to the image to be detected is abnormal, it is determined that there is an abnormality in the surveillance device corresponding to the surveillance video.

[0053] In an embodiment of the present invention, the image to be detected is a surveillance video image. The image to be detected is obtained from the surveillance video, and multiple images to be detected can be obtained. Optionally, the multiple images to be detected of the surveillance video are respectively subjected to screen detection. If there is at least one image with a screen abnormality, it is determined that the surveillance device corresponding to the surveillance video has an abnormality. Of course, there can be multiple images with screen abnormalities, for example, set to 3. When there are 3 or more images with screen abnormalities, it is determined that the surveillance device corresponding to the surveillance video has an abnormality. Optionally, the image screen abnormality at this time may refer to the color cast of the image screen.

[0054] Optionally, when there is an abnormality in the monitoring device corresponding to the monitoring video, an early warning message may be issued, and the early warning message may include the image detection time of the image to be detected, the identification of the monitoring video, and the identification of the monitoring device. The early warning message may be sent to the subordinate domain corresponding to the monitoring device so that the staff of the subordinate domain can check the monitoring device.

[0055] Optionally, the monitoring device abnormality may be that the monitoring video shot by the monitoring device is abnormal during the transmission process, that is, the network transmission of the monitoring device is abnormal, or the optical sensor of the camera of the monitoring device is abnormal, or the monitoring video screen is abnormal due to the environment where the monitoring device is located. Send an early warning message to the lower-level domain where the monitoring device is located, so that the staff of the lower-level domain can check the monitoring device and the environment where the monitoring device is located.

[0056] Optionally, if the picture of any image in the monitoring video is abnormal, it is determined that the monitoring device corresponding to the monitoring video is abnormal. For example, if the picture of the image to be detected is abnormal, it is determined that the monitoring device corresponding to the monitoring video is abnormal. The monitoring video includes the image to be detected.

[0057] Optionally, image detection can be performed on surveillance videos at different times. For example, the images of each surveillance video can be detected at 7 a.m. and 6 p.m. every day. At this time, only one image to be detected can be obtained for each surveillance video, and image detection can be performed on the detection image.

[0058] Optionally, for obtaining multiple images to be detected from a surveillance video, surveillance video images at different moments may be obtained respectively according to the recording duration of the surveillance video.

[0059] Optionally, before determining that the image to be detected has an image abnormality, it also includes: restoring the color of the image to be detected to obtain an image to be compared; determining that the image to be detected has an image abnormality includes: if the color error between the image to be compared and the image to be detected in each color channel is within a preset error range, then determining that the image to be detected has an image abnormality.

[0060] Among them, the method of color restoration of the image to be detected can be a white balance algorithm, a K-Means algorithm, etc. The essence of color restoration is to make the color of the image as close as possible to the real color of the object in the image. The color channel can refer to the R color channel, the G color channel or the B color channel. The color error on each color channel can refer to the sum of the differences between the pixel values ​​of the image to be compared and the image to be detected on the color channel, or the mean of the differences between the pixel values ​​of the image to be compared and the image to be detected, or it can refer to the absolute value of the difference between the mean of all pixel values ​​of the image to be compared and the image to be detected on the color channel. For example, the color channel can be the R color channel. On the R color channel, the difference between the pixel values ​​of the image to be compared and the image to be detected is a1, a2, ... an. The color error of the R color channel can be a1+a2+... an, or the color error of the R color channel can be (a1+a2+... an) / n, or the mean of all pixel values ​​of the image to be compared on the R color channel is a, and the mean of all pixel values ​​of the image to be detected is b, then the color error of the R color channel is |ab|.

[0061] Specifically, before determining that the image to be detected is abnormal, the image to be detected is color restored to obtain the image to be compared, and the color error of the image to be compared and the image to be detected in each color channel is obtained. According to the color error of the image to be compared and the image to be detected, the similarity of the color of the image to be compared and the image to be detected in each color channel can be known. If the color error is within the preset error range, it means that the color of the image to be compared and the image to be detected is not much different, and the image to be detected can be determined to be abnormal. The color cast of the image to be detected can be known as a whole by means of color error, thereby improving the comprehensiveness of the detection of image abnormalities in the image to be detected.

[0062] Optionally, before extracting at least one sub-image from the image to be detected, the method further includes: detecting whether the color of the image to be detected is abnormal based on the ratio of the image average chromaticity and the chromaticity center distance of the image to be detected.

[0063] Among them, chromaticity is the property of color excluding brightness, which is used to reflect the hue and saturation of color. The average chromaticity of an image refers to the average value of each chromaticity of the image. The chromaticity center distance refers to the distance between adjacent chromaticity centers. In an embodiment of the present invention, the chromaticity of an image can be determined by an RGB chromaticity model.

[0064] Specifically, the image to be detected is tested for color anomalies through the equivalent circle theory to obtain the image average chromaticity of the image, the chromaticity center distance is obtained according to the variance of the average chromaticity, and the ratio between the image average chromaticity and the chromaticity center distance of the image to be detected, that is, the color cast factor, is used to determine whether the image to be detected has color anomalies. The larger the color cast factor, the more serious the color cast, and therefore, a color cast threshold can be set. When the color cast factor is greater than the color cast threshold, the color anomaly of the image to be detected is determined, that is, the color cast. The color anomaly of the image to be detected is detected by means of the equivalent circle theory of the embodiment of the present invention, and the detection speed is fast and the detection effect is good. Especially for RGB images, the effect is even better. Of course, the embodiment of the present invention is not limited to the method using the equivalent circle theory alone. For example, the image color cast processing using the BP neural network can also be used.

[0065] In another embodiment of the present invention, see Figure 2 After obtaining the image to be detected in step S110, the method further includes: S150, performing a screen blackness detection on the image to be detected; if the blackness of the image to be detected is less than a preset blackness, detecting whether the color of the image to be detected is abnormal.

[0066] The image blackness detection refers to detecting the brightness of the image to be detected, and the preset blackness is used to determine the brightness of the image. The preset blackness refers to a preset threshold value, which can be set according to actual conditions.

[0067] In the implementation of the present invention, the image to be detected is subjected to screen blackness detection to obtain the blackness of the image to be detected. If the blackness is less than the preset blackness, it is determined that the image to be detected is not a blackness image, and the step of color anomaly detection of the image to be detected is performed. It should be understood that the brightness of the blackness image here is determined according to the blackness threshold, and does not specifically refer to an image with a completely black screen. Optionally, for the screen blackness detection of the image to be detected, the image to be detected can be first converted into a grayscale image, and then the grayscale value of each pixel of the grayscale image is calculated. If the number of pixels whose grayscale values ​​are less than the preset grayscale threshold reaches the preset threshold, or the ratio of the number of pixels whose grayscale values ​​are less than the preset grayscale threshold to the total number of pixels reaches the preset threshold, it is determined that the image to be detected is a blackness image, then the calculation is stopped, and the image to be detected is output as a blackness image. If not, the image to be detected is subjected to color anomaly detection. Optionally, the preset grayscale threshold can be 20. The blackness image can be eliminated by this step. For example, after the image to be detected is converted into a grayscale image, the grayscale values ​​b1, b2, ... bn of each pixel are obtained, and then the number C of pixels whose grayscale values ​​are less than the preset grayscale threshold A among the n grayscale values ​​is counted. If the number C reaches the preset threshold D, the image to be detected is determined to be a black image, or, if the ratio of the number C to n reaches the preset threshold D, the image to be detected is determined to be a black image.

[0068] Optionally, after obtaining the image to be detected in S110, it also includes: S160, obtaining the target average value of the image to be detected, if the target average value is not within the pure color threshold range, detecting whether the color of the image to be detected is abnormal; the target average value refers to the average value obtained by calculating the average value of each color channel of the image to be detected.

[0069] In the embodiment of the present invention, after obtaining the image to be detected, the target average value of the image to be detected is obtained. If the target average value is within the pure color threshold range, the image to be detected is a pure color image, and the subsequent steps are stopped, and the image to be detected is output as a pure color image. If the target average value is not within the pure color threshold range, the image to be detected is not a pure color image, and the subsequent steps of detecting whether the color of the image to be detected is abnormal are performed.

[0070] In the embodiment of the present invention, through the above S150 and S160, the image to be detected can be preprocessed to remove black images and pure color images, so as to avoid the black images and pure color images affecting the accuracy of subsequent abnormality detection of the image to be detected. The image abnormality of the image to be detected in the embodiment of the present invention may refer to color cast of the image.

[0071] Optionally, S150 may be performed first, and then S160, and after S150 is performed, the image to be detected is color restored to obtain the original image to be detected, and then step S160 is performed. Of course, S160 may also be performed first, and then S150.

[0072] Optionally, if the image to be detected is a surveillance video, after obtaining that the image to be detected is a black image, the detection result that the surveillance video image is a black image can be directly output. Of course, other images in the surveillance video can also be subjected to black detection. When the detection results of multiple images of the surveillance video are all black images, the detection result that the surveillance video image is a black image is output. Pure color detection of the image to be detected can also be performed by making a preliminary judgment on the abnormality of the surveillance video corresponding to the image to be detected through this step. The judgment process is the same and will not be repeated.

[0073] Optionally, if the image to be detected is a surveillance video image, the reason for the generation of the black image / pure color image may be poor ambient light when shooting the surveillance video. A detection result of the image to be detected being a black image / pure color image can be generated, and the detection result can be sent to the lower-level domain where the monitoring device is located, so that the staff of the lower-level domain can verify the reasons for the abnormality of the surveillance video.

[0074] Optionally, if the image to be detected is a surveillance video image, the image with color abnormality output by S150 and S160 can be traced back to whether it is a line abnormality of the surveillance device or other problems. In addition, the above two steps can remove the influence of noise on the subsequent surveillance video screen abnormality detection, and improve the accuracy of the surveillance video screen abnormality determination. The image abnormality of the image to be detected can be obtained through S110-S140, and then the surveillance device abnormality corresponding to the surveillance video to which the image to be detected belongs can be obtained. The surveillance device abnormality includes the optical sensor of the camera of the surveillance device, the network transmission abnormality of the fault monitoring device, and other problems.

[0075] In another embodiment of the present invention, extracting at least one sub-image from the image to be detected includes: extracting five sub-images of the same size from four corners and a central area of ​​the image to be detected, wherein the five sub-images do not overlap with each other.

[0076] In the embodiment of the present invention, the four corners and the central area of ​​the image to be detected can be cut out into five sub-images of the same size, see Figure 3 , pre-set the size of the sub-image, and then cut out sub-images of the preset size at the four corners and the center area of ​​the image to be detected. Optionally, the sub-images do not overlap with each other. Of course, overlap is also possible. By selecting the four corners and the center area, the edge area and the center area of ​​the image to be detected are used as sub-images for color anomaly detection, so that the information in the sub-image is more comprehensive. It should be understood that the numbers 1-5 in each sub-image are only for distinguishing different sub-images, and can also be used to distinguish between different sub-images when calculating the mean square error of the sub-images.

[0077] Alternatively, you can use the methods provided by opencv, such as: Mat roi5(img2,Rect(cv::Point(0.66*Cols,0.66*Rows),cv::Point(Cols,Rows))). Figure 4 For each sub-image, the length and width of the sub-image have no fixed values ​​and are determined according to the actual situation.

[0078] In another embodiment of the present invention, a preferred solution is provided. Figure 4, the image to be detected in the embodiment of the present invention is a surveillance video image, the image to be detected is obtained, the image to be detected is read into the memory, and it is determined whether the reading is successful, if not, it is read again, if so, the brightness of the image to be detected is detected, by converting the image to be detected into a grayscale image, obtaining the grayscale value of each pixel in the grayscale image, and obtaining the proportion of pixels with grayscale values ​​less than 20 in the total pixels. If the proportion reaches the preset proportion threshold, the image to be detected is a black image, and the surveillance video image corresponding to the image to be detected is a black image. If the image to be detected is not a black image, the image to be detected is restored to an RGB image. If the average value of the average values ​​of the RGB three channels of each pixel of the image to be detected is within the preset pure color range, it is determined that the image to be detected is a pure color image, and the surveillance video image corresponding to the image to be detected is a pure color image. It should be noted that if the image to be detected is a black image through the above-mentioned black detection, or the image to be detected is a pure color image through the pure color detection, the detection result is sent to the lower domain where the monitoring device corresponding to the surveillance video is located. The detection results include whether the monitoring video image is a black image or a pure color image, the identification of the monitoring video and the identification of the monitoring device, etc. The detection results are used to remind the staff so that the staff can conduct subsequent inspections of the monitoring device or monitoring environment based on the detection results.

[0079] Further, after obtaining that the image to be detected is not a pure color image, the color anomaly of the image to be detected is determined by the equivalent circle theory. If the color of the image to be detected is determined to be abnormal, 5 sub-images of the same size are cut out from the four corners and the middle area of ​​the image to be detected, and the color anomaly of each sub-image is determined by the equivalent circle theory. If there are color anomalies in 3 sub-images, the mean square error of the image to be detected and each sub-image is determined to determine whether each mean square error is within a first preset range. If so, the color of the image to be detected is restored by a white balance algorithm to obtain an image to be compared, and the average value of each color channel of the image to be compared and the image to be detected is calculated to determine whether each difference is within a preset difference range. If so, the picture of the surveillance video corresponding to the image to be detected is abnormal. Optionally, the color channel may refer to the three RGB color channels.

[0080] In an embodiment of the present invention, the mean square error of the image to be detected and each sub-image is determined to determine whether each mean square error is within a first preset range. The mean square error of the image to be detected and each sub-image can be calculated to obtain the difference, and then it is determined whether each difference is within the first preset difference range.

[0081] Exemplarily, the image to be detected is color restored by a white balance algorithm to obtain the image to be compared, the average values ​​of each pixel of the three RGB color channels of the image to be compared and the image to be detected, see Table 1, and then the average value of each color channel is calculated to obtain the difference. For example, the average value of the image to be detected in the B color channel is 137.779, and the average value of the image to be compared in the B color channel is 136.194. The difference between the two average values ​​is the difference of the B color channel 1.585. Similarly, the difference of the G color channel is 20.93, and the difference of the R color channel is -19.843. It should be noted that the absolute value of the difference can be selected for comparison. If the first preset difference range is (0, 15), there is a difference between the R color channel and the G color channel that is not within the first preset difference range, indicating that the color of the image to be detected is normal.

[0082] Table 1

[0083] aisle B G R Image to be detected 137.779 114.839 156.084 Image to be compared 136.194 135.769 136.241

[0084] In the embodiment of the present invention, after the abnormality of the monitoring video is obtained, an early warning message can be sent to the lower-level domain where the monitoring device corresponding to the monitoring video is located, so that the staff of the lower-level domain can check the monitoring device or the environment where the monitoring device is located according to the early warning information. The early warning information includes the abnormality of the monitoring video, the abnormality of the image to be detected, the identification of the monitoring device, etc. In the embodiment of the present invention, the abnormality of the image to be detected mainly refers to the color cast of the image.

[0085] The technical solution of the embodiment of the present invention detects blackness and pure color of the image, removes blackness image and pure color image, and improves the efficiency and accuracy of subsequent image color cast detection. The embodiment of the present invention does not limit the format of the image, etc., and has good Robust performance. It can be used for complex and diverse environments and a wide variety of camera devices, resulting in different sizes, image types, and image contents of surveillance video images. The technical solution of the embodiment of the present invention can perform image anomaly detection on the above-mentioned surveillance video images, and has good universality.

[0086] The technical solution of the embodiment of the present invention realizes the detection of color anomalies in the monitoring video. Through blackness detection and pure color detection, the abnormality of the monitoring video can be eliminated first.

[0087] In another embodiment of the present invention, an image detection device is provided. The image detection device provided by the embodiment of the present invention can execute the image detection method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. Figure 5The device comprises: an image acquisition module 610, a sub-image acquisition module 620, a mean square error acquisition module 630 and a picture abnormality determination module 640; wherein:

[0088] An image acquisition module 610 is used to acquire an image to be detected; a sub-image acquisition module 620 is used to extract at least one sub-image from the image to be detected when the color of the image to be detected is abnormal; a mean square error acquisition module 630 is used to determine the number of sub-images with color abnormalities in the at least one sub-image, and to determine the mean square error corresponding to the image to be detected and the at least one sub-image respectively; a picture abnormality determination module 640 is used to determine that the picture of the image to be detected is abnormal if the number of sub-images with color abnormalities meets a preset condition and the mean square errors corresponding to the image to be detected and the at least one sub-image respectively are within a first preset range.

[0089] Furthermore, in the embodiment of the present invention, the image abnormality determination module 640 is also used to:

[0090] Performing color restoration on the image to be detected to obtain an image to be compared;

[0091] The determining whether the image to be detected is abnormal includes:

[0092] If the color errors of the image to be compared and the image to be detected in each color channel are within a preset error range, it is determined that the image to be detected has an abnormality.

[0093] Furthermore, in an embodiment of the present invention, the device further includes:

[0094] The color anomaly determination module is used to detect whether the color of the image to be detected is abnormal according to the ratio of the image average chromaticity and the chromaticity center distance of the image to be detected.

[0095] Furthermore, in an embodiment of the present invention, the device further includes:

[0096] The blackness detection module is used to perform blackness detection on the image to be detected; if the blackness of the image to be detected is less than a preset blackness, then detect whether the color of the image to be detected is abnormal.

[0097] Furthermore, in an embodiment of the present invention, the device further includes:

[0098] The pure color detection module is used to obtain the target average value of the image to be detected. If the target average value is not within the pure color threshold range, it is used to detect whether the color of the image to be detected is abnormal; the target average value refers to the average value obtained by calculating the average value of each color channel of the image to be detected.

[0099] Furthermore, in the embodiment of the present invention, the sub-image acquisition module 620 is further used for:

[0100] Five sub-images of the same size are cut out from the four corners and the central area of ​​the image to be detected, and the five sub-images do not overlap with each other.

[0101] Furthermore, in an embodiment of the present invention, the image to be detected is a surveillance video image; the device further includes:

[0102] The device abnormality determination module is used to determine that the monitoring device corresponding to the monitoring video has an abnormality if it is detected that at least one image in the monitoring video corresponding to the image to be detected has an abnormality.

[0103] The technical solution of the embodiment of the present invention obtains the image to be detected, and in the case that the color of the entire image to be detected is abnormal, at least one sub-image is intercepted from the image to be detected. The number of sub-images with color abnormalities is determined in at least one sub-image, and the mean square error corresponding to the image to be detected and at least one sub-image is determined. If the number of sub-images with color abnormalities meets the preset conditions, and the mean square errors corresponding to the image to be detected and at least one sub-image are both within the first preset range, it is determined that the image to be detected is abnormal. The technical solution of the embodiment of the present invention first obtains whether the image to be detected is abnormal in color from the whole, and then determines whether the number of sub-images with color abnormalities meets the preset conditions, and whether the mean square error of the image to be detected and at least one sub-image is within the first preset range. If both are true, it is determined that the image to be detected is abnormal. The embodiment of the present invention analyzes the image to be detected from the whole and the part to improve the accuracy of image detection, and by using a computer to detect whether the image is abnormal, each frame of the video can be detected one by one. Compared with the manual inspection method, there will be no missed detection, and the detection efficiency can also be improved. It is worth noting that the various modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the various functional modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present invention.

[0104] In another embodiment of the present invention, an electronic device is provided. Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 6 A block diagram of an exemplary electronic device 50 suitable for implementing exemplary embodiments of the present invention is shown. Figure 6 The electronic device 50 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0105] like Figure 6As shown, the electronic device 50 is in the form of a general computing device. The components of the electronic device 50 may include but are not limited to: one or more processors or processing units 501, a system memory 502, and a bus 503 connecting different system components (including the system memory 502 and the processing unit 501).

[0106] Bus 503 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0107] The electronic device 50 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 50, including volatile and non-volatile media, removable and non-removable media.

[0108] System memory 502 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 504 and / or cache memory 505. Electronic device 50 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 506 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 503 via one or more data medium interfaces. The memory 502 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the embodiments of the present invention.

[0109] A program / utility 508 having a set (at least one) of program modules 507 may be stored, for example, in the memory 502, such program modules 507 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 507 generally perform the functions and / or methods of the embodiments described herein.

[0110] The electronic device 50 may also communicate with one or more external devices 509 (e.g., keyboards, pointing devices, displays 510, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 50, and / or communicate with any device that enables the electronic device 50 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed through an input / output (I / O) interface 511. Furthermore, the electronic device 50 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 512. As shown, the network adapter 512 communicates with other modules of the electronic device 50 through the bus 503. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0111] The processing unit 501 executes various functional applications and data processing by running the programs stored in the system memory 502, such as implementing the image frame detection method provided in the embodiment of the present invention.

[0112] In another embodiment of the present invention, a storage medium containing computer executable instructions is further provided. When the computer executable instructions are executed by a computer processor, they are used to perform an image frame detection method, the method comprising:

[0113] Acquire an image to be detected; if the color of the image to be detected is abnormal, extract at least one sub-image from the image to be detected; determine the number of sub-images with abnormal colors in the at least one sub-image, and determine the mean square error corresponding to the image to be detected and the at least one sub-image respectively; if the number of sub-images with abnormal colors meets a preset condition, and the mean square errors corresponding to the image to be detected and the at least one sub-image respectively are within a first preset range, determine that the image to be detected is abnormal.

[0114] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0115] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0116] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0117] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0118] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. An image detection method, characterized in that: include: Acquire the image to be detected; When the image to be detected is neither a black image nor a pure color image, determining the color abnormality of the image to be detected by using the equivalent circle theory; When the color of the image to be detected is abnormal, extracting a plurality of sub-images from the image to be detected; The color anomaly of each sub-image is determined by using the equivalent circle theory; Determining the number of sub-images with abnormal colors among the multiple sub-images, and determining the mean square errors corresponding to the image to be detected and the multiple sub-images; If the number of sub-images with color abnormalities meets a preset condition, and the mean square errors corresponding to the image to be detected and the multiple sub-images are all within a first preset range, the image to be detected is color restored to obtain an image to be compared. If the color errors of the image to be compared and the image to be detected in each color channel are all within a preset error range, it is determined that the image to be detected has a picture abnormality, wherein the image to be detected is a monitoring image, and the picture abnormality of the image to be detected refers to picture color cast.

2. The image detection method according to claim 1, characterized in that: Before extracting a plurality of sub-images from the image to be detected, the method further includes: Whether the color of the image to be detected is abnormal is detected according to the ratio of the image average chromaticity and the chromaticity center distance of the image to be detected.

3. The image detection method according to any one of claims 1 to 2, characterized in that: After acquiring the image to be detected, the method further includes: Performing screen blackness detection on the image to be detected; If the blackness of the image to be detected is less than the preset blackness, it is detected whether the color of the image to be detected is abnormal.

4. The image detection method according to any one of claims 1 to 2, characterized in that: After acquiring the image to be detected, the method further includes: The target average value of the image to be detected is obtained. If the target average value is not within the pure color threshold range, the color of the image to be detected is detected to see if it is abnormal; the target average value refers to the average value obtained by calculating the average value of each color channel of the image to be detected.

5. The image detection method according to any one of claims 1 to 2, characterized in that: The extracting a plurality of sub-images from the image to be detected comprises: Five sub-images of the same size are cut out from the four corners and the central area of ​​the image to be detected, and the five sub-images do not overlap with each other.

6. The image detection method according to claim 1, characterized in that: The image to be detected is a surveillance video image; The method further comprises: If it is detected that the images of multiple images in the monitoring video corresponding to the image to be detected are abnormal, it is determined that there is an abnormality in the monitoring device corresponding to the monitoring video.

7. An image detection device, characterized in that: include: An image acquisition module is used to acquire an image to be detected; when the image to be detected is neither a black image nor a pure color image, the color anomaly of the image to be detected is determined by using the equivalent circle theory; A sub-image acquisition module is used to determine the color anomaly of each sub-image by using the equivalent circle theory; when the color of the image to be detected is abnormal, a plurality of sub-images are intercepted from the image to be detected; A mean square error acquisition module, used to determine the number of sub-images with abnormal colors among the multiple sub-images, and determine the mean square errors corresponding to the image to be detected and the multiple sub-images; The screen abnormality determination module is used to restore the color of the image to be detected to obtain the image to be compared if the number of sub-images with color abnormalities meets a preset condition and the mean square errors corresponding to the image to be detected and the multiple sub-images are all within a first preset range; if the color errors of the image to be compared and the image to be detected in each color channel are all within a preset error range, the screen abnormality of the image to be detected is determined, wherein the image to be detected is a monitoring image, and the screen abnormality of the image to be detected refers to screen color cast.

8. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the image detection method as described in any one of claims 1-6.

9. A storage medium comprising computer executable instructions, characterized in that: The computer executable instructions are used to execute the image frame detection method as described in any one of claims 1-6 when executed by a computer processor.

Citation Information

Patent Citations

  • Method and system for detecting color cast

    CN102905160A

  • Image anomaly detection method, terminal equipment and storage medium

    CN110572637A