Method and system for automatically calibrating preset point location of camera and electronic equipment
By performing large pre-adjustment and multiple focal length and tailoring adjustments in the camera system, accurate and automatic calibration of the preset points of the camera is solved, and the problems of low efficiency and poor timeliness in the existing technology are ensured, ensuring the stable operation of the system.
Patent Information
- Application Number
- CN202510319705.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-06-20
AI Technical Summary
The prior art is inefficient and poor in time when processing camera preset point offsets. Especially in multi-camera systems, it is difficult to accurately identify points when manual adjustment takes a long time and automatic calibration is in the case of large offsets or small field of view.
By acquiring preset points, configuring focal length, basic reference map and minimum focal length reference map, large pre-adjustment is performed, and then using multiple adjustments to focal length and cropped images as references, a hierarchical calibration from coarse to thin is realized, and the camera is driven to perform offset adjustment by comparing the offset of the current image and the basic image data.
It improves the accuracy and efficiency of automatic calibration of camera preset points, avoids the time-consuming and inaccurate identification of manual adjustments, and ensures the long-term and stable operation of the system.
Smart Images

Figure CN120186468A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automatic control of power systems, and in particular to a method, a system and an electronic device for automatically calibrating preset positions of a camera. Background Art
[0002] Most existing pan-tilt heads, dome cameras, etc. that can control the viewing angle rely on preset positions as a reference during shooting. However, these systems will have the situation of preset position deviation during long-term use, which will cause the captured pictures or videos to not meet the requirements of the business system, and have a greater impact on the subsequent processing process. In the face of the situation of preset position deviation, the usual solutions are manual adjustment or system automatic calibration. Manual adjustment means that when the operation and maintenance personnel find that the preset position deviates, the operation and maintenance personnel access the camera setting interface, and re-control the camera to be placed at a position that meets the requirements according to the requirements of the original preset position and set the preset position; the system uses image processing technology to automatically identify the situation of preset position deviation for autonomous adjustment.
[0003] However, manually resetting the preset position is inefficient. When there are a large number of cameras in the system, it has a great impact on the business process of the system, and the timeliness is poor, making it difficult to meet the shooting requirements. Although using image processing technology for autonomous adjustment ensures efficiency and timeliness, when there is a large deviation, the information in the standard preset position picture and the information in the current picture will not be able to find a match, and thus the preset position deviation cannot be calibrated. At this time, only manual operation can be relied on to handle this calibration work; and when there is a small viewing range, if the details of the preset position are extremely similar to the details of the surrounding image, such as multiple identical indicator lights arranged side by side, when the position deviates to other nearby indicator lights, it is impossible to distinguish them by image comparison, resulting in inaccurate calibration and difficult to achieve the calibration work. Summary of the Invention
[0004] The present invention aims to provide a method, a system and an electronic device for automatically calibrating preset positions of a camera to solve the above technical problems and improve the accuracy of automatic calibration of the preset positions of the camera.
[0005] To solve the above technical problems, the present invention provides a method for automatically calibrating preset positions of a camera, including the following steps:
[0006] Obtain the preset position, configure the focal length, the basic reference picture and the minimum focal length reference picture;
[0007] Obtain the minimum focal length, and perform pre-adjustment based on the preset position, the minimum focal length and the minimum focal length reference picture to obtain a pre-adjustment offset angle, so as to drive the camera to move to the pre-adjustment driving position based on the pre-adjustment offset angle;
[0008] Execute the automatic calibration steps based on the pre-adjusted driving point positions, minimum focal length, preset point positions, configured focal length, and basic reference map:
[0009] Set the camera focal length to the intermediate focal length based on the minimum focal length and the configured focal length to obtain the first current image;
[0010] Obtain the cropping reference map based on the first current image, the basic reference map, and the preset cropping algorithm;
[0011] Obtain the first offset angle based on the cropping reference map and the basic reference map, and drive the camera to the first driving point position based on the first offset angle;
[0012] Set the camera focal length to the configured focal length to obtain the second current image;
[0013] Obtain the second offset angle based on the second current image and the basic reference map, and drive the camera to move to the current preset point position based on the second offset angle to achieve automatic calibration of the camera preset point position.
[0014] A method for automatically calibrating the camera preset point position provided by the above method first makes a relatively large pre-adjustment according to the minimum focal length and the basic data information to prepare for subsequent fine adjustment, avoiding situations such as difficulty in identifying whether the point calibration is accurate when there are duplicate images at the preset point position during direct small-range adjustment; then, after the pre-adjustment, focus adjustment, cropping, and fine offset adjustment are performed according to the actual situation. During this process, the offset amount between the current image and the basic image data is compared to drive the camera to perform offset adjustment to achieve automatic adjustment. At the same time, the field of view range is increased by adjusting the focal length to increase the amount of image information to achieve accurate recognition and calculation of the offset amount, improving the accuracy of automatic calibration of the camera preset point position; this method does not require manual adjustment, overcomes the limitations of inaccurate recognition, long time-consuming manual adjustment, and lack of timeliness in the actual application of the existing technology, making the automatic calibration result more accurate and reliable, thus ensuring the long-term stable operation of the system function relying on the camera preset point position.
[0015] Further, the steps of obtaining the preset point position, configured focal length, basic reference map, and minimum focal length reference map include: setting the preset point position and configured focal length of the camera; obtaining the basic reference map based on the preset point position and the configured focal length; setting the camera focal length to the minimum focal length to obtain the minimum focal length reference map.
[0016] In the above solution, the minimum focal length reference map is obtained by adjusting to the minimum focal length at the initial preset point position, so as to obtain more image information within a larger field of view range, providing a data basis for the subsequent automatic calibration process.
[0017] Further, obtain the minimum focal length, and perform pre-adjustment based on the preset position, the minimum focal length, and the minimum focal length reference diagram to obtain the pre-adjustment offset angle, so as to drive the camera to move to the pre-adjustment driving position based on the pre-adjustment offset angle, including: driving the camera to move to the pre-driving position based on the preset position, setting the camera focal length to the minimum focal length, so as to obtain a pre-adjustment image based on the pre-driving position; obtaining the pre-adjustment offset angle based on the pre-adjustment image and the minimum focal length reference diagram, so as to drive the camera to move to the pre-adjustment driving position based on the pre-adjustment offset angle.
[0018] In the above solution, relatively large pre-adjustment is performed through the minimum focal length and basic data information to prepare for subsequent fine adjustment.
[0019] Further, in the automatic calibration step, set the camera focal length to the intermediate focal length based on the minimum focal length and the configured focal length, and obtain the first current image, including:
[0020] Obtain the intermediate focal length based on the minimum focal length and the configured focal length, and the specific calculation process satisfies the following formula:
[0021]
[0022] In the formula: f0 represents the minimum focal length, f large represents the configured focal length, and f small represents the intermediate distance;
[0023] Set the camera focal length to the intermediate focal length, and obtain the first current image.
[0024] In the above solution, by appropriately adjusting the focal length, the camera's field of view range is changed, providing a suitable reference image data information for subsequent adjustment and calibration, so as to avoid the problem that the direct change from the minimum focal length to the configured focal length causes too large a difference in the image frame range, resulting in the loss of the reference target, difficulty in image comparison, and offset calculation.
[0025] Further, in the automatic calibration step, obtain the cropping reference diagram based on the first current image, the basic reference diagram, and the preset cropping algorithm, including:
[0026] The preset cropping algorithm includes a preset ratio algorithm, a preset coordinate algorithm, and a preset size algorithm;
[0027] Obtain the field of view ratio based on the intermediate focal length, the configured focal length, and the preset ratio algorithm, and the specific calculation process satisfies the following formula:
[0028]
[0029] In the formula: scale represents the field of view ratio, f small represents the intermediate focal length, and f large represents the configured focal length;
[0030] Obtain the base height and base width based on the base reference image, and obtain the cropping start coordinates based on the field of view ratio, base height, base width, and preset coordinate algorithm. The specific calculation process satisfies the following formula:
[0031]
[0032] In the formula: x represents the starting abscissa, y represents the starting ordinate, w represents the base width, and h represents the base height;
[0033] Obtain the cropping height and cropping width based on the cropping start coordinates and preset size algorithm. The specific calculation process satisfies the following formula:
[0034]
[0035] In the formula: w1 represents the cropping width, and h1 represents the cropping height;
[0036] Obtain the cropping reference image based on the first current image, cropping start coordinates, cropping height, and cropping width.
[0037] In the above solution, first calculate the field of view ratio through the focal length, and then obtain the cropping start coordinates according to the field of view ratio. At the same time, calculate the cropping size based on the size of the base reference image, so that the required cropping reference image can be obtained according to the cropping start coordinates and cropping size, narrowing the field of view and focusing on a finer picture, thereby realizing the accurate identification and calculation of the subsequent offset.
[0038] Furthermore, in the automatic calibration step, obtain the second offset angle based on the second current image and the base reference image, and drive the camera to move to the current preset position based on the second offset angle to realize the automatic calibration of the camera preset position, including:
[0039] Obtain the second offset angle based on the second current image and the base reference image;
[0040] Drive the camera to move to the second driving position based on the second offset angle to obtain the third current image;
[0041] Obtain the third offset angle based on the third current image and the base reference image;
[0042] When the third offset angle meets the preset offset range, set the second driving position as the current preset position to realize the automatic calibration of the camera preset position.
[0043] Furthermore, when the third offset angle meets the preset offset range, setting the second driving position as the current preset position to realize the automatic calibration of the camera preset position further includes:
[0044] When the third offset angle does not meet the preset offset range, the automatic calibration steps are repeatedly executed based on the second driving point position, the minimum focal length, the configured focal length, and the basic reference image to obtain the (N + 1)-th offset angle at the N-th driving point position until the (N + 1)-th offset angle meets the preset offset range. Then, the N-th driving point position is set as the current preset point position to achieve the automatic calibration of the camera preset point position.
[0045] In the above solution, by setting a reasonable preset offset range, it automatically identifies whether the calibration of the camera reaches the standard during the calibration process. When the preset offset range is not met, the automatic calibration steps are repeated, ensuring the accuracy of the automatic calibration result.
[0046] The present invention provides a method for automatically calibrating the preset point position of a camera. It realizes automatic calibration by comparing the offset amount of images. During the calibration process, by adjusting the focal length multiple times and using the cropped image as a reference, the change in the field of view range is realized, and then the hierarchical calibration of the camera automatic calibration from rough adjustment to fine adjustment is achieved, improving the accuracy of offset amount identification and calculation, and ensuring the accuracy of the automatic calibration of the camera preset point position.
[0047] The present invention provides a system for automatically calibrating the preset point position of a camera, which is used to implement a method for automatically calibrating the preset point position of a camera, including:
[0048] A configuration module, which is used to obtain the preset point position, the configured focal length, the basic reference image, and the minimum focal length reference image;
[0049] A preprocessing module, which is used to obtain the minimum focal length, and perform pre-adjustment based on the preset point position, the minimum focal length, and the minimum focal length reference image to obtain a pre-adjustment offset angle, and drive the camera to move to the pre-adjustment driving point position based on the pre-adjustment offset angle;
[0050] An automatic calibration module, which is used to execute the automatic calibration steps based on the pre-adjustment driving point position, the minimum focal length, the preset point position, the configured focal length, and the basic reference image: set the camera focal length to the intermediate focal length based on the minimum focal length and the configured focal length to obtain the first current image; obtain a cropped reference image based on the first current image, the basic reference image, and a preset cropping algorithm; obtain the first offset angle based on the cropped reference image and the basic reference image, and drive the camera to the first driving point position based on the first offset angle; set the camera focal length to the configured focal length to obtain the second current image; obtain the second offset angle based on the second current image and the basic reference image, and drive the camera to move to the current preset point position based on the second offset angle to achieve the automatic calibration of the camera preset point position.
[0051] A system for automatically calibrating the preset positions of a camera provided by the above solution first configures and obtains basic parameter information through a configuration module, and then the preprocessing module makes a relatively large pre-adjustment according to the minimum focal length and basic data information to prepare for subsequent fine adjustment, avoiding situations such as difficulty in identifying whether the point calibration is accurate when there are duplicate images at the preset position during direct small-range adjustment; then, after the pre-adjustment, the autofocus module makes focus adjustment, cropping, and fine offset adjustment according to the actual situation. During this process, the offset amount between the current image and the basic image data is compared to drive the camera to make offset adjustment to achieve automatic adjustment. At the same time, the field of view is increased by adjusting the focal length to increase the amount of image information, so as to accurately identify and calculate the offset amount, improving the accuracy of automatic calibration of the camera preset positions; the automatic calibration of the camera preset positions by this system does not require manual adjustment, overcoming the limitations of inaccurate identification and long time-consuming and non-timely manual adjustment in the actual application of the existing technology, making the automatic calibration result more accurate and reliable, thus ensuring the long-term stable operation of the system relying on the functions of the camera preset positions.
[0052] Further, the configuration module includes an initial configuration sub-module and a data acquisition sub-module; among them: the initial configuration sub-module is used to set the preset positions of the camera and configure the focal length; the data acquisition sub-module is used to obtain a basic reference image based on the preset positions and the configured focal length; and set the camera focal length to the minimum focal length to obtain a minimum focal length reference image.
[0053] The present invention also provides an electronic device for automatically calibrating the preset positions of a camera, including: a processor, a memory, and a computer program; wherein, the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device runs, the processor executes the computer program stored in the memory to enable the electronic device to execute a method for automatically calibrating the preset positions of a camera as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a schematic diagram of a method for automatically calibrating the preset positions of a camera provided by an embodiment of the present invention;
[0055] Figure 2 It is a schematic diagram of the pre-adjustment process for automatically calibrating the preset positions of a camera provided by an embodiment of the present invention;
[0056] Figure 3 It is a schematic diagram of the view of the camera after setting the intermediate focal length in a method for automatically calibrating the preset positions of a camera provided by an embodiment of the present invention;
[0057] Figure 4 It is a schematic diagram of the pre-adjustment process for automatically calibrating the preset positions of a camera provided by an embodiment of the present invention;
[0058] Figure 5 Schematic diagram of the cropping reference diagram in a method for automatically calibrating the preset position of a camera provided by an embodiment of the present invention;
[0059] Figure 6 Schematic diagram of the implementation process for automatically calibrating the preset position of a camera provided by an embodiment of the present invention. Detailed implementation manners
[0060] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this embodiment.
[0061] Embodiment 1:
[0062] This embodiment provides a method for automatically calibrating the preset position of a camera. As Figure 1 shown, it includes the following steps:
[0063] S1: Obtain the preset position, configure the focal length, the basic reference diagram, and the minimum focal length reference diagram;
[0064] S2: Obtain the minimum focal length, and perform pre-adjustment based on the preset position, the minimum focal length, and the minimum focal length reference diagram to obtain the pre-adjustment offset angle, so as to drive the camera to move to the pre-adjustment driving position based on the pre-adjustment offset angle;
[0065] S3: Execute the automatic calibration steps based on the pre-adjustment driving position, the minimum focal length, the preset position, the configured focal length, and the basic reference diagram:
[0066] S31: Set the camera focal length to the intermediate focal length based on the minimum focal length and the configured focal length to obtain the first current image;
[0067] S32: Obtain the cropping reference diagram based on the first current image, the basic reference diagram, and the preset cropping algorithm;
[0068] S33: Obtain the first offset angle based on the cropping reference diagram and the basic reference diagram, so as to drive the camera to the first driving position based on the first offset angle;
[0069] S34: Set the camera focal length to the configured focal length to obtain the second current image;
[0070] S35: Obtain the second offset angle based on the second current image and the basic reference diagram, and drive the camera to move to the current preset position based on the second offset angle to realize the automatic calibration of the camera preset position.
[0071] A method for automatically calibrating the preset positions of a camera provided by the above method first makes a relatively large pre-adjustment based on the minimum focal length and basic data information to prepare for subsequent fine adjustment, avoiding situations such as difficulty in identifying whether the position calibration is accurate when there are duplicate images at the preset positions during direct small-range adjustment; then, after the pre-adjustment, focus adjustment, cropping, and fine offset adjustment are performed according to the actual situation. During this process, the offset amount between the current image and the basic image data is compared to drive the camera to perform offset adjustment to achieve automatic adjustment. At the same time, the field of view range is increased by adjusting the focal length to increase the amount of image information to achieve accurate identification and calculation of the offset amount, improving the accuracy of automatic calibration of the camera preset positions; this method does not require manual adjustment, overcoming the limitations of inaccurate identification and time-consuming and non-time-effective manual adjustment in the actual application of the existing technology, making the automatic calibration result more accurate and reliable, thus ensuring the long-term stable operation of the system functions relying on the camera preset positions.
[0072] Optionally, step S1 includes: setting the preset positions of the camera and configuring the focal length; obtaining a basic reference image based on the preset positions and the configured focal length; setting the camera focal length to the minimum focal length to obtain a minimum focal length reference image.
[0073] In the specific implementation process, the minimum focal length reference image is obtained by adjusting to the minimum focal length at the initial preset position, thereby obtaining more image information within a larger field of view range, providing a data basis for the subsequent automatic calibration process.
[0074] Optionally, step S2 includes: driving the camera to move to a pre-driven position based on the preset position, setting the camera focal length to the minimum focal length to obtain a pre-adjustment image based on the pre-driven position; obtaining a pre-adjustment offset angle based on the pre-adjustment image and the minimum focal length reference image, and driving the camera to move to a pre-adjustment driven position based on the pre-adjustment offset angle.
[0075] In the specific implementation process, a relatively large pre-adjustment is made through the minimum focal length and basic data information to prepare for subsequent fine adjustment, such as Figure 2 shown Figure 2 The circular shape within the dashed box in represents the preset position, Figure 2 (a) represents the field of view image before adjusting the focal length after the camera moves to the pre-driven position, Figure 2 (b) is the pre-adjustment image after setting the camera focal length to the minimum focal length, Figure 2 (c) represents the minimum focal length reference image, Figure 2 (d) represents the field of view image after the camera moves according to the pre-adjustment offset angle.
[0076] Optionally, step S1 includes:
[0077] Obtain the intermediate focal length based on the minimum focal length and the configured focal length, and the specific calculation process satisfies the following formula:
[0078]
[0079] In the formula: f0 represents the minimum focal length, f large represents the configured focal length, and f small represents the intermediate distance;
[0080] Set the camera focal length to the intermediate focal length and obtain the first current image.
[0081] In the specific implementation process, by appropriately adjusting the focal length to change the camera's field of view range, a suitable reference image data information is provided for subsequent adjustment and calibration, so as to avoid the problem that the direct change from the minimum focal length to the configured focal length causes too large a difference in the image frame range, resulting in the loss of the reference target, making it difficult to perform image comparison and offset calculation. After setting to the intermediate focal length, the field of view of the camera, that is, the first current image, is as Figure 3 shown.
[0082] Optionally, step S33 includes:
[0083] S331: The preset cropping algorithms include the preset ratio algorithm, the preset coordinate algorithm, and the preset size algorithm;
[0084] S332: Obtain the field of view ratio based on the intermediate focal length, the configured focal length, and the preset ratio algorithm. The specific calculation process satisfies the following formula:
[0085]
[0086] In the formula: scale represents the field of view ratio, f small represents the intermediate focal length, and f large represents the configured focal length;
[0087] S333: Obtain the base height and base width based on the base reference map, and obtain the cropping start coordinates based on the field of view ratio, the base height, the base width, and the preset coordinate algorithm. The specific calculation process satisfies the following formula:
[0088]
[0089] In the formula: x represents the starting abscissa, y represents the starting ordinate, w represents the base width, and h represents the base height;
[0090] S334: Obtain the cropping width and cropping height based on the cropping start coordinates and the preset size algorithm. The specific calculation process satisfies the following formula:
[0091]
[0092] In the formula: w1 represents the cropping width, and h1 represents the cropping height;
[0093] S335: Obtain a cropping reference image based on the first current image, cropping start coordinates, cropping height, and cropping width.
[0094] In the specific implementation process, first calculate the field of view ratio through the focal length, and then obtain the cropping start coordinates according to the field of view ratio. At the same time, calculate the cropping size based on the size of the basic reference image, so that the required cropping reference image can be obtained according to the cropping start coordinates and the cropping size, narrowing the field of view and focusing on a finer picture, thereby realizing the accurate recognition and calculation of the subsequent offset. The cropping reference image is as Figure 4 shown, and the field of view is consistent with the basic reference Figure 1 image.
[0095] Optionally, step S35 includes:
[0096] S351: Obtain a second offset angle based on the second current image and the basic reference image;
[0097] S352: Drive the camera to move to the second driving point based on the second offset angle to obtain a third current image;
[0098] S353: Obtain a third offset angle based on the third current image and the basic reference image;
[0099] S354: When the third offset angle meets the preset offset range, set the second driving point as the current preset point to realize the automatic calibration of the camera preset point.
[0100] Optionally, when the third offset angle in step S354 does not meet the preset offset range, repeat the automatic calibration steps based on the second driving point, minimum focal length, configured focal length, and basic reference image to obtain the (N + 1)-th offset angle at the N-th driving point until the (N + 1)-th offset angle meets the preset offset range, and then set the N-th driving point as the current preset point to realize the automatic calibration of the camera preset point.
[0101] In the specific implementation process, by setting a reasonable preset offset range, automatically identify whether the calibration situation of the camera reaches the standard during the calibration process. When it does not meet the preset offset range, repeat the automatic calibration steps to ensure the accuracy of the automatic calibration result. Finally, at the current preset point, the field of view image of the camera at the configured focal length is as Figure 5 shown, and is consistent with the basic reference image within the allowable error range.
[0102] This embodiment provides a method for automatically calibrating the preset positions of a camera. Automatic calibration is achieved by comparing the offset of images. During the calibration process, the field of view range is changed by adjusting the focal length multiple times and cropping the images as a reference, thereby realizing hierarchical calibration of the automatic calibration of the camera from rough adjustment to fine adjustment, improving the accuracy of offset recognition and calculation, and ensuring the accuracy of the automatic calibration of the preset positions of the camera.
[0103] Embodiment 2:
[0104] This embodiment provides a system for automatically calibrating the preset positions of a camera, which is used to implement a method for automatically calibrating the preset positions of a camera, including:
[0105] A configuration module, which is used to obtain preset positions, configure the focal length, a basic reference image, and a minimum focal length reference image;
[0106] A preprocessing module, which is used to obtain the minimum focal length, and perform pre-adjustment based on the preset positions, the minimum focal length, and the minimum focal length reference image to obtain a pre-adjustment offset angle, so as to drive the camera to move to a pre-adjustment driving position based on the pre-adjustment offset angle;
[0107] An automatic calibration module, which is used to execute the automatic calibration steps based on the pre-adjustment driving position, the minimum focal length, the preset positions, the configured focal length, and the basic reference image: set the camera focal length to an intermediate focal length based on the minimum focal length and the configured focal length to obtain a first current image; obtain a cropping reference image based on the first current image, the basic reference image, and a preset cropping algorithm; obtain a first offset angle based on the cropping reference image and the basic reference image, so as to drive the camera to a first driving position based on the first offset angle; set the camera focal length to the configured focal length to obtain a second current image; obtain a second offset angle based on the second current image and the basic reference image, and drive the camera to move to the current preset position based on the second offset angle, thereby realizing the automatic calibration of the preset positions of the camera.
[0108] A system for automatically calibrating the preset positions of a camera provided in this embodiment first obtains basic parameter information through a configuration module, and then a preprocessing module makes a relatively large-scale pre-adjustment according to the minimum focal length and basic data information to prepare for subsequent fine adjustment, avoiding situations such as difficulty in identifying whether the point calibration is accurate when there are duplicate images at the preset positions during direct small-scale adjustment; then, after the pre-adjustment, the autofocus module makes focus adjustment, cropping, and fine offset adjustment according to the actual situation. During this process, the offset amount between the current image and the basic image data is compared to drive the camera to make offset adjustment to achieve automatic adjustment. At the same time, the field of view range is increased by adjusting the focal length to increase the amount of image information to achieve accurate identification and calculation of the offset amount, improving the accuracy of automatic calibration of the camera preset positions; the automatic calibration of the camera preset positions by this system does not require manual adjustment, overcoming the limitations of inaccurate identification, long time-consuming manual adjustment, and lack of timeliness in the actual application of the prior art, making the automatic calibration result more accurate and reliable, thus ensuring the long-term stable operation of the system that depends on the functions of the camera preset positions.
[0109] Embodiment Three:
[0110] This embodiment provides an implementation process for automatically calibrating the preset positions of a camera, as Figure 6 shown, including the following steps:
[0111] Start;
[0112] S01: Obtain the preset position, configure the focal length, the basic reference image, and the minimum focal length reference image;
[0113] S02: Drive the camera to move to the pre-driven position based on the preset position;
[0114] S03: Set the camera focal length to the minimum focal length and obtain the pre-adjustment image;
[0115] S04: Obtain the pre-adjustment offset angle based on the pre-adjustment image and the minimum focal length reference image, and drive the camera to move to the pre-adjustment drive position based on the pre-adjustment offset angle;
[0116] S05: Set the camera focal length to the intermediate focal length based on the minimum focal length and the configured focal length to obtain the first current image;
[0117] S06: Obtain the cropping reference image based on the first current image, the basic reference image, and the preset cropping algorithm;
[0118] S07: Obtain the first offset angle based on the cropping reference image and the basic reference image, and drive the camera to the first drive position based on the first offset angle;
[0119] S08: Set the camera focal length to the configured focal length to obtain the second current image;
[0120] S09: Obtain a second offset angle based on the second current image and the base reference image, and drive the camera to move to the second driving point based on the second offset angle to obtain a third current image;
[0121] S10: Obtain a third offset angle based on the third current image and the base reference image;
[0122] S11: Determine whether the third offset angle meets a preset offset range. If not, return to step S05. If so, execute step S12;
[0123] S12: Set the second driving point as the current preset point;
[0124] End.
[0125] Embodiment 4:
[0126] This embodiment provides an electronic device for automatically calibrating the preset point of a camera, including: a processor, a memory, and a computer program; wherein, the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device runs, the processor executes the computer program stored in the memory to enable the electronic device to execute a method for automatically calibrating the preset point of a camera.
[0127] The above is the preferred embodiment of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements are also regarded as the protection scope of the present invention.
Claims
1. A method for automatically calibrating camera preset points, characterized in that: The following steps are involved: Obtain basic parameter information of the camera, the basic parameter information including preset points, configured focal length, basic reference map and minimum focal length reference map; Obtaining the minimum focal length, and pre-adjusting based on the preset point, the minimum focal length, and the minimum focal length reference map, obtaining a pre-adjustment offset angle, and driving the camera to move to the pre-adjustment driving point based on the pre-adjustment offset angle; Perform an automatic calibration based on pre-adjusted drive point, minimum focus, preset points, configured focus and basic reference images: The camera focal length is set to an intermediate focal length based on the minimum focal length and the configured focal length, and a first current image is acquired; Acquire a cropping reference image based on the first current image, the basic reference image and a preset cropping algorithm; Acquire a first offset angle based on the clipping reference image and the base reference image, so as to drive the camera to a first driving point based on the first offset angle; Set the camera focal length to the configured focal length and obtain the second current image; A second offset angle is obtained based on the second current image and the basic reference image, and the camera is driven to move to the current preset point based on the second offset angle to achieve automatic calibration of the camera preset point.
2. The method for automatically calibrating camera preset points according to claim 1, characterized in that: The basic parameter information of the camera is obtained, and the basic parameter information includes preset points, configured focal length, basic reference map and minimum focal length reference map, including: Set the camera's preset positions and configure the focal length; Get basic reference images based on preset points and configured focal lengths; Set the camera focus to the minimum focus to obtain the minimum focus reference image.
3. The method for automatically calibrating camera preset points according to claim 1, characterized in that: The method of obtaining the minimum focal length, performing pre-adjustment based on a preset point, the minimum focal length, and a minimum focal length reference map, and obtaining a pre-adjustment offset angle to drive the camera to move to a pre-adjustment driving point based on the pre-adjustment offset angle includes: Based on the preset point, the camera is driven to move to the pre-driven point, and the focal length of the camera is set to the minimum focal length, so as to obtain a pre-adjusted image based on the pre-driven point; A pre-adjustment offset angle is obtained based on the pre-adjustment image and the minimum focal length reference image, so as to drive the camera to move to a pre-adjustment driving point based on the pre-adjustment offset angle.
4. The method for automatically calibrating camera preset points according to claim 1, characterized in that: In the automatic calibration step, the step of setting the camera focal length to an intermediate focal length based on the minimum focal length and the configured focal length, and acquiring a first current image, includes: The intermediate focal length is obtained based on the minimum focal length and the configured focal length. The specific calculation process satisfies the following formula: Where: f0 represents the minimum focal length, f 大 represents the configured focal length, f 小 represents the middle spacing; Set the camera focal length to the middle focal length and obtain the first current image.
5. The method for automatically calibrating camera preset points according to claim 1, characterized in that: In the automatic calibration step, obtaining a cropping reference image based on the first current image, the basic reference image and a preset cropping algorithm includes: The preset cropping algorithm includes a preset ratio algorithm, a preset coordinate algorithm and a preset size algorithm; The field of view ratio is obtained based on the intermediate focal length, the configured focal length and the preset ratio algorithm. The specific calculation process satisfies the following formula: Where: scale represents the field of view ratio, f 小 Represents the intermediate focal length, f 大 Represents the configuration focal length; Based on the basic reference image, the basic height and basic width are obtained, and the clipping start coordinates are obtained based on the field of view ratio, basic height, basic width and preset coordinate algorithm. The specific calculation process satisfies the following formula: In the formula: x represents the starting horizontal coordinate, y represents the starting vertical coordinate, w represents the foundation width, and h represents the foundation height; The clipping height and clipping height are obtained based on the clipping starting coordinates and the preset size algorithm. The specific calculation process satisfies the following formula: Where: w1 represents the cutting width, h1 represents the cutting height; A clipping reference is acquired based on the first current image, the clipping start coordinates, the clipping height, and the clipping height.
6. The method for automatically calibrating camera preset points according to claim 1, characterized in that: In the automatic calibration step, the step obtains a second offset angle based on the second current image and the basic reference image, drives the camera to move to the current preset point based on the second offset angle, and realizes automatic calibration of the preset point of the camera, including: Acquire a second offset angle based on the second current image and the base reference image; Driving the camera to move to a second driving point based on a second offset angle to obtain a third current image; Acquire a third offset angle based on the third current image and the base reference image; When the third offset angle satisfies the preset offset range, the second driving point is set as the current preset point to achieve automatic calibration of the camera preset point.
7. The method for automatically calibrating camera preset points according to claim 6, characterized in that: When the third offset angle satisfies the preset offset range, the second driving point is set as the current preset point to achieve automatic calibration of the camera preset point, further comprising: When the third offset angle does not meet the preset offset range, the automatic calibration step is repeatedly performed based on the second driving point, the minimum focal length, the configured focal length and the basic reference map to obtain the N+1th offset angle at the Nth driving point, until the N+1th offset angle meets the preset offset range, the Nth driving point is set as the current preset point to achieve automatic calibration of the camera preset points.
8. A system for automatically calibrating camera preset points, characterized in that: A method for automatically calibrating camera preset points according to any one of claims 1 to 7, comprising: A configuration module is used to obtain basic parameter information of the camera, wherein the basic parameter information includes preset points, configured focal length, basic reference map and minimum focal length reference map; A preprocessing module, used to obtain a minimum focal length, and perform pre-adjustment based on a preset point, a minimum focal length, and a minimum focal length reference map, to obtain a pre-adjustment offset angle, so as to drive the camera to move to a pre-adjustment driving point based on the pre-adjustment offset angle; An automatic calibration module is used to perform automatic calibration steps based on a pre-adjusted driving point, a minimum focal length, a preset point, a configured focal length and a basic reference map: setting the camera focal length to an intermediate focal length based on the minimum focal length and the configured focal length to obtain a first current image; obtaining a cropping reference reference based on the first current image, a basic reference map and a preset cropping algorithm; obtaining a first offset angle based on the cropping reference reference and the basic reference map to drive the camera to the first driving point based on the first offset angle; setting the camera focal length to a configured focal length to obtain a second current image; obtaining a second offset angle based on the second current image and the basic reference map, and driving the camera to move to a current preset point based on the second offset angle to achieve automatic calibration of the camera preset points.
9. The system for automatically calibrating camera preset points according to claim 8, characterized in that: The configuration module includes an initial configuration submodule and a data acquisition submodule; wherein: The initial configuration submodule is used to set the preset points and configure the focal length of the camera; The data acquisition submodule is used to acquire a basic reference image based on preset points and configured focal lengths; and to set the camera focal length to a minimum focal length to acquire a minimum focal length reference image.
10. An electronic device for automatically calibrating camera preset points, characterized in that: include: A processor, a memory and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to implement a method for automatically calibrating camera preset points as described in any one of claims 1 to 7.