Camera operation anomaly detection method based on image processing

Through the camera work abnormality detection method based on image processing, the problem of harsh environment and poor light conditions affecting the accuracy of camera detection is solved, and camera abnormality detection with high accuracy and high detection rate is achieved, which reduces the chance of system control misoperation, and can distinguish the cause of camera movement and occlusion.

CN114648734BActive Publication Date: 2025-04-11TIANDI CHANGZHOU AUTOMATION +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210342835.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2025-04-11
Estimated Expiration
2042-03-31

AI Technical Summary

Technical Problem

In the prior art, due to the harsh environment and poor light conditions, the accuracy of camera angle movement detection and occlusion detection is affected, resulting in the output results of the detection method being unable to be connected to the system to participate in system control.

Method used

A camera operation abnormality detection method based on image processing is adopted, including an image acquisition module and an image processing module. The image processing module detects whether the camera moves or blocks when it detects an abnormality and issues an early warning signal by fetching frames on the camera's real-time target video.

Benefits of technology

This method can maintain high accuracy and high detection rate under harsh environments and poor light conditions, reduce malfunctions of the system control device, ensure data validity and reliability, and distinguish whether the camera is moved or blocked.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114648734B_ABST
    Figure CN114648734B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of camera detection technology, and in particular to a camera operation abnormality detection method based on image processing, comprising: an image acquisition module acquires real-time target video of a camera, sends the target video to an image processing module, the image processing module acquires the target video, takes pictures of the target video frame by frame to obtain multiple frames of continuous target images, the image processing module detects and analyzes the target image, detects whether the camera moves, or detects whether the camera is blocked; obtains the detection result of the image processing module, and when the detection result is that the camera moves, or the camera is blocked, saves the video as an evidence video, and sends an early warning signal. The present invention provides a camera operation abnormality detection method based on image processing, which can be not directly affected by external factors such as harsh environment and poor light conditions, and has accurate detection and high detection rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of camera detection, and in particular to a camera operation abnormality detection method based on image processing. Background Art

[0002] With the introduction of image recognition detection methods, image recognition detection technology has been widely used, but there are still many shortcomings. In camera lens detection, due to harsh environment, poor lighting conditions and other external factors, the accuracy of camera angle movement detection and camera occlusion detection is directly affected, resulting in low accuracy of detection methods for different application scenarios in complex environments, making it impossible for the output results of the detection method to be connected to the system to participate in system control. In order to enable the output results of detection methods for different application scenarios in coal mines to participate in system control, reduce the probability of misoperation of system control devices, and ensure the validity and reliability of collected data, it is urgent to develop a camera abnormality detection method based on image processing. Summary of the invention

[0003] The technical problem to be solved by the present invention is: in order to solve the problem that in the prior art the accuracy of camera angle movement detection and camera occlusion detection is directly affected by external factors such as harsh environment and poor lighting conditions, the present invention provides a camera working abnormality detection method based on image processing, which is not directly affected by external factors such as harsh environment and poor lighting conditions, and has accurate detection and high detection rate.

[0004] The technical solution adopted by the present invention to solve the technical problem is: a method for detecting abnormality of camera operation based on image processing, the detection method comprising:

[0005] Step S1: The image acquisition module acquires the real-time target video of the camera and sends the target video to the image processing module.

[0006] Step S2: the image processing module acquires the target video, takes images of the target video frame by frame to obtain multiple frames of continuous target images, and the image processing module detects and analyzes the target images to detect whether the camera moves or whether the camera is blocked;

[0007] Step S3: Obtain the detection result of the image processing module. When the detection result is that the camera moves or the camera is blocked, save the video as an evidence video and issue a warning signal.

[0008] Further, specifically, before executing the step S1, after the camera is powered on, the image acquisition module acquires a reference video according to the current reference position of the camera.

[0009] Further, specifically, in step S2, detecting whether the camera moves includes the following steps:

[0010] Step S211: Create a folder;

[0011] Step S212: Obtain the system time H1 of the target image, the target image is the current frame target image, establish the image name of the current frame target image with the system time H1, the image name of the current frame target image is H1.jpg, initialize the target image of the current frame, transfer the target image of the current frame to the folder, the target image of the current frame is the initial feature matching image for detecting whether the camera moves;

