A method for detecting abnormality of internal and external parameters of a camera
By using the inter-frame difference method and binarized image analysis, combined with the concept of camera parameters, the system identifies camera height angle, focal length, and distortion anomalies. This solves the problem of difficulty in determining the location of camera anomalies in existing technologies, achieving efficient and accurate anomaly detection and reducing maintenance and management costs.
Patent Information
- Application Number
- CN202211523997.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-11-30
AI Technical Summary
Existing technologies for camera anomaly detection mainly focus on aspects such as video color, angle, and stuttering, failing to effectively pinpoint the location of camera anomalies, resulting in high maintenance and management costs.
By constructing a binary image of pixel differences using the inter-frame difference method, and combining the concepts of internal and external parameters of the camera, the camera's height angle, focal length, and distortion anomalies are determined. Spatial coordinates are calculated using feature landmark corner points to identify anomalies in the camera's internal and external parameters.
It enables efficient and accurate detection of abnormal internal and external parameters of the camera, avoiding increased maintenance and management costs and time consumption due to the inability to determine the location of the abnormality.
Smart Images

Figure CN115880236B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of information technology, and specifically relates to a method for detecting abnormal internal and external parameters of a camera. Background Technology
[0002] With the development of digital cities and increased awareness of social security, video surveillance is now ubiquitous in our lives, and its use is becoming increasingly widespread, with a growing number of surveillance devices. Consequently, the maintenance and management costs of these cameras have also increased significantly. While many are researching the automation and intelligentization of camera anomaly detection to effectively reduce labor costs, most anomaly detection methods only address issues such as abnormal video color, abnormal camera angle, monitoring lag, and black screens. There is a lack of publicly available research on determining the exact location of camera anomalies. Identifying the location of camera anomalies would significantly reduce labor costs and enable targeted and rapid maintenance and management of the cameras. Summary of the Invention
[0003] To address the above problems, this invention provides a method for detecting abnormal internal and external parameters of a camera, comprising the following steps:
[0004] A. Using the initially installed camera, acquire the field of view frame captured by the camera projection and store it as the initial frame. When it is necessary to detect camera abnormalities, use the camera to acquire the current field of view frame captured by the projection.
[0005] B. Obtain the initial frame and current frame of the field of view by using camera projection, obtain the pixel value of each pixel coordinate in the initial frame and the current frame, construct a binary image of pixel difference using the inter-frame difference method, and perform a difference operation on the pixel values of the initial frame and the current frame obtained by camera projection to obtain the pixel difference of each pixel coordinate. Set a pixel difference threshold and perform image binarization.
[0006] C. Based on the pixel difference between the initial frame and the current frame, the binarized image will have three possible outcomes: "the binarized image is white, the binarized image is black, and the binarized image has white edges and black center".
[0007] D. Using the three types of binarized images, combined with the concepts of camera internal and external parameters, determine the cause of camera anomalies. The reasons for camera anomalies include: "A white binarized image" indicates an anomaly in the camera's height and angle, i.e., an anomaly in external parameters; "A white edge and black center in a binarized image" indicates a change in the size of the imaging plane, i.e., an anomaly in the focal length; and "A black binarized image" is determined by extracting feature landmark corner points, matching the pixel coordinates of feature landmark corner points in the initial frame and the current frame, calculating the spatial coordinates of the feature landmarks, and determining that the camera has distortion anomalies, i.e., an anomaly in internal parameters.
[0008] Alternatively, the initial frame and the current frame obtained by camera projection are used to construct a binarized image of pixel differences using the inter-frame difference method, as follows:
[0009] The initial frame and the current frame of the field of view are obtained by projecting images using a camera. The absolute value of the pixel difference is calculated by subtracting the corresponding pixel value from the pixel value of the current frame from the pixel value of the initial frame. The formula is as follows:
[0010] F D (x i y j )=|P b (x i y j )-P n (x i y j )|
[0011] Among them, P b (x i ,y j ) represents the initial frame image coordinates (x) i ,y j The pixel value of P n (x i ,y j ) represents the current frame image coordinates (x) i ,y j The pixel value of F D (x i ,y j ) represents the coordinates (x, y) of the initial frame and the current frame. i ,y j The absolute value of the pixel difference;
[0012] Binarizing the pixel differences makes image contrast more obvious. The formula is as follows:
[0013]
[0014] Where D(x)i ,y j ) represents pixel coordinates (x) i ,y j The pixel difference is binarized, where a grayscale value of 255 represents white in the image, and a grayscale value of 0 represents black. When the difference F D (x i ,y j When the difference F is greater than the user-defined threshold T, the grayscale value is assigned to 255. D (x i ,y j If the grayscale value is less than the user-defined threshold T, then the grayscale value is assigned to 0.
[0015] Alternatively, the three types of determination are as follows:
[0016] When the binarized image is white, the difference between the pixel coordinates of each point in the initial frame and the current frame is greater than the threshold, indicating that the pixel coordinates of each point in the current frame have changed, and the entire projection plane of the camera has shifted, that is, the angle and height of the camera are abnormal.
[0017] When the edges of the binarized image are white and the center is black, the pixel coordinate difference of the edges of the current frame image is greater than the threshold, indicating that the size of the projection plane of the current frame relative to the initial frame has increased or decreased, the size of the imaging plane has changed, and the focal length is abnormal.
[0018] When the binarized image is black, the difference between the pixel coordinates of the current frame and the initial frame is less than the threshold, indicating that the pixel coordinates of each point in the current frame have not changed much relative to the initial frame, and there are no abnormalities in the camera's angle, height, or imaging plane.
[0019] Further optionally, when the binarized image is black, the spatial coordinates of the feature landmarks are calculated by matching the pixel coordinates of the feature landmark corner points of the initial frame and the current frame to determine that the camera has a distortion anomaly.
[0020] Further optionally, when extracting feature landmark corner points, the pixel coordinates of the feature landmark corner points in the initial frame and the current frame are matched. Based on the image content of the initial frame and the current frame, the pixel coordinates of the feature landmark corner points in the initial frame and the current frame are extracted by utilizing the pixel differences around the feature landmark corner points in the image. The same corner point in the initial frame and the current frame is obtained by matching the pixel differences.
[0021] Optionally, the spatial coordinates of the feature landmarks are calculated to determine if the camera has distortion anomalies. This includes: using the pixel coordinates of the same feature landmark corner points in the initial frame and the current frame, performing rigid body transformation and transmission transformation through matrix operations.
[0022]
[0023] Among them, Z C Let f(X, Y, Z) be the Euclidean distance between the feature landmark and the camera, f(X, Y, Z) be the spatial coordinate matrix of the feature landmark to be determined, R be the rotation matrix of the camera, T be the translation matrix of the camera's extrinsic parameters, f be the camera focal length, dx be the column width of one pixel in the initial frame and the current frame, dy be the row height of one pixel in the initial frame and the current frame, u0 and v0 be the origin of the pixel coordinates, and u and v be the pixel coordinates.
[0024] Alternatively, due to the existence of distortion parameters in the camera, the pixel coordinates may exhibit some distortion.
[0025] u d =u(1+k1r 2 +k2r 4 +k3r 6 )
[0026] v d =v(1+k1r) 2 +k2r 4 +k3r 6 )
[0027] r 2 =u 2 +v 2
[0028] Where u is the number of columns of pixels, v is the number of rows of pixels, and k1, k2, and k3 are distortion parameters. d u is the number of columns of pixels after distortion, v d Let v be the number of rows of pixels after distortion. The spatial coordinates of the feature landmark corner points in the initial frame and the current frame are obtained according to the formula. Then, Euclidean distance is calculated between the spatial coordinates of the feature landmark corner points in the initial frame and the current frame.
[0029]
[0030] Among them, (X) i Y j Z k ) represents the spatial coordinates of the initial frame feature landmark corner point, (X) id Y jd Z kd D1 represents the spatial coordinates of the same feature landmark corner point in the current frame, D2 represents the Euclidean distance between the same feature landmark corner point in the initial frame and the current frame, and H2 represents the Euclidean distance threshold specified by the user.
[0031] When the Euclidean distance between the corner points of the feature landmarks is greater than the user-defined threshold H2, the camera will exhibit abnormal distortion.
[0032] The beneficial effects of this invention are: this invention can use an efficient and accurate method to judge the abnormality of internal and external parameters of the camera, avoiding the situation where the camera has been installed for too long and abnormalities occur, thus preventing the failure to achieve the expected monitoring effect. It also avoids the situation where the camera is abnormal but the location of the abnormality cannot be accurately located, thus preventing maintenance and management personnel from consuming more time and manpower. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 A flowchart of a method for detecting abnormal internal and external parameters of a camera according to an embodiment of the present invention is shown;
[0035] Figure 2 A data processing flowchart from an embodiment of the present invention is shown. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0037] This invention provides a method for detecting abnormal internal and external parameters of a camera, such as... Figure 1 and Figure 2 The process, as shown, includes the following steps:
[0038] Using an installed camera, the view frame projected by the camera is acquired. Specifically, acquiring the view frame projected by the camera includes: acquiring and storing an initial view frame projected by the initially installed camera; when an anomaly needs to be detected, acquiring the current view frame projected by the camera; constructing a binarized image of pixel differences using the initial and current frames acquired by the camera projection method; specifically, using the initial and current frames acquired by the camera projection method, constructing a binarized image of pixel differences between the initial and current frames using the inter-frame difference method; acquiring the pixel value of each pixel coordinate in the initial and current frames; performing a difference operation on the pixel values of the initial and current frames to obtain the pixel difference value corresponding to each pixel coordinate; setting a pixel difference threshold; and performing image binarization; based on the black-and-white distribution of the binarized image, identifying and determining the class of the binarized image. The method for identifying and determining the type of a binarized image based on its black-and-white distribution includes: based on the pixel difference between the initial frame and the current frame, the binarized image can be classified into three types: "binarized image is white," "binarized image is black," and "binarized image has white edges and a black center." Using these three types of binarized images, combined with the concepts of internal and external parameters of the camera, the method determines the cause of any camera anomalies. Specifically, "binarized image is white" indicates an anomaly in the camera's height or angle, i.e., an external parameter anomaly; "binarized image has white edges and a black center" indicates a change in the size of the imaging plane, i.e., an internal parameter anomaly; and "binarized image is black" is determined by extracting feature landmark corner points, matching the pixel coordinates of these corner points between the initial frame and the current frame, calculating the spatial coordinates of the feature landmarks, and determining that the camera has distortion anomalies, i.e., an internal parameter anomaly.
[0039] The initial frame and the current frame are captured by camera projection. A binary image of the pixel differences is constructed using the inter-frame difference method, specifically including:
[0040] The initial frame and the current frame of the field of view are obtained by projecting images using a camera. The absolute value of the pixel difference is calculated by subtracting the corresponding pixel value from the pixel value of the current frame from the pixel value of the initial frame. The formula is as follows:
[0041] F D (x i y j )=|P b (x i y j )-P n (x i y j)|
[0042] Among them, P b (x i y j ) represents the initial frame image coordinates (x) i y j The pixel value of P n (x i y j ) represents the current frame image coordinates (x) i y j The pixel value of F D (x i y j ) represents the coordinates (x, y) of the initial frame and the current frame. i y j The absolute value of the pixel difference;
[0043] Binarizing the pixel differences makes image contrast more obvious. The formula is as follows:
[0044]
[0045] Where D(x) i y j ) represents pixel coordinates (x) i y j The pixel difference is binarized, where a grayscale value of 255 represents white in the image, and a grayscale value of 0 represents black. When the difference F D (x i y j When the difference F is greater than the user-defined threshold T, the grayscale value is assigned to 255. D (x i y j If the grayscale value is less than the user-defined threshold T, then the grayscale value is assigned to 0.
[0046] Based on the black-and-white distribution of the binarized image, identify and determine the type of the binarized image. This includes:
[0047] After performing image binarization based on the pixel difference between the initial frame and the current frame, the black and white distribution of the binarized image mainly presents three cases: "the binarized image is white, the binarized image is black, and the binarized image has white edges and black in the middle".
[0048] The binarized image has a black-and-white distribution, and the situation where "the binarized image is white" specifically includes:
[0049] When the binarized image is white, the difference between the pixel coordinates of each point in the initial frame and the current frame is greater than the threshold, indicating that the pixel coordinates of each point in the current frame have changed, and the entire projection plane of the camera has shifted, that is, the angle and height of the camera are abnormal.
[0050] The binarized image has a black-and-white distribution, exhibiting a situation where "the edges of the binarized image are white and the center is black," specifically including:
[0051] When the edges of the binarized image are white and the center is black, the pixel coordinate difference of the current frame image edge is greater than the threshold, indicating that the size of the projection plane of the current frame relative to the initial frame has increased or decreased, the size of the imaging plane has changed, and the focal length is abnormal.
[0052] The binary image is black and white, and the situation where "the binary image is black" occurs specifically includes: when the binary image is black, the difference between the pixel coordinates of the current frame and the initial frame is less than a threshold, indicating that the pixel coordinates of each point in the current frame have not changed much relative to the initial frame, and the camera's angle, height, and imaging plane have not changed abnormally.
[0053] When the binarized image is black, the spatial coordinates of the feature landmark corner points are calculated by matching the pixel coordinates of the feature landmark corner points in the initial frame and the current frame to determine if the camera has distortion anomalies. When extracting feature landmark corner points, the pixel coordinates of the feature landmark corner points in the initial frame and the current frame are matched. Based on the image content of the initial frame and the current frame, the pixel coordinates of the feature landmark corner points in the initial frame and the current frame are extracted using the pixel differences around the feature landmark corner points in the image. The same corner point in the initial frame and the current frame is obtained through pixel difference matching. Calculating the spatial coordinates of the feature landmarks to determine if the camera has distortion anomalies includes: using the pixel coordinates of the same feature landmark corner point in the initial frame and the current frame, performing rigid body transformation and transmission transformation through matrix operations.
[0054]
[0055] Among them, Z C Let f(X, Y, Z) be the Euclidean distance between the feature landmark and the camera, f(X, Y, Z) be the spatial coordinate matrix of the feature landmark to be determined, R be the camera rotation matrix, T be the camera's extrinsic translation matrix, f be the camera focal length, dx be the column width of one pixel in the initial frame and the current frame, dy be the row height of one pixel in the initial frame and the current frame, u0 and v0 be the origin of the pixel coordinates, and u and v be the pixel coordinates. Due to camera distortion parameters, the pixel coordinates are subject to some distortion.
[0056] u d =u(1+k1r 2 +k2r 4 +k3r 6 )
[0057] v d =v(1+k1r) 2 +k2r 4 +k3r 6 )
[0058] r 2 =u 2 +v 2
[0059] Where u is the number of columns of pixels, v is the number of rows of pixels, and k1, k2, and k3 are distortion parameters. d u is the number of columns of pixels after distortion, v d Let v be the number of rows of pixels after distortion. The spatial coordinates of the feature landmark corner points in the initial frame and the current frame are obtained according to the formula. Then, Euclidean distance is calculated between the spatial coordinates of the feature landmark corner points in the initial frame and the current frame.
[0060]
[0061] Among them, (X) i Y j Z k ) represents the spatial coordinates of the initial frame feature landmark corner point, (X) id Y jd Z kd D1 represents the spatial coordinates of the same feature landmark corner point in the current frame, D2 represents the Euclidean distance between the same feature landmark corner point in the initial frame and the current frame, and H2 represents the user-defined Euclidean distance threshold. When the Euclidean distance between the feature landmark corner points is greater than the user-defined threshold H2, the camera exhibits distortion anomaly. This system can efficiently and accurately determine anomalies in the internal and external parameters of the camera, avoiding situations where cameras become abnormal after prolonged installation, failing to achieve the desired monitoring effect, and preventing situations where camera anomalies cannot be accurately located, thus avoiding excessive time and manpower costs for maintenance personnel.
[0062] The following will provide further details with reference to specific embodiments:
[0063] Step 1: Using the installed camera, acquire the projected field of view frame: Acquire the initial projected field of view frame using the initially installed camera and store it as the initial frame. When it is necessary to detect camera malfunctions, acquire the current projected field of view frame using the camera. When the camera is first installed, when acquiring frames, the camera's field of view should only contain background objects (objects that do not change over time: walls, desks, safety exit signs, doors, etc.), and should not contain foreground objects (objects that change over time: people, animals, vehicles, etc.). Project the camera's field of view to acquire the initial frame and store it. When the camera needs maintenance and management, the camera's field of view should remain unchanged from the initial frame. Project the camera's field of view to acquire the current frame. For example, the captured image shows an office with a company profile notice board, tables, chairs, etc.
[0064] Step 2: Using the initial frame and current frame acquired through camera projection, construct a binarized image of the pixel difference using the inter-frame difference method. The initial frame and current frame of the field of view are acquired through camera projection. The absolute value of the pixel difference is obtained by subtracting the corresponding pixel value from the pixel value of the current frame at each pixel coordinate in the initial frame.
[0065] F D (x i y j )=|P b (x i y j )-P n (x i y j )|
[0066] , where P b (x i y j ) represents the initial frame image coordinates (x) i y j The pixel value of P n (x i y j ) represents the current frame image coordinates (x) i y j The pixel value of F D (x i y j ) represents the coordinates (x, y) of the initial frame and the current frame. i y j The absolute value of the pixel difference; binarizing the pixel difference makes the image contrast more obvious.
[0067]
[0068] , where D(x i yj ) represents pixel coordinates (x) i y j The pixel difference is binarized, where a grayscale value of 255 represents white in the image, and a grayscale value of 0 represents black. When the difference F D (x i y j When the difference F is greater than the user-defined threshold T, the grayscale value is assigned to 255. D (x i y j When the value is less than the user-defined threshold T, the grayscale value is set to 0. For example, if the pixel value at coordinates (257, 310) in the initial frame is 78 and the pixel value at coordinates (257, 310) in the current frame is 102, then the absolute value of the pixel difference is 24. If the threshold T is set to 20, then D(257, 310) = 255, and the pixel at coordinates (257, 310) is white.
[0069] Step 3: Identify and determine the type of the binarized image based on the black-and-white distribution of the binarized image.
[0070] After performing image binarization based on the pixel difference between the initial frame and the current frame, the black and white distribution of the binarized image mainly presents three cases: "the binarized image is white, the binarized image is black, and the binarized image has white edges and black in the middle".
[0071] Step 4: Determine the type of the binarized image based on the identification and analyze any anomalies. When the binarized image is white, the difference between the pixel coordinates of each point in the initial frame and the current frame is greater than the threshold, indicating that the pixel coordinates of each point in the current frame have changed, and the entire projection plane of the camera has shifted, meaning that the camera's angle and height are abnormal, i.e., the external parameters are abnormal. For example, if the camera shifts 10 pixels to the right, the pixel values of almost every point will change. In the initial frame, the pixel coordinates of the table are (257, 310), and in the current frame, the pixel coordinates of the table are (247, 310). The point with pixel coordinates (257, 310) in the current frame is the ground. Through calculation of each point, the pixel difference of the vast majority of points is greater than the threshold T = 20, so the binarized image is white.
[0072] When the binarized image has white edges and a black center, the pixel coordinate difference of the current frame image edges is greater than the threshold, indicating that the size of the projection plane of the current frame relative to the initial frame has increased or decreased, the size of the imaging plane has changed, and the focal length is abnormal, i.e., the internal parameters are abnormal. For example, the initial frame of the camera captures a company profile, a red sofa, and three arranged instruments. When the focal length increases, the current frame of the camera captures a company profile notice board, a table, and a wall. The camera's field of view has shrunk, but the pixel coordinates and pixel values of the counter, the ground, etc. in the middle part have not changed. The pixel value of the missing part at the edge of the current frame is 0. When the difference operation is performed with the initial frame, the constructed binarized image shows a situation where the edges are white and the center is black.
[0073] When the binarized image is black, the difference between the pixel coordinates of the current frame and the initial frame is less than the threshold, indicating that the pixel coordinates of each point in the current frame have not changed much relative to the initial frame, and there are no abnormalities in the camera's angle, height, or imaging plane.
[0074] Step 5: When the binarized image is black, calculate the spatial coordinates of the feature landmark corner points by matching the pixel coordinates of the feature landmark corner points in the initial frame and the current frame to determine if there is a distortion anomaly in the camera. Extract the feature landmark corner points and match the pixel coordinates of the feature landmark corner points in the initial frame and the current frame. Based on the image content of the initial frame and the current frame, use the pixel differences around the feature landmark corner points in the image to extract the pixel coordinates of the feature landmark corner points in the initial frame and the current frame. Match the pixel differences to obtain the same corner point in the initial frame and the current frame; for example, extract the pixel coordinates of the four corner points of the company profile bulletin board. In the initial frame, the pixel coordinates are (40, 79), (79, 181), (221, 92), and (201, 3), respectively. In the current frame, the pixel coordinates are (40, 81), (81, 180), (221, 92), and (197, 3), respectively.
[0075] Calculate the spatial coordinates of key landmark corner points to determine if camera distortion is present. Using the pixel coordinates of the same key landmark corner points in the initial and current frames, perform rigid body transformation and transmission transformation through matrix operations.
[0076]
[0077] Z C Let f(X, Y, Z) be the Euclidean distance between the feature landmark and the camera, f(X, Y, Z) be the spatial coordinate matrix of the feature landmark to be determined, R be the camera rotation matrix, T be the camera's extrinsic translation matrix, f be the camera focal length, dx be the column width of one pixel in the initial frame and the current frame, dy be the row height of one pixel in the initial frame and the current frame, u0 and v0 be the origin of the pixel coordinates, and u and v be the pixel coordinates. Due to camera distortion parameters, the pixel coordinates are subject to some distortion.
[0078] u d =u(1+k1r 2 +k2r 4 +k3r 6 )
[0079] v d =v(1+k1r) 2 +k2r 4 +k3r 6 )
[0080] r 2 =u 2 +v 2
[0081] Where u is the number of columns of pixels, v is the number of rows of pixels, and k1, k2, and k3 are distortion parameters. d u is the number of columns of pixels after distortion, v d Let v be the number of rows of pixels after distortion. The spatial coordinates of the feature landmark corner points in the initial frame and the current frame are obtained according to the formula. Then, Euclidean distance is calculated between the spatial coordinates of the feature landmark corner points in the initial frame and the current frame.
[0082]
[0083] , where (X) i Y j Z k ) represents the spatial coordinates of the initial frame feature landmark corner point, (X) id Y jd Z kdLet D1 be the spatial coordinates of the same feature landmark corner point in the current frame, D2 be the Euclidean distance between the same feature landmark corner point in the initial frame and the current frame, and H2 be the Euclidean distance threshold specified by the user. When the Euclidean distance between the feature landmark corner points is greater than the user-specified threshold H2, the camera exhibits abnormal distortion, i.e., abnormal internal parameters. For example, the pixel coordinates of the four corner points of the company profile bulletin board are (40, 79), (79, 181), (221, 92), and (201, 3) in the initial frame, and (40, 81), (81, 180), (221, 92), and (197, 3) in the current frame. According to the coordinate transformation formula, the spatial coordinates of the four corner points of the company profile bulletin board in the initial frame are (3537, 4030, 687), (3124, 3785, 238), and (3466, 2940, 671) respectively. The coordinates of the company profile notice board are (3824,3070,1066), (3521,4020,677), (3122,3777,240), (3463,2942,670), and (3820,3082,1062) in the current frame. The calculated Euclidean distances are 21.35, 8.48, 3.74, and 11.49, respectively. If the Euclidean distance threshold H2 = 6.00 is set, then the Euclidean distances of three corner points of the company profile notice board are greater than the threshold. Through the binarized image, it can be found that the angle, height, and focal length of the camera are not abnormal. Therefore, the distortion parameters of the camera lens are abnormal, which affects the spatial coordinates of the corner points of the company profile notice board.
[0084] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting abnormal internal and external parameters of a camera, characterized in that, Includes the following steps: A. Using the initially installed camera, acquire the field of view frame captured by the camera projection and store it as the initial frame. When it is necessary to detect camera abnormalities, use the camera to acquire the current field of view frame captured by the projection. B. Obtain the pixel value of each pixel coordinate in the initial frame and the current frame using the initial frame and the current frame, and construct a binary image of the pixel difference using the inter-frame difference method. C. Based on the pixel difference between the initial frame and the current frame, the binarized image will have three possible outcomes: "the binarized image is white, the binarized image is black, and the binarized image has white edges and black center". D. Using the three types of binarized images, combined with the concepts of camera internal and external parameters, determine the cause of camera anomalies; including: "Binarized image is white" indicates an abnormality in the camera's height and angle, i.e., an abnormality in external parameters; "Binarized image has white edges and black in the middle" indicates a change in the size of the imaging plane, indicating an abnormality in the focal length, i.e., an abnormality in internal parameters; when "Binarized image is black", extract feature landmark corner points, match the pixel coordinates of feature landmark corner points in the initial frame and the current frame, calculate the spatial coordinates of the feature landmarks, and determine that the camera has distortion anomalies, i.e., an abnormality in internal parameters.
2. The method for detecting abnormal internal and external parameters of a camera according to claim 1, characterized in that, The pixel values of each pixel coordinate in the initial frame and the current frame are obtained. Then, a binary image of the pixel differences is constructed using the inter-frame difference method, as follows: The initial frame and the current frame of the field of view are obtained by projecting images using a camera. The absolute value of the pixel difference is calculated by subtracting the corresponding pixel value from the pixel value of the current frame from the pixel value of the initial frame. The formula is as follows: ; Among them, P b (x i ,y j ) represents the initial frame image coordinates (x) i ,y j The pixel value of P n (x i ,y j ) represents the current frame image coordinates (x) i ,y j The pixel value of F D (x i ,y j ) represents the coordinates (x, y) of the initial frame and the current frame. i ,y j The absolute value of the pixel difference; Binarizing the pixel differences makes image contrast more obvious. The formula is as follows: ; Where D(x) i ,y j ) represents pixel coordinates (x) i ,y j The pixel difference is binarized, where a grayscale value of 255 represents white in the image and a grayscale value of 0 represents black. When the difference F D (x i ,y j When the difference F is greater than the user-defined threshold T, the grayscale value is assigned to 255. D (x i ,y j If the grayscale value is less than the user-defined threshold T, then the grayscale value is assigned to 0.
3. The method for detecting abnormal internal and external parameters of a camera according to claim 2, characterized in that, The three types are determined as follows: When the binarized image is white, the difference between the pixel coordinates of each point in the initial frame and the current frame is greater than the threshold, indicating that the pixel coordinates of each point in the current frame have changed, and the entire projection plane of the camera has shifted, that is, the angle and height of the camera are abnormal. When the edges of the binarized image are white and the center is black, the pixel coordinate difference of the edges of the current frame image is greater than the threshold, indicating that the size of the projection plane of the current frame relative to the initial frame has increased or decreased, the size of the imaging plane has changed, and the focal length is abnormal. When the binarized image is black, the difference between the pixel coordinates of the current frame and the initial frame is less than the threshold, indicating that the pixel coordinates of each point in the current frame have not changed much relative to the initial frame, and there are no abnormalities in the camera's angle, height, or imaging plane.
4. The method for detecting abnormal internal and external parameters of a camera according to claim 3, characterized in that, When the binarized image is black, the spatial coordinates of the feature landmarks are calculated by matching the pixel coordinates of the feature landmark corner points of the initial frame and the current frame, and the camera is judged to have distortion anomalies.
5. The method for detecting abnormal internal and external parameters of a camera according to claim 4, characterized in that, When extracting feature landmark corner points, the pixel coordinates of feature landmark corner points in the initial frame and the current frame are matched. Based on the image content of the initial frame and the current frame, the pixel coordinates of feature landmark corner points in the initial frame and the current frame are extracted by utilizing the pixel differences around the feature landmark corner points in the image. The same corner point in the initial frame and the current frame is obtained by matching the pixel differences.
6. The method for detecting abnormal internal and external parameters of a camera according to claim 5, characterized in that, Calculating the spatial coordinates of feature landmarks to determine if camera distortion occurs includes: using the pixel coordinates of the same feature landmark corner points in the initial and current frames, and performing rigid body transformation and transmission transformation through matrix operations. ; Among them, Z C Let f(X, Y, Z) be the Euclidean distance between the feature landmark and the camera, f(X, Y, Z) be the spatial coordinate matrix of the feature landmark to be determined, R be the rotation matrix of the camera, T be the translation matrix of the camera's extrinsic parameters, f be the camera focal length, dx be the column width of one pixel in the initial frame and the current frame, dy be the row height of one pixel in the initial frame and the current frame, u0 and v0 be the origin of the pixel coordinates, and u and v be the pixel coordinates.
7. The method for detecting abnormal internal and external parameters of a camera according to claim 6, characterized in that, Due to camera distortion parameters, pixel coordinates exhibit some distortion. ; ; ; Where u is the number of columns of pixels, v is the number of rows of pixels, and k1, k2, and k3 are distortion parameters. d u is the number of columns of pixels after distortion, v d Let v be the number of rows of pixels after distortion. The spatial coordinates of the feature landmark corner points in the initial frame and the current frame are obtained according to the formula. Then, Euclidean distance is calculated between the spatial coordinates of the feature landmark corner points in the initial frame and the current frame. ; Among them, (X) i Y j Z k ) represents the spatial coordinates of the initial frame feature landmark corner point, (X) id Y jd Z kd D1 represents the spatial coordinates of the same feature landmark corner point in the current frame, D2 represents the Euclidean distance between the same feature landmark corner point in the initial frame and the current frame, and H2 represents the Euclidean distance threshold specified by the user. When the Euclidean distance between the corner points of the feature landmarks is greater than the user-defined threshold H2, the camera will exhibit abnormal distortion.
Citation Information
Patent Citations
Monitoring device
JP2003087773A
Detection method of the stability of digital photography device, and the digital photography device
TW201040882A