Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Before describing further details of embodiments of the present application, an alternative camera calibration system that may be used to implement the principles of the present application will be described with reference to FIG. 1. In its most basic configuration, FIG. 1 is a schematic diagram of a camera calibration system according to an embodiment of the present invention. For descriptive purposes, the architecture portrayed is only one example of a suitable environment and is not intended to suggest any limitation as to the scope of use or functionality of the application. Neither should the platform be interpreted as having any dependency or requirement relating to any one or combination of components illustrated in FIG. 1.
As shown in fig. 1, the camera calibration system provided by the present application includes:
a plurality of calibrators 1.
In the alternative, the markers may be checkerboard or other flat patterns of known features. If the calibration object is a black and white checkerboard, the black checkerboard and the white checkerboard are squares with the same size; the number of the calibration objects can be adjusted or expanded according to needs.
The calibration object may be located on a calibration stand, and fig. 2 is a schematic view of an alternative calibration stand of the camera calibration system shown in fig. 1 according to the present application. As shown in fig. 2, the calibration frame 5 is used to set a plurality of calibration objects 1, and the number of the calibration objects 1 can be adjusted or expanded as required, such as 4 × 5, 3 × 3, etc. The back plate of the calibration frame 5 adopts colors different from the calibration objects, such as light green, yellow and the like, so as to avoid the false identification as the calibration objects.
It is easy to note that the calibration frame 5 is connected to the roller wheel with locking by four posts. Thus, the calibration frame 5 can be conveniently moved to a target site and fixed every time the camera calibration is performed.
And a plurality of sets of driving mechanisms 2, wherein each set of driving mechanism is connected with one calibration object and is used for driving the calibration object.
In an alternative, the driving mechanism may include a motor and may also include a cylinder. Each set of driving mechanism drives the corresponding calibration object, and the calibration object can be rotated to a target position.
As shown in fig. 1, the drive mechanism 2 may further include a drive mechanism base 22 and a calibration object base 21. The driving mechanism 2 is arranged on a driving mechanism base 22, the driving mechanism base 22 is arranged on the calibration frame 5, and the calibration object 1 is arranged on a calibration object base 21 which is exclusive and connected with the driving mechanism 2.
With reference to fig. 2, it is easy to notice that a certain gap is left between the calibration objects 1 of the calibration frame 5, so as to ensure that the rotation of the different driving mechanisms 2 and the calibration objects 1 will not interfere with each other.
And the controller 3 is respectively connected with the driving mechanism and the camera to be calibrated, and is used for controlling the camera to be calibrated to acquire an image under the condition that the driving mechanism is controlled to drive the calibration object to rotate to the target position, and determining a calibration result of the camera to be calibrated based on the image, wherein the image is an image comprising a plurality of calibration objects.
In an alternative scheme, the controller can be located in the host, and sends a moving instruction to each driving mechanism through the communication module; the controllers can also be positioned in each set of driving mechanism, and each set of driving mechanism moves to a target position according to the instruction of the respective controller; the controller can be a singlechip, a DSP, an FPGA and the like with a data processing function.
It should be noted that the target position may be selected on a plane forming an angle of plus or minus 45 degrees with the plane of the calibration frame. Regardless of the target position, it is necessary to ensure that all the calibration objects are within the field of view of the camera.
In an optional embodiment, the camera calibration system comprises a camera to be calibrated, a controller, a calibration frame and a communication module, wherein the calibration frame is provided with a driving mechanism which is installed with a calibration object in a set manner. Firstly, a camera to be calibrated is manually installed on a fixed support, a controller sends a moving instruction to a driving mechanism on a calibration frame through a communication module, and the driving mechanism drives a corresponding calibration object to rotate after receiving the moving instruction. If all of the calibration objects are rotated to their respective target positions, the drive mechanism sends a rotation success command to the controller. The controller further controls the camera to be calibrated to photograph all the calibration objects on the calibration frame. The more images are collected, the more accurate the obtained camera calibration result is. Thus, the controller may send a plurality of movement instructions to the drive mechanism for the camera to capture a plurality of images. After shooting is finished, the camera inputs all the multiple images into a preset calibration algorithm module, and then calibration parameters of the camera are obtained.
Based on the scheme provided by the above embodiment of the present application, the camera calibration system includes: a plurality of calibrators; each set of driving mechanism is connected with one calibration object and is used for driving the calibration object; and the controller is respectively connected with the driving mechanism and the camera to be calibrated and is used for controlling the camera to be calibrated to acquire an image under the condition that the driving mechanism is controlled to drive the calibration object to rotate to a target position, and determining a calibration result of the camera to be calibrated based on the image, wherein the image is an image comprising a plurality of calibration objects. Compared with the prior art, the camera calibration method has the advantages that the corresponding calibration objects are driven to rotate to the target positions through the driving mechanisms, then the camera is controlled to shoot a plurality of calibration objects, the calibration result is obtained by automatically running the calibration algorithm after the shooting is completed, the purpose of accurately calibrating the automatic camera is achieved, and the technical problems that the calibration time is long and the result is inaccurate due to the fact that the camera calibration is carried out manually in the related art are solved.
In an alternative embodiment, the driving mechanism includes three electric cylinders, and the controlling of the driving mechanism to rotate the calibration object to the target position includes: acquiring an angle corresponding to a target position; calculating respective strokes of the three electric cylinders based on the angles; and controlling the moving stroke of the three electric cylinders to drive the calibration object to rotate to the target position.
In an alternative, the electric cylinder may be a linear electric cylinder; the electric cylinder can be arranged on the driving mechanism base and can move along the axial direction of the electric cylinder; the movement of the three electric cylinders determines the rotation angle of the calibration object.
The electric cylinder is selected because the electric cylinder is a modular product which integrates a servo motor and a lead screw, and can convert the rotary motion of the servo motor into high-precision linear motion.
FIG. 3 is a schematic view of an alternative drive mechanism for the camera calibration system of FIG. 1 according to the present application. As shown in fig. 3, according to the principle that three points define a plane, the three linear electric cylinders 23 can define rotation of any angle within the maximum rotation angle range. The three linear electric cylinders 23 are arranged on the driving mechanism base 22 in a triangular distribution, the electric cylinders 23 move along the axial direction of the driving mechanism base, the calibration object base 21 is driven to rotate, and finally the rotation angle of the calibration object base 21 is determined by the strokes of the three electric cylinders 23. The controller firstly obtains the angle corresponding to the target position of each calibration object required to rotate, converts the angle into respective strokes of the three electric cylinders according to the principle that the three points determine one plane, and then controls the three electric cylinders to move the respective strokes so as to drive the calibration object to rotate to the target position.
Furthermore, the driving mechanism further comprises a universal transmission device, and each electric cylinder is connected with the calibration object through the universal transmission device.
In an alternative, the universal transmission device may be a universal connector, as shown in fig. 3, and the universal connector 24 is connected between the driving mechanism and the calibration object base 21 for transmitting the driving force of the driving mechanism to the calibration object.
In another alternative embodiment, the driving mechanism includes a motorized pan and tilt head, and the driving mechanism is controlled to drive the calibration object to rotate to the target position, including: acquiring an angle corresponding to a target position; and controlling the rotation angle of the electric holder to drive the calibration object to rotate to the target position.
In an alternative, the electric pan-tilt can be connected between the driving mechanism base and the calibration object for controlling the horizontal angle and the pitch angle of the calibration object.
The controller firstly obtains the angle corresponding to the target position of each calibration object required to rotate, and then controls the electric holder to rotate the angle, so as to drive the calibration object to rotate to the target position.
Optionally, the controller is further configured to: under the condition that the calibration object rotates to the target position, the target position is changed after the camera to be calibrated is controlled to collect images; and under the condition that the calibration object rotates to the changed target position, controlling the camera to be calibrated to acquire an image until the target position traverses all positions in a preset target position set.
In an alternative, the set of target positions may be a set of target positions of each calibration object when the camera to be calibrated first acquires an image. That is, the number of target positions in the set of target positions and the number of calibration objects may be equal.
Optionally, the system further comprises a hub for communication between the controller and the drive mechanism.
As shown in fig. 1, the hub 7 may communicate via ethernet, RS232, RS485, or RS 422.
The concentrator is used for receiving a rotation instruction sent by the controller, then driving the calibration objects to rotate to a target position, and feeding back whether each calibration object successfully rotates to the controller.
Optionally, determining a calibration result of the camera to be calibrated based on the image includes: inputting the image to a calibration algorithm; and determining a calibration result based on a calibration algorithm.
In an alternative, the calibration algorithm may be a traditional camera calibration method, a subjective vision camera calibration method, or a camera self-calibration method, and the calibration algorithm may be stored in a controller of the calibration platform in advance.
Optionally, the controller is further configured to: after the result of the calibration of the camera to be calibrated is obtained based on the image, the result is saved in a memory and/or a configuration file of the camera to be calibrated.
After the calibration result of the camera is obtained, the result is stored, so that the subsequent use is facilitated, and the operation of re-calibrating when the camera is used next time is avoided.
It should be noted that, in the calibration process, calibration parameters obtained by each calibration may be different, and therefore, multiple calibration processes may be performed to obtain multiple sets of calibration results. And screening a plurality of groups of calibration results according to a preset screening rule, thereby reducing errors and obtaining the most accurate calibration result.
In an alternative embodiment, the operator only needs to mount the camera to be calibrated on the fixing bracket, and the camera calibration system can start the calibration procedure to start automatic calibration. The system controls each calibration object to rotate to the target position one by one according to a predefined target position set (for example, 20 predefined rotation angles), and then controls the camera to take pictures of all calibration objects. And after all the predefined rotation angles are completely rotated and the photographing is finished, operating a calibration algorithm to obtain a calibration result, and writing the calibration result into a memory and/or a configuration file of the camera.
Compared with the prior art, the embodiment drives the corresponding calibration object to rotate to the target position through the plurality of driving mechanisms, specifically, the three electric cylinders or the electric pan-tilt drive the calibration object to rotate, and feeds back information about whether the rotation is successful to the controller, then the camera is controlled to shoot the plurality of calibration objects, and the calibration result is obtained by automatically running the calibration algorithm after the shooting is completed, so that the aim of accurately calibrating the automatic camera is fulfilled, and the technical problems of long calibration time and inaccurate result caused by manually calibrating the camera in the related art are solved.
Example 2
In the camera calibration platform to be calibrated provided in embodiment 1, this embodiment provides a calibration method applied to a camera calibration system, and it should be noted that the steps illustrated in the flowchart of the drawings may be executed in a computer system such as a set of computer executable instructions, and although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be executed in an order different from that here.
Fig. 4 is a flowchart of a calibration method applied to a camera calibration system according to an embodiment of the present invention, where the calibration system includes a camera to be calibrated, multiple sets of driving mechanisms and multiple calibration objects, and each set of driving mechanisms drives one calibration object, the calibration method may include the following steps:
and step S402, driving the calibration object to rotate to the target position through the driving mechanism.
In the alternative, the markers may be checkerboard or may be a planar pattern of other known features. If the calibration object is a black and white checkerboard, the black check and the white check are squares with the same size; the number of the calibration objects can be adjusted or expanded according to needs.
In an alternative, the driving mechanism may include a motor and may also include a cylinder. Each set of driving mechanism drives the corresponding calibration object, and the calibration object can be rotated to a target position.
As shown in fig. 1, the drive mechanism 2 may further include a drive mechanism base 22 and a calibration object base 21. The driving mechanism 2 is arranged on a driving mechanism base 22, the driving mechanism base 22 is arranged on the calibration frame 5, and the calibration object 1 is arranged on a calibration object base 21 which is exclusive to the driving mechanism 2 and is connected with the driving mechanism 2.
The calibration object can be located on a calibration frame, as shown in fig. 2, the calibration frame 5 is used to set a plurality of calibration objects 1, and the number of the calibration objects 1 can be adjusted or expanded as required, such as 4 × 5, 3 × 3, etc. The back plate of the calibration frame 5 adopts colors different from the calibration objects, such as light green, yellow and the like, so as to avoid the false identification as the calibration objects.
It is easy to notice that a certain gap is left between the calibration objects 1 of the calibration frame 5 to ensure that the rotation of different driving mechanisms 2 and the calibration objects 1 do not interfere with each other. The calibration frame 5 is connected to the roller 6 with lock by four struts. Thus, the calibration frame 5 can be conveniently moved to a target site and fixed every time the camera calibration is performed.
And S404, controlling the camera to be calibrated to collect images under the condition that the calibration object rotates to the target position, wherein the images comprise a plurality of calibration objects.
In an alternative, the controller for executing the method can be located in the host, and sends a moving instruction to each driving mechanism through the communication module; the controllers can also be positioned in each set of driving mechanism, and each set of driving mechanism moves to a target position according to the instruction of the respective controller; the controller can be a singlechip, a DSP, an FPGA and the like with a data processing function.
It should be noted that the target position may be selected on a plane forming an angle of plus or minus 45 degrees with the plane of the calibration frame. Wherever the target location is, it is necessary to ensure that all the targets are within the field of view of the camera.
Step S406, determining a calibration result of the camera to be calibrated based on the image.
Based on the scheme provided by the above embodiment of the present application, the camera calibration system includes a camera to be calibrated, a plurality of sets of driving mechanisms and a plurality of calibration objects, each set of driving mechanism drives one calibration object, and the calibration method includes: driving the calibration object to rotate to a target position through a driving mechanism; under the condition that the calibration object rotates to the target position, controlling a camera to be calibrated to collect images, wherein the images comprise a plurality of calibration objects; and determining a calibration result of the camera to be calibrated based on the image. The camera calibration method and the camera calibration device have the advantages that the corresponding calibration objects are driven to rotate to the target positions through the driving mechanisms, then the camera is controlled to shoot the plurality of calibration objects, calibration results are obtained by automatically running a calibration algorithm after the shooting is completed, the purpose of accurately and automatically calibrating the camera is achieved, and the technical problems that the calibration time is long and the results are inaccurate due to the fact that the camera calibration is carried out manually in the related technology are solved.
In an alternative embodiment, the driving mechanism includes three electric cylinders, and the step S402 of driving the calibration object to rotate to the target position through the driving mechanism may specifically include:
s4021, acquiring an angle corresponding to the target position;
step S4022, calculating respective strokes of the three electric cylinders based on the angles;
step S4023, controlling the movement stroke of the three electric cylinders to drive the calibration object to rotate to the target position.
In an alternative, the electric cylinder may be a linear electric cylinder; the electric cylinder can be arranged on the driving mechanism base and can move along the axial direction of the electric cylinder; the movement of the three electric cylinders determines the rotation angle of the calibration object.
The electric cylinder is selected because the electric cylinder is a modular product which integrates a servo motor and a lead screw, and can convert the rotary motion of the servo motor into high-precision linear motion.
As shown in fig. 3, according to the principle that three points define a plane, the three linear electric cylinders 23 can define rotation of any angle within the maximum rotation angle range. The three linear electric cylinders 23 are arranged on the driving mechanism base 22 in a triangular distribution, the electric cylinders 23 move along the axial direction of the driving mechanism base, the calibration object base 21 is driven to rotate, and finally the rotation angle of the calibration object base 21 is determined by the strokes of the three electric cylinders 23. The controller firstly obtains the angle corresponding to the target position of each calibration object required to rotate, converts the angle into respective strokes of the three electric cylinders according to the principle that the three points determine one plane, and then controls the three electric cylinders to move the respective strokes so as to drive the calibration object to rotate to the target position.
Furthermore, the driving mechanism further comprises a universal transmission device, and each electric cylinder is connected with the calibration object through the universal transmission device.
In an alternative, the universal transmission device may be a universal connector, as shown in fig. 3, and the universal connector 24 is connected between the driving mechanism and the calibration object base 21 for transmitting the driving force of the driving mechanism to the calibration object.
In another alternative embodiment, the driving mechanism includes a motorized pan and tilt head, and the step S402 drives the calibration object to rotate to the target position through the driving mechanism, which may specifically include:
step S4024, acquiring an angle corresponding to the target position;
and S4025, controlling the rotation angle of the electric holder to drive the calibration object to rotate to the target position.
In an alternative, the electric pan-tilt can be connected between the driving mechanism base and the calibration object, and is used for controlling the horizontal angle and the pitching angle of the calibration object.
The controller firstly obtains the angle corresponding to the target position of each calibration object required to rotate, and then controls the electric holder to rotate the angle, so as to drive the calibration object to rotate to the target position.
Optionally, in step S404, after controlling the camera to be calibrated to capture an image when the calibration object is rotated to the target position, the method may further include:
step S4051, changing the target position;
step S4052, under the condition that the calibration object rotates to the changed target position, controlling the camera to be calibrated to acquire images until the target position traverses all positions in the preset target position set.
In an alternative, the set of target positions may be a set of target positions of each calibration object when the camera to be calibrated first acquires an image. That is, the number of target positions in the set of target positions and the number of calibration objects may be equal.
Optionally, the camera calibration system may further include a hub, and the hub may communicate via ethernet, RS232, RS485, or RS 422.
The concentrator is used for receiving a rotation instruction sent by the controller, then driving the calibration objects to rotate to a target position, and feeding back whether each calibration object rotates successfully or not to the controller.
Optionally, the step S406 of determining the calibration result of the camera to be calibrated based on the image may include the following steps:
step S4061, inputting the image into a calibration algorithm;
step S4062, based on the calibration algorithm, the calibration result is determined.
In an alternative, the calibration algorithm may be a traditional camera calibration method, a subjective visual camera calibration method, or a camera self-calibration method, and the calibration algorithm may be stored in a controller of the calibration platform in advance.
Optionally, after determining the calibration result of the camera to be calibrated based on the image in step S406, the method may further include: and step S408, storing the calibration result.
After the calibration result of the camera is obtained, the result is stored, so that the subsequent use is facilitated, and the operation of re-calibrating when the camera is used next time is avoided.
It should be noted that, in the calibration process, calibration parameters obtained by each calibration may be different, and therefore, multiple calibration processes may be performed to obtain multiple sets of calibration results. And screening a plurality of groups of calibration results according to a preset screening rule, thereby reducing errors and obtaining the most accurate calibration result.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 3
According to an embodiment of the invention, a calibration device applied to a camera calibration system is provided, the calibration system comprises a camera to be calibrated, a plurality of sets of driving mechanisms and a plurality of calibration objects, each set of driving mechanism drives one calibration object, and the calibration device comprises a driving module, an acquisition module and a determination module.
The driving module is used for driving the calibration object to rotate to a target position through the driving mechanism; the calibration device comprises an acquisition module, a calibration module and a calibration module, wherein the acquisition module controls a camera to be calibrated to acquire an image under the condition that a calibration object rotates to a target position, and the image comprises a plurality of images of the calibration object; and the determining module is used for determining the calibration result of the camera to be calibrated based on the image.
In another alternative embodiment, the drive mechanism comprises three electric cylinders, and the drive module comprises: the acquisition module is used for acquiring an angle corresponding to the target position; the calculation module is used for calculating respective strokes of the three electric cylinders based on the angles; the first control module is used for controlling the moving stroke of the three electric cylinders so as to drive the calibration object to rotate to the target position.
Further, the driving mechanism further comprises a universal transmission device, and each electric cylinder is connected with the calibration object through the universal transmission device.
In another alternative embodiment, the driving mechanism comprises a motorized pan and tilt head, and the driving module comprises: the acquisition module is used for acquiring an angle corresponding to the target position; and the second control module is used for controlling the rotation angle of the electric holder so as to drive the calibration object to rotate to the target position.
Optionally, the apparatus may further include: the change module is used for controlling the camera to be calibrated to change the target position after acquiring the image under the condition that the calibration object rotates to the target position; and the third control module is used for controlling the camera to be calibrated to acquire images under the condition that the calibration object rotates to the changed target position until the target position traverses all positions in the preset target position set.
Optionally, the camera calibration system may further include a hub.
Optionally, the determining module includes: the input module is used for inputting the image to a calibration algorithm; and the determining submodule is used for determining a calibration result based on a calibration algorithm.
Optionally, the apparatus may further include: and the storage module is used for storing the calibration result after the calibration result of the camera to be calibrated is determined based on the image.
It should be noted that the driving module, the collecting module and the determining module correspond to steps S402 to S406 in embodiment 2, and the three modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure of embodiment 4. It should be noted that the above modules may be implemented in the camera calibration system provided in the first embodiment as a part of the apparatus.
Example 4
According to an embodiment of the present invention, a storage medium is provided, where the storage medium includes a stored program, and when the program runs, a device in which the storage medium is located is controlled to execute the calibration method applied to the camera calibration system in embodiment 2.
In an alternative, the storage medium may be located in the control unit of the camera calibration system of embodiment 1, or may exist independently.
Example 5
According to an embodiment of the present invention, a processor is provided, and the processor is configured to run a program, wherein the calibration method applied to the camera calibration system in embodiment 2 is executed when the program runs.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
In the above embodiments of the present invention, the description of each embodiment has its own emphasis, and reference may be made to the related description of other embodiments for parts that are not described in detail in a certain embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be an indirect coupling or communication connection through some interfaces, units or modules, and may be electrical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and amendments can be made without departing from the principle of the present invention, and these modifications and amendments should also be considered as the protection scope of the present invention.