[0012] Step S213: acquiring a next frame target image, the image name of the next frame target image is frame.jpg, the system time of the next frame target image is H2, and transmitting the next frame target image to the folder;

[0013] Step S214: determining whether the system time H1 of the target image of the current frame is equal to the system time H2 of the target image of the next frame;

[0014] If H1 is not equal to H2, then copy the next frame target image frame.jpg to the folder for backup, modify the image name of the copied next frame target image with the system hour H2, modify the image name of the copied next frame target image to H2.jpg, assign H2 to H1, and pre-process all the initial feature matching images and the next frame target image frame.jpg in the folder except the H2.jpg image;

[0015] If H1 is equal to H2, all initial feature matching images in the folder and the next frame target image frame.jpg are preprocessed;

[0016] Step S215: Calculate the number of the preprocessed initial feature matching images in the folder, the number of the preprocessed initial feature matching images is N, perform SIFT feature point matching on the initial feature matching images and the next frame target image frame.jpg, and obtain feature point matching results, the feature point matching results include the total number ap_count of all feature points matched between the initial feature matching image and the next frame target image frame.jpg;

[0017] Step S216: Set a count value i. When i < N, calculate the total number sp_count of all feature points on the next frame of target image frame.jpg that are the same feature point according to the feature point matching result. Calculate the ratio rate_i of the total number of the same feature points to the total number of all feature points, i.e., rate_i = sp_count / ap_count, until i ≥ N, then end the calculation;

[0018] Step S217: Obtain the maximum rate_i among all the initial feature matching images in the folder that match the next frame of target image frame.jpg. Save the maximum rate_i as max_rate, and compare it with a preset threshold threshold1;

[0019] If max_rate < threshold1 is satisfied, it is determined that the camera has moved; otherwise, if it is not satisfied, it is determined that the camera has not moved.

[0020] Specifically, when performing step S216 to calculate that all feature points on the next frame of target image frame.jpg are the same feature point, it includes the following steps: The feature points of the initial feature matching image are (x i , y i ), and the feature points of the next frame of target image are (X i , Y i ). Determine whether the feature points (x i , y i ) of the initial feature matching image and the feature points (X i , Y i ) of the next frame of target image are the same feature point;

[0021] If where threshold1 is a manually set value, then the feature points (x i , y i ) of the initial feature matching image and the feature points (X i , Y i ) of the next frame of target image are the same feature point, and the total number sp_count of the same feature points is incremented by 1; otherwise, the feature points (x i , y i ) of the initial feature matching image and the feature points (X i , Y i ) of the next frame of target image are not the same feature point, and the total number sp_count of the same feature points remains unchanged.

[0022] Furthermore, specifically, in step S2, detecting whether the camera is occluded includes the following steps:

[0023] Step S221: converting the target image into a grayscale image after grayscale processing;

[0024] Step S222: converting the grayscale image into a binary image after binarization processing;

[0025] Step S223: converting the binary image into an image with a black background color after inversion processing;

[0026] Step S224: performing a morphological operation on the image with a black background color to obtain a final input image;

[0027] Step S225: Calculate the connected area of ​​the input image, and determine whether the connected area satisfies the constraint conditions based on the calculation results; if the connected area satisfies the constraint conditions, the camera is occluded; if the connected area does not satisfy the constraint conditions, the camera is not occluded.

[0028] Further, specifically, the step 225 includes the following steps:

[0029] Step S2251: creating a first black image, the size of the first black image is the same as the size of the target image, using a connected region algorithm to obtain the number of connected regions of the input image that meet the requirements, the number of connected regions of the input image that meet the requirements is num_labels, and on the first black image, drawing num_labels connected regions in green;

[0030] Step S2252: Loop through num_labels connected regions, obtain the area A of each connected region, and calculate R i :

[0031]

[0032] Among them, S0, S1, S2, S3, and S4 are 200×200 areas selected from the upper left corner, lower left corner, upper right corner, lower right corner, and the middle of the target image, respectively. i is the area of ​​the i-th connected region, R i A i The area of ​​the connected region is related to S j The common area of ​​the area and S j The percentage of regional area;

[0033] Step S2253: Determine R i Whether the constraint R is satisfied i >0.8, if satisfied, the camera is blocked, otherwise, the camera is not blocked.

[0034] Further, specifically, in step 215, if H1 is not equal to H2 in step S214, the number N of the preprocessed initial feature matching images is the number of all initial feature matching images in the folder minus 1; conversely, if H1 is equal to H2 in step S214, the number of the preprocessed initial feature matching images is the number of all initial feature matching images in the folder.

[0035] Further, specifically, the number N of the preprocessed initial feature matching images in the folder is ≤24.

[0036] Further, specifically, when the detection result is that the camera moves or the camera is blocked, the detection method stops running and the evidence video is compared with the reference video.

[0037] The beneficial effect of the present invention is that the camera abnormality detection method based on image processing of the present invention is not directly affected by external factors such as bad environment and poor light conditions, and the detection is accurate and has a high detection rate; in addition, since the calculation amount of the present invention is small and the calculation speed is fast, the real-time performance is very good. Moreover, the application of the method of the present invention can distinguish whether the camera is moved or blocked, so it can point out the cause of the safety hazard in a targeted manner, which is convenient for practical application in coal mine scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0039] Figure 1 It is a method flow chart of the best embodiment of the present invention.

[0040] Figure 2 It is a flow chart of camera motion detection in the optimal embodiment of the present invention.

[0041] Figure 3 It is a flow chart of camera occlusion detection according to the best embodiment of the present invention.

[0042] Figure 4 This is an image in which the camera does not move according to an embodiment of the present invention.

[0043] Figure 5 This is a feature matching graph when the camera does not move according to an embodiment of the present invention.

[0044] Figure 6 This is a camera motion feature matching graph according to an embodiment of the present invention.

[0045] Figure 7 This is a camera occlusion image according to an embodiment of the present invention.

[0046] Figure 8This is the image after the camera occlusion image of the present invention is binarized. DETAILED DESCRIPTION

[0047] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, which only illustrate the basic structure of the present invention in a schematic manner, and therefore only show the components related to the present invention.

[0048] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention. In addition, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.

[0049] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0050] like Figure 1 As shown, it is the best embodiment of the present invention, a method for detecting abnormality of camera operation based on image processing, the detection method comprises the following steps:

[0051] Step S1: The image acquisition module acquires real-time target video from the camera and sends the target video to the image processing module.

[0052] Step S2: The image processing module obtains the target video, captures the target video frame by frame to obtain multiple frames of continuous target images, and the image processing module detects and analyzes the target images to detect whether the camera moves or whether the camera is blocked. Specifically, the camera movement is to determine whether the camera angle is offset, and the camera blockage is to determine whether there is an obstruction in front of the camera lens.

[0053] Step S3: Obtain the detection result of the image processing module. When the detection result is that the camera has moved or the camera is blocked, save the video as an evidence video and issue a warning signal.

[0054] In an embodiment of the present invention, before executing step S1, the camera is powered on first, and the image acquisition module acquires a reference video according to the current reference position of the camera. When the detection result is that the camera has moved or the camera is blocked, the evidence video is compared with the reference video to determine whether the detection method has a false detection phenomenon, thereby further improving the accuracy of the detection method.

[0055] like Figure 2 , Figure 4-6 As shown, in the embodiment of the present invention, in step S2, detecting whether the camera moves includes the following steps:

[0056] Step S211: Create a folder.

[0057] Step S212: Obtain the system time H1 of the target image, the target image is the current frame target image, establish the image name of the current frame target image with the system hour H1, the image name of the current frame target image is H1.jpg, initialize the target image of the current frame, transfer the target image of the current frame to a folder, the target image of the current frame is the initial feature matching image for detecting whether the camera moves.

[0058] Step S213: Get the next target image. The image name of the next target image is frame.jpg. The system time of the next target image is H2. The next target image is transferred to the folder. Specifically, the next target image is the image after the target image of the current frame in step S211 has an interval of Δh.

[0059] Step S214: Determine whether the system time H1 of the target image of the current frame is equal to the system time H2 of the target image of the next frame; if H1 is not equal to H2, copy the target image frame.jpg of the next frame to back it up in the folder, modify the image name of the target image of the next frame with the system time H2, modify the image name of the target image of the next frame to H2.jpg, assign H2 to H1, and pre-process all the initial feature matching images and the target image frame.jpg of the next frame except the image H2.jpg in the folder; if H1 is equal to H2, pre-process all the initial feature matching images and the target image frame.jpg of the next frame in the folder. In the implementation of the present invention, when H1 is not equal to H2, if H2.jpg is not removed for pre-processing, since H2.jpg and the target image frame.jpg of the next frame are the same image, the matching effect of H2.jpg and the target image frame.jpg of the next frame is good, which affects the accuracy of the detection method, and all the initial feature matching images and the target image frame.jpg of the next frame are removed for pre-processing, so as to further improve the detection accuracy and detection efficiency of the detection method.

[0060] Specifically, if the acquisition time of the current frame target image is 14:30, the current frame target image system time H1=14, the current frame target image name is 14.jpg, 14.jpg is saved to the folder, 14.jpg is the initial feature matching image, and after an interval of Δh time, the next frame target image frame.jpg is obtained.

[0061] If the acquisition time of the next frame target image is 14:40, the system time of the next frame target image H2=14, and the initial feature matching image and the next frame target image frame.jpg in the folder are preprocessed. The initial feature matching image includes at least 14.jpg, and all initial feature matching images can be 13.jpg, 14.jpg, 15.jpg, 16.jpg, but not limited to this.

[0062] If the acquisition time of the next target image is 15:20, the system time of the next target image is H2 = 15, 15 is not equal to 14, copy frame.jpg and back it up to the folder, change the name of the copied frame.jpg to 15.jpg, and change the value of 14 to 15, pre-process all the initial feature matching images and the next target image frame.jpg in the folder except the image 15.jpg, the initial feature matching image includes at least 14.jpg, and all target images can have 14.jpg, 13.jpg, 16.jpg, but not limited to this. Assign the value of H2 to H1, that is, change the value of 14 to 15, so as to facilitate automatic overwriting and reduce the memory consumption of the folder storage space. Only one image of 14.jpg will be saved in the time period of system hour 14. When H2 is assigned to H1, the next target image is the target image of the current frame, and the next target image is the target image of the next frame, and so on.

[0063] Step S215: Calculate the number of preprocessed initial feature matching images in the folder. The number of preprocessed initial feature matching images is N. If H1 is not equal to H2 in step S214, the number of initial feature matching images in the folder shows an increasing trend. The initial feature matching images in the folder include H2.jpg. The number N of preprocessed initial feature matching images is the number of all initial feature matching images in the folder minus 1. In other words, the number N of preprocessed initial feature matching images excluding H2.jpg is the number N of preprocessed initial feature matching images. Conversely, when H1 is equal to H2, the number N of preprocessed initial feature matching images is the number of all initial feature matching images in the folder. In an embodiment of the present invention, the number N of preprocessed initial feature matching images does not exceed 24. The image names of the initial feature matching images are established in system hours.

[0064] Perform SIFT feature point matching on each initial feature matching image and the next target image frame.jpg to obtain feature point matching results. The feature point matching results include the total number ap_count of all feature points matched between each initial feature matching image and the next target image frame.jpg. The calculation of feature points between the initial feature matching image and the next target image frame.jpg specifically includes the following steps:

[0065] First, a scale space is established, that is, a Difference of Gaussian (DoG) pyramid is established. The Gaussian Pyramid is obtained by blurring and downsampling the image using a Gaussian function.

[0066] Each image in the pyramid is represented by L(x, y, σ), which is calculated as:

[0067]

[0068] Among them, I(x, y) represents the image, G(x, y, σ) is the Gaussian function, Represents the convolution operation;

[0069] is the image scale parameter, and the blur coefficient.

[0070] Secondly, the detection of spatial extreme points (i.e. key points);

[0071] The key points are composed of local extreme points in the DoG space. The initial detection of key points is completed by comparing the two adjacent layers of each DoG image in the same group. In order to find the extreme points of the DoG function, each pixel point must be compared with all its neighboring points to see whether it is larger or smaller than its neighboring points in the image domain and scale domain. The DoG (Difference of Gaussian) function expression is:

[0072]

[0073] Then, the feature point direction is assigned. After completing this step, each feature point has three pieces of information: position, scale, and direction. In order to make the descriptor rotationally invariant, it is necessary to use the local features of the image to assign a reference direction to each key point. The image gradient method is used to obtain the stable direction of the local structure.

[0074] For the key points detected in the DoG pyramid, the gradient and direction distribution characteristics of the pixels in the 3σ domain window of the Gaussian pyramid image are collected. The modulus and direction of the gradient are as follows:

[0075]

[0076] θ(x, y) = tan -1 ((L(x,y+1)-L(x,y-1)) / (L(x+1,y)-L(x-1,y)));

[0077] Among them, L is the scale space value of the key point.

[0078] Finally, the feature descriptor is calculated. Through the above steps, for each key point, three pieces of information are obtained: position, scale, and direction. Next, a descriptor is established for each key point so that it does not change with various changes, such as changes in lighting, changes in viewing angle, etc. And the descriptor should have a high degree of uniqueness to increase the probability of the initial feature matching image and the next frame target image frame.jpg feature points correctly matching.

[0079] Step S216: Set a count value i. When i < N, calculate the total number sp_count of all feature points on the next-frame target image frame.jpg that are the same feature point according to the feature point matching result, and calculate the ratio rate_i = sp_count / ap_count of the total number of the same feature points to the total number of all feature points until i ≥ N, at which point the calculation ends. In step 216, loop through and calculate rate_i for the matching of each initial feature matching image and the next-frame target image frame.jpg in sequence until the end.

[0080] In an embodiment of the present invention, when performing step S216, calculating that all feature points on the next-frame target image frame.jpg are the same feature point includes the following steps: When performing step S216 to calculate that all feature points on the next-frame target image frame.jpg are the same feature point, it includes the following steps: The feature point of the initial feature matching image is (x i , y i ), and the feature point of the next-frame target image is (X i , Y i ). Determine whether the feature point (x i , y i ) of the initial feature matching image and the feature point (X i , Y i ) of the next-frame target image are the same feature point; if where threshold2 is a manually set value, then the feature point (x i , y i ) of the initial feature matching image and the feature point (X i , Y i ) of the next-frame target image are the same feature point, and the total number sp_count of the same feature points is incremented by 1; otherwise, the feature point (x i , y i ) of the initial feature matching image and the feature point (X i , Y i ) of the next-frame target image are not the same feature point, and the total number sp_count of the same feature points remains unchanged. Among them, the value range of threshold2 is 50 to 150, preferably the value of threshold2 is 100. Then, when determining whether the feature point (x i , y i ) of the initial feature matching image and the feature point (X i , Y i ) of the next-frame target image are the same feature point, the determination accuracy is better, and the accuracy of the detection method is improved.

[0081] Step S217: Obtain the maximum rate_i among all the initial feature matching images in the folder that matches the next-frame target image frame.jpg. Save the maximum rate_i as max_rate. Compare max_rate with the preset threshold threshold1. If max_rate < threshold1 is satisfied, it is determined that the camera has moved. Conversely, if it is not satisfied, it is determined that the camera has not moved. The range of the preset threshold threshold1 is 0.6 to 0.8. Preferably, the preset threshold threshold1 is 0.7, which has a higher detection rate when detecting whether the camera has moved.

[0082] As Figure 3 , Figure 7-8 shown, in the embodiment of the present invention, in step S2, detecting whether the camera is occluded includes the following steps:

[0083] Step S221: After graying the target image, convert it into a grayscale image. The conversion formula is:

[0084] Gray = 0.1140 * B + 0.5870 * G + 0.2989 * R

[0085] where Gray represents the grayscale image, and B, G, and R represent the three channels in the color image.

[0086] Step S222: After binarizing the grayscale image, convert it into a binary image. Use the OTSU algorithm for binarization operation, which is not affected by the image brightness and contrast and can determine the segmentation threshold for image binarization to maximize the between-class variance of the foreground and background images in the image;

[0087] Step S223: After inverting the binary image, convert it into an image with a black background color. Obtain an image with a black background color by reversing all pixel values in the binary image bit by bit;

[0088] Step S224: After performing morphological operations on the image with a black background color, obtain the final input image. Specifically, first perform an opening operation on the image with a black background color, and then perform a closing operation. The opening operation is erosion followed by dilation, and the closing operation is dilation followed by erosion.

[0089] Specifically, the dilation formula is:

[0090] dst(x, y) = max (x′,y′):element(x′,y′)≠0 src(x + x′, y + y′);

[0091] The erosion formula is:

[0092] dst(x, y) = min (x′,y′):element(x′,y′)≠0src(x+x′,y+y′);

[0093] The opening operation formula is:

[0094] dst=open(src,element)=dilate(erode(src,element));

[0095] The closing operation formula is:

[0096] dst=close(src,element)=erode(dilate(src,element));

[0097] Among them, src is the original image, dst is the image after operation, element: the kernel of corrosion operation or expansion operation.

[0098] Step S225: Calculate the connected area of ​​the input image, and determine whether the connected area satisfies the constraint conditions based on the calculation results; if the connected area satisfies the constraint conditions, the camera is blocked; if the connected area does not satisfy the constraint conditions, the camera is not blocked.

[0099] In the embodiment of the present invention, executing step S225 specifically includes the following steps:

[0100] Step S2251: Create a first black image, the first black image is an image with a black background color, the size of the first black image is the same as the size of the target image, use the connected region algorithm to obtain the number num_labels of connected regions of the input image that meet the requirements, and draw num_labels connected regions in green on the first black image;

[0101] Step S2252: Loop through num_labels connected regions, obtain the area A of each connected region, and calculate R i (Percentage value):

[0102]

[0103] Among them, S0, S1, S2, S3, and S4 are 200×200 areas selected from the upper left corner, lower left corner, upper right corner, lower right corner, and the center of the target image, respectively. i is the area of ​​the i-th connected region, R i A i The area of ​​the connected region is related to S j The common area of ​​the area and S j The percentage of regional area;

[0104] Step S2253: Determine R i Whether the constraint R is satisfiedi >0.8, if it is satisfied, the camera is blocked, otherwise, the camera is not blocked.

[0105] In summary, the camera abnormality detection method based on image processing of the present invention is not directly affected by external factors such as harsh environment and poor light conditions, and has accurate detection and high detection rate; in addition, since the calculation amount of the present invention is small and the calculation speed is fast, the real-time performance is very good. In addition, the application of the method of the present invention can distinguish whether the camera is moved or blocked, so it can point out the cause of the safety hazard in a targeted manner, which is convenient for practical application in coal mine scenes.

[0106] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.

Claims

1. A camera operation abnormality detection method based on image processing, characterized in that: The detection method comprises: Step S1: The image acquisition module acquires real-time target video from the camera and sends the target video to the image processing module; Step S2: the image processing module acquires the target video, takes images of the target video frame by frame to obtain multiple frames of continuous target images, and the image processing module detects and analyzes the target images to detect whether the camera moves or whether the camera is blocked; Step S3: obtaining the detection result of the image processing module, and when the detection result is that the camera moves or the camera is blocked, saving the video as an evidence video and issuing a warning signal; In step S2, detecting whether the camera moves comprises the following steps: Step S211: Create a folder; Step S212: Obtain the system time H1 of the target image, the target image is the current frame target image, establish the image name of the current frame target image with the system time H1, the image name of the current frame target image is H1.jpg, initialize the target image of the current frame, transfer the target image of the current frame to the folder, the target image of the current frame is the initial feature matching image for detecting whether the camera moves; Step S213: acquiring a next frame target image, the image name of the next frame target image is frame.jpg, the system time of the next frame target image is H2, and transmitting the next frame target image to the folder; Step S214: determining whether the system time H1 of the target image of the current frame is equal to the system time H2 of the target image of the next frame; If H1 is not equal to H2, then copy the next frame target image frame.jpg to the folder for backup, modify the image name of the copied next frame target image with the system hour H2, modify the image name of the copied next frame target image to H2.jpg, assign H2 to H1, and pre-process all the initial feature matching images and the next frame target image frame.jpg in the folder except the H2.jpg image; If H1 is equal to H2, all initial feature matching images in the folder and the next frame target image frame.jpg are preprocessed; Step S215: Calculate the number of the preprocessed initial feature matching images in the folder, the number of the preprocessed initial feature matching images is N, perform SIFT feature point matching on the initial feature matching images and the next frame target image frame.jpg, and obtain feature point matching results, the feature point matching results include the total number ap_count of all feature points matched between the initial feature matching image and the next frame target image frame.jpg; Step S216: Set a count value i. When i < N, calculate the total number sp_count of all feature points on the next-frame target image frame.jpg that are the same feature point according to the feature point matching result, and calculate the ratio of the total number of the same feature points to the total number of all feature points , until when i ≥ N, end the calculation; Step S217: obtaining the maximum rate_i among all the initial feature matching images in the folder that matches the next target image frame.jpg, saving the maximum rate_i as max_rate, and comparing a preset threshold threshold1 with the max_rate; If max_rate < threshold1, the camera is considered to be moving; On the contrary, if it is not satisfied, it is determined that the camera has not moved.

2. The method for detecting camera abnormality based on image processing as claimed in claim 1, characterized in that: Before executing the step S1, after the camera is powered on, the image acquisition module acquires a reference video according to the current reference position of the camera.

3. The method for detecting camera abnormality based on image processing as claimed in claim 1, characterized in that: When executing step S216 to calculate that all feature points on the next frame target image frame.jpg are the same feature points, the following steps are included: The feature points of the initial feature matching image are (x i ,y i ), the feature points of the next frame target image (X i , Y i ), determine the feature point of the initial feature matching image as (x i ,y i ) and the feature points of the next frame target image (X i , Y i ) are the same feature point; like , where threshold2 is a manually set value, then the feature points of the initial feature matching image are (x i ,y i ) and the feature points of the next frame target image (X i , Y i ) are the same feature points, and the total number of the same feature points sp_count is increased by 1; On the contrary, the feature points of the initial feature matching image are (x i ,y i ) and the feature points of the next frame target image (X i , Y i ) are not the same feature points, the total number sp_count of the same feature points remains unchanged.

4. The method for detecting camera abnormality based on image processing as claimed in claim 1, characterized in that: In step S2, detecting whether the camera is blocked includes the following steps: Step S221: converting the target image into a grayscale image after grayscale processing; Step S222: converting the grayscale image into a binary image after binarization processing; Step S223: converting the binary image into an image with a black background color after inversion processing; Step S224: performing a morphological operation on the image with a black background color to obtain a final input image; Step S225: Calculate the connected area of ​​the input image, and determine whether the connected area satisfies the constraint condition according to the calculation result; If the connected area satisfies the constraint condition, the camera is blocked; If the connected area does not satisfy the constraint condition, the camera is not blocked.

5. The method for detecting camera operation abnormality based on image processing as claimed in claim 4, characterized in that: The execution of step 225 includes the following steps: Step S2251: creating a first black image, the size of the first black image is the same as the size of the target image, using a connected region algorithm to obtain the number num_labels of connected regions of the input image that meet the requirements, and drawing num_labels connected regions in green on the first black image; Step S2252: Loop through num_labels connected regions, obtain the area A of each connected region, and calculate R i : ; Among them, S0, S1, S2, S3, and S4 are 200×200 areas selected from the upper left corner, lower left corner, upper right corner, lower right corner, and the middle of the target image, respectively. i is the area of ​​the i-th connected region, R i A i The area of ​​the connected region is related to S j The common area of ​​the area and S j The proportion of regional area; Step S2253: Determine R i Whether the constraint R is satisfied i >0.8, if satisfied, the camera is blocked, otherwise, the camera is not blocked.

6. The method for detecting camera abnormality based on image processing as claimed in claim 1, characterized in that: In step 215, if H1 is not equal to H2 in step S214, the number of the preprocessed initial feature matching images is the number of all initial feature matching images in the folder minus 1; conversely, if H1 is equal to H2 in step S214, the number of the preprocessed initial feature matching images is the number of all initial feature matching images in the folder.

7. The method for detecting camera abnormality based on image processing as claimed in claim 6, characterized in that: The number N of the preprocessed initial feature matching images in the folder is ≤24.

8. The method for detecting camera abnormality based on image processing as claimed in claim 2, characterized in that: When the detection result is that the camera moves or the camera is blocked, the detection method stops running and compares the evidence video with the reference video.

Citation Information

Patent Citations

  • Video quality detection method based on image processing, storage device and mobile terminal

    CN112291551A

  • Apparatus and method of estimating camera position

    KR1020080085655A