Gun calibration method, device and electronic equipment
Through virtual camera parameters and projection change matrix calculation, the problem of low calibration accuracy of bolts is solved, and an efficient and low-cost bolt calibration method is realized.
Patent Information
- Application Number
- CN202111163705.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-30
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2041-09-30
AI Technical Summary
The existing bolt calibration methods are low in accuracy and high in cost, mainly due to deviations in the coordinate system conversion process.
By obtaining the actual pixel coordinates and position coordinates of the target bolt, the virtual pixel coordinates are determined using the projection change matrix of the virtual camera, and the target camera parameters are calculated through the difference, replacing the traditional coordinate system conversion and improving calibration accuracy.
High-precision bolt calibration is realized, reducing data acquisition costs, and improving calibration efficiency and accuracy.
Smart Images

Figure CN113850875B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a gun calibration method, device and electronic equipment. Background Art
[0002] A bolt-mounted camera is mounted at a fixed height, such as 30 meters, and at a fixed angle. Therefore, the images captured by the bolt-mounted camera are from a fixed angle. To obtain the GPS value of every point in the image, it is typically necessary to calibrate several points for measurement, perform a coordinate system conversion, and estimate the GPS value at each point to calibrate the bolt-mounted camera parameters. However, due to the inherent errors in the coordinate system conversion process, existing bolt-mounted camera calibration methods have low accuracy. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a gun calibration method, device, and electronic device to solve the problems of low accuracy and high cost of gun calibration methods.
[0004] According to a first aspect, an embodiment of the present invention provides a bolt calibration method, comprising:
[0005] Obtain the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun;
[0006] Based on a preset search range, obtaining virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range;
[0007] The target camera parameters of the target gun camera are determined according to the difference between the virtual pixel coordinates corresponding to each of the calibration points and the actual pixel coordinates.
[0008] The gun camera calibration method provided by the embodiment of the present invention uses the projection change matrix corresponding to the virtual camera to determine the projection of the actual position coordinates of the calibration point under the virtual camera, determines the virtual pixel coordinates, and then uses the difference between the virtual pixel coordinates and the actual pixel coordinates to determine the target camera parameters. That is, the virtual camera is used to estimate the posture of the target gun camera, replacing the existing coordinate system conversion and improving the accuracy of the gun camera calibration.
[0009] In combination with the first aspect, in a first implementation of the first aspect, obtaining, based on a preset search range, virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each virtual camera parameter within the preset search range includes:
[0010] Get the current search step size and the initial virtual camera parameters of the virtual camera;
[0011] Determining the preset search range based on the current search step size and the initial virtual camera parameters;
[0012] Determining multiple sets of virtual camera parameters within the preset search range;
[0013] The virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters are obtained.
[0014] The gun camera calibration method provided by the embodiment of the present invention limits the preset search range of camera parameters by using the current search step length, thereby avoiding the influence of large-scale search on the computational complexity and improving the search efficiency.
[0015] In combination with the first embodiment of the first aspect, in the second embodiment of the first aspect, determining the target camera parameters of the target gun according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each of the calibration points includes:
[0016] Calculating the difference between the virtual pixel coordinates of each calibration point and the corresponding actual pixel coordinates under each set of virtual camera parameters;
[0017] When all the differences meet a preset condition, optimal virtual camera parameters are determined, and target camera parameters of the target camera are determined based on the optimal virtual camera parameters.
[0018] The gun camera calibration method provided by an embodiment of the present invention determines multiple sets of camera parameters within a search range, then uses the differences to determine a set of optimal camera parameters from the multiple sets of camera parameters, and then determines the target camera parameters based on the optimal camera parameters. The camera parameters are gradually adjusted to improve the accuracy of the target camera parameters finally determined.
[0019] In combination with the second embodiment of the first aspect, in the third embodiment of the first aspect, when each of the differences satisfies a preset condition, determining optimal virtual camera parameters and determining target camera parameters of the target camera based on the optimal virtual camera parameters includes:
[0020] Determining whether the current search step size reaches the search accuracy;
[0021] When the current search step does not reach the search accuracy, updating the initial virtual camera parameters of the virtual camera based on the optimal virtual camera parameters;
[0022] Reducing the current search step size to obtain an updated search step size;
[0023] Determining an updated search range based on the updated initial virtual camera parameters and the updated search step size;
[0024] Acquire multiple sets of virtual camera parameters from the updated search range according to the updated search step size to re-determine the target camera parameters.
[0025] The gun camera calibration method provided by the embodiment of the present invention limits the search step by the search accuracy, that is, gradually reduces the amplitude of camera parameter adjustment, thereby achieving the corresponding accuracy, which can improve the search efficiency.
[0026] In combination with the third implementation manner of the first aspect, in the fourth implementation manner of the first aspect, when each of the differences satisfies a preset condition, determining optimal virtual camera parameters and determining target camera parameters of the target camera based on the optimal virtual camera parameters further includes:
[0027] When the search step reaches the search accuracy, the optimal camera parameters are determined as the target camera parameters.
[0028] In combination with the first aspect, in a fifth implementation of the first aspect, determining the target camera parameters of the target gun according to the difference between the virtual pixel coordinates corresponding to each of the calibration points and the actual pixel coordinates includes:
[0029] Obtaining fixed camera parameters of the virtual camera and camera parameters determined based on the difference between the virtual pixel coordinates corresponding to each of the calibration points and the actual pixel coordinates;
[0030] The target camera parameters are determined based on the camera parameters and the fixed camera parameters.
[0031] The gun camera calibration method provided by the embodiment of the present invention does not require adjustment of the fixed camera parameters of the virtual camera, but only adjusts the adjustable camera parameters, which can reduce the amount of data processing and improve processing efficiency.
[0032] In combination with the first aspect, in a sixth implementation of the first aspect, the method further includes:
[0033] Obtaining the pixel coordinates of each pixel point in the image corresponding to the target gun;
[0034] Based on the target camera parameters and the pixel coordinates, the actual position coordinates corresponding to each pixel point are determined.
[0035] The gun camera calibration method provided in the embodiment of the present invention obtains the target camera parameters of the target gun camera through calibration, and then obtains the actual position coordinates corresponding to each pixel short on this basis, thereby ensuring the accuracy of the obtained actual position coordinates.
[0036] According to a second aspect, an embodiment of the present invention provides a bolt calibration device, comprising:
[0037] The first acquisition module is used to obtain the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun;
[0038] A second acquisition module is configured to acquire, based on a preset search range, virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range;
[0039] The adjustment module is used to determine the target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates corresponding to each of the calibration points and the actual pixel coordinates.
[0040] The gun calibration device provided by the embodiment of the present invention uses the projection change matrix corresponding to the virtual camera to determine the projection of the actual position coordinates of the calibration point under the virtual camera, determines the virtual pixel coordinates, and then uses the difference between the virtual pixel coordinates and the actual pixel coordinates to determine the target camera parameters. That is, the virtual camera is used to estimate the posture of the target gun, replacing the existing coordinate system conversion and improving the accuracy of the gun calibration.
[0041] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the gun calibration method described in the first aspect or any one of the embodiments of the first aspect by executing the computer instructions.
[0042] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the gun calibration method described in the first aspect or any one embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 is a flow chart of a bolt calibration method according to an embodiment of the present invention;
[0045] Figure 2 is a schematic diagram of calibration points according to an embodiment of the present invention;
[0046] Figure 3 is a flow chart of a bolt calibration method according to an embodiment of the present invention;
[0047] Figure 4 is a flow chart of a bolt calibration method according to an embodiment of the present invention;
[0048] Figure 5 is a structural block diagram of a gun calibration device according to an embodiment of the present invention;
[0049] Figure 6 It is a schematic diagram of the hardware structure of the electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0050] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0051] The gun camera calibration method provided in an embodiment of the present invention calibrates the camera parameters of the target gun camera through a virtual camera. By collecting a small number of calibration points (for example, 8-12), the camera parameter calibration can be achieved, which greatly reduces the cost of data collection. Secondly, the virtual camera pose estimation method is used to replace the coordinate system conversion in the existing technology to improve the calibration accuracy.
[0052] According to an embodiment of the present invention, an embodiment of a gun calibration method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0053] In this embodiment, a bolt calibration method is provided, which can be used for electronic devices such as computers, mobile phones, tablet computers, etc. Figure 1 FIG. 1 is a flow chart of a method for calibrating a gun according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0054] S11, obtaining the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun.
[0055] The target camera captures an image of a real-world scene, determines the actual pixel coordinates of the calibration points within the image, and obtains the actual position coordinates of the calibration points. Specifically, the calibration points can be placed within the real-world scene. After the target camera captures an image including the calibration points, it transmits the captured image to an electronic device, which performs image analysis and determines the actual pixel coordinates of the calibration points within the image. The actual position coordinates of the calibration points can be acquired by a positioning acquisition device and transmitted to the electronic device. The method for acquiring the actual position coordinates is not limited herein and can be configured based on actual needs.
[0056] Figure 2 The diagram of the calibration points is shown. The calibration points can be distributed at various locations of the image captured by the target gun. Try to select dispersed locations as calibration points. Figure 2 It is only an illustration and does not limit the scope of protection of the present invention.
[0057] S12: Based on the preset search range, obtain virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range.
[0058] The preset search range can be set based on empirical values, or by first setting initial virtual camera parameters and search steps, and then determining the preset search range based on these parameters. There are no specific restrictions on the specific method for determining the preset search range, and it can be set according to actual needs.
[0059] The electronic device determines multiple sets of virtual camera parameters within a preset search range. The number of sets of virtual camera parameters determined can be set based on actual conditions. The virtual camera parameters include, but are not limited to, camera height (h), camera horizontal rotation angle (pan), camera vertical rotation angle (tile), camera axial rotation angle (roll), and camera field of view (FOV). The specific camera parameters that need to be calibrated are not limited herein and can be set based on actual conditions.
[0060] The actual coordinates of the calibration points are objective and do not change with camera parameters. Therefore, they can be used as a reference for calibration. If the virtual camera parameters accurately represent the target camera's parameters, then the virtual pixel coordinates of the calibration points under the virtual camera will be identical to their actual pixel coordinates, or within the theoretical error range. Therefore, camera parameters can be calibrated based on this principle.
[0061] Specifically, after the electronic device obtains each set of virtual camera parameters, it uses open-source tools to obtain the correspondence between actual position coordinates and pixel coordinates for each set of virtual camera parameters, thereby obtaining the virtual pixel coordinates corresponding to the actual position coordinates for each set of virtual camera parameters. For example, when calibrating a bolt-on camera, 10 calibration points are set. For the first set of virtual camera parameters, the virtual pixel coordinates of the 10 calibration points can be obtained; for the second set of virtual camera parameters, the virtual pixel coordinates of the 10 calibration points can be obtained; and so on, and so forth, to determine the virtual pixel coordinates of each calibration point corresponding to each set of virtual camera parameters.
[0062] Among them, when the virtual camera parameters change, the virtual pixel coordinates corresponding to each calibration point also change accordingly.
[0063] S13, determining the target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each calibration point.
[0064] As described above, for each calibration point, if the difference between the corresponding virtual pixel coordinates and the actual pixel coordinates meets the preset conditions, it means that the current virtual camera parameters can represent the target camera parameters of the target gun. If multiple sets of virtual camera parameters exist that all meet the preset conditions, then the optimal set of virtual camera parameters can be determined from the multiple sets of virtual camera parameters that meet the preset conditions and determined as the target camera parameters. If no virtual camera parameters meet the preset conditions, the search range is redefined, and the redefined search range does not intersect with the preset search range. Multiple sets of virtual camera parameters are determined within the redefined search range to re-determine the target camera parameters.
[0065] This step will be described in detail below.
[0066] The gun camera calibration method provided in this embodiment uses the projection change matrix corresponding to the virtual camera to determine the projection of the actual position coordinates of the calibration point under the virtual camera, determines the virtual pixel coordinates, and then uses the difference between the virtual pixel coordinates and the actual pixel coordinates to determine the target camera parameters. That is, the virtual camera is used to estimate the posture of the target gun camera, replacing the existing coordinate system conversion, thereby improving the accuracy of the gun camera calibration.
[0067] In this embodiment, a bolt calibration method is provided, which can be used for electronic devices such as computers, mobile phones, tablet computers, etc. Figure 3 FIG. 1 is a flow chart of a method for calibrating a gun according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0068] S21, obtaining the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun.
[0069] For details, please see Figure 2 S11 of the illustrated embodiment will not be described in detail here.
[0070] S22 , based on the preset search range, obtaining virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range.
[0071] Specifically, the above S22 includes:
[0072] S221, obtaining the current search step and the initial virtual camera parameters of the virtual camera.
[0073] The current search step represents the change in each adjustment made to the initial virtual camera parameters. Its specific values can be set based on actual needs and are not limited here. The specific values of the virtual camera's initial virtual camera parameters can be set based on empirical values or randomly, and there are no restrictions on how to set them. The initial virtual camera parameters of the virtual camera are used to represent the initial virtual camera parameters of the target camera during calibration, i.e., the target camera is represented by the virtual camera.
[0074] S222: Determine a preset search range based on the current search step size and the initial virtual camera parameters.
[0075] If the initial virtual camera parameters include five parameters, represented by initial virtual camera parameters params = [h, pan, tile, roll, fov], and the current search step is step, then the corresponding search range is params ± c1 * step, where c1 is a constant. For example, if the initial value of the camera height h is h0, then the search range for the camera height h is: h ± c1 * step.
[0076] S223: Determine multiple sets of virtual camera parameters within a preset search range.
[0077] After the electronic device determines the preset search range, it can randomly determine multiple virtual camera parameters within the preset search range of each camera parameter, thereby determining multiple groups of virtual camera parameters.
[0078] S224, obtaining virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters.
[0079] The electronic device uses an open source tool to obtain the correspondence between the actual position coordinates and the pixel coordinates for each set of virtual camera parameters, and obtains the virtual pixel coordinates corresponding to the actual position coordinates for each set of virtual camera parameters. For example, the electronic device uses the Cosium open source tool, with the virtual camera parameters and the actual position coordinates as input and the corresponding virtual pixel coordinates as output.
[0080] S23, determining the target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each calibration point.
[0081] Specifically, the above S23 includes:
[0082] S231, calculating the difference between the virtual pixel coordinates of each calibration point and the corresponding actual pixel coordinates under each set of virtual camera parameters.
[0083] If there are 10 calibration points and 10 sets of virtual camera parameters, then the virtual pixel coordinates of each calibration point can be obtained for each set of virtual camera parameters. The electronic device calculates the difference between the virtual pixel coordinates of the 10 calibration points and the corresponding actual pixel coordinates for each set of virtual camera parameters. The difference can be a variance, mean square error, or difference, etc.
[0084] S232: Determine whether the differences corresponding to all calibration points meet a preset condition.
[0085] All calibration points are used to constrain the camera parameters. This means that the determined camera parameters must ensure that the differences corresponding to all calibration points meet preset conditions. For example, if there are 10 sets of virtual camera parameters and 10 calibration points, the electronic device needs to calculate whether the difference between the virtual pixel coordinates and the actual pixel coordinates of each calibration point meets the preset conditions under each set of virtual camera parameters. If the difference between the virtual pixel coordinates and the actual pixel coordinates of all calibration points under the current set of virtual camera parameters meets the preset conditions, the current set of virtual camera parameters can be used as the target camera parameters. If the difference between the virtual pixel coordinates and the actual pixel coordinates of any calibration point under the current set of virtual camera parameters does not meet the preset conditions, the current set of virtual camera parameters is discarded.
[0086] When the differences corresponding to all calibration points meet the preset conditions, execute S234; otherwise, execute other operations.
[0087] The other operations may include redefining the search range, or redefining multiple sets of virtual camera parameters based on a preset search range, and so on.
[0088] S233 , determining optimal virtual camera parameters and determining target camera parameters of the target camera based on the optimal virtual camera parameters.
[0089] When the electronic device determines that there are multiple sets of virtual camera parameters whose differences at all calibration points meet a preset condition, the electronic device may determine the set of virtual camera parameters with the smallest difference from the multiple sets of virtual camera parameters and determine the set as the optimal virtual camera parameters. If only one set of virtual camera parameters exists, the set is determined as the optimal virtual camera parameters.
[0090] After determining the optimal virtual camera parameters, the optimal virtual camera parameters can be used as target camera parameters; or, in order to further improve the accuracy of the camera parameters, the current search step size can be reduced based on the current search step size, and the search range can be determined again.
[0091] By determining multiple sets of virtual camera parameters within the search range, and then using the differences to determine a set of optimal virtual camera parameters from the multiple sets of virtual camera parameters, and then determining the target camera parameters based on the optimal virtual camera parameters, the virtual camera parameters are gradually adjusted to improve the accuracy of the target camera parameters finally determined.
[0092] As an optional implementation of this embodiment, the above S233 may include:
[0093] (1) Determine whether the current search step size reaches the search accuracy.
[0094] (2) when the current search step does not reach the search accuracy, updating the initial virtual camera parameters of the virtual camera based on the optimal virtual camera parameters;
[0095] (3) Reduce the current search step size to obtain the updated search step size.
[0096] (4) Determine the updated search range based on the updated initial virtual camera parameters and the updated search step size.
[0097] (5) Obtain multiple sets of virtual camera parameters from the updated search range according to the updated search step size to re-determine the target camera parameters.
[0098] Electronic devices can set the search accuracy of the search step size. Before adjusting the current search step size, they first determine whether the search accuracy has been achieved. If the search accuracy has not been achieved, it indicates that the current search step size can be further reduced. Based on the optimal camera parameters, the search range can be adjusted using the search step size until the search accuracy is achieved.
[0099] Specifically, the electronic device uses the optimal virtual camera parameters as the updated initial virtual camera parameters, reduces the current search step size to obtain an updated search step size, and then re-determines an updated search range based on the updated initial virtual camera parameters and the updated search step size. After the search range is determined, the electronic device obtains multiple sets of virtual camera parameters within the search range based on the updated search step size, and then re-determines the target camera parameters using the aforementioned steps S22-S23.
[0100] By limiting the search step size through the search accuracy, that is, gradually reducing the amplitude of camera parameter adjustment to achieve the corresponding accuracy, the search efficiency can be improved.
[0101] The gun camera calibration method provided in this embodiment limits the search range of camera parameters by using the search step size, thereby avoiding the impact of large-range search on the computational complexity and improving the search efficiency.
[0102] As a specific implementation of this embodiment, the above-mentioned bolt calibration method includes:
[0103] Step 1: Initialize a camera parameter params = [h, pan, tile, roll, fov] and search step size step;
[0104] Step 2: Search for the best camera parameters best_params = [h, pan, tile, roll, fov] within the range of params ± 10 * step;
[0105] Step 3: Determine whether the current step reaches the set accuracy. If so, stop searching and the parameters are the final parameters. Go to step 4. Otherwise, update params to the current best_params, search step step = step / 10, and go to step 2.
[0106] Step 4: Update params to the current best_params.
[0107] In this embodiment, a bolt calibration method is provided, which can be used for electronic devices such as computers, mobile phones, tablet computers, etc. Figure 4 FIG. 1 is a flow chart of a method for calibrating a gun according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0108] S31, obtaining the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun.
[0109] For details, please see Figure 1 S11 of the illustrated embodiment will not be described in detail here.
[0110] S32: Based on the preset search range, obtain virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range.
[0111] For details, please see Figure 3 S22 of the illustrated embodiment will not be described in detail here.
[0112] S33, determining target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates corresponding to each calibration point and the actual pixel coordinates.
[0113] Specifically, the above S33 includes:
[0114] S331, obtaining the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun.
[0115] Regarding the specific method of obtaining the actual pixel coordinates and the actual position coordinates, please refer to the above description and will not be repeated here.
[0116] S332 , obtaining fixed camera parameters of the virtual camera and camera parameters determined based on the difference between the virtual pixel coordinates corresponding to each calibration point and the actual pixel coordinates.
[0117] Fixed camera parameters are those that do not require adjustment, such as the camera's longitude, latitude, and image resolution aspect ratio. Adjustable camera parameters include, but are not limited to, camera height (h), camera pan (pan), camera tile (tile), camera roll (roll), and camera field of view (FOV).
[0118] S333: Determine target camera parameters based on the camera parameters and the fixed camera parameters.
[0119] The electronic device fuses the fixed camera parameters and the camera parameters to finally determine the target camera parameters.
[0120] S34, obtaining the pixel coordinates of each pixel point in the image corresponding to the target gun.
[0121] S35: Determine the actual position coordinates corresponding to each pixel point based on the target camera parameters and the pixel coordinates.
[0122] After determining the target camera parameters of the target camera, the electronic device can use these target camera parameters to determine the actual coordinates of each pixel in the image captured by the target camera. Specifically, for each pixel in the image corresponding to the target camera, the target camera parameters can be used to convert pixel coordinates to actual position coordinates, thereby determining the actual position coordinates corresponding to each pixel.
[0123] The bolt camera calibration method provided in this embodiment does not require adjustment of the virtual camera's fixed camera parameters; only the adjustable camera parameters are adjusted, reducing data processing and improving processing efficiency. After calibrating the target bolt camera's target camera parameters, the actual position coordinates corresponding to each pixel are obtained based on these parameters, ensuring the accuracy of the obtained actual position coordinates.
[0124] This embodiment also provides a bolt calibration device for implementing the aforementioned embodiments and preferred implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. While the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
[0125] This embodiment provides a bolt calibration device, such as Figure 5 Shown, including:
[0126] The first acquisition module 41 is used to obtain the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun;
[0127] A second acquisition module 42 is configured to acquire, based on a preset search range, virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range;
[0128] The adjustment module 43 is configured to determine the target camera parameters of the target gun according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each of the calibration points.
[0129] The gun calibration device provided in this embodiment uses the projection change matrix corresponding to the virtual camera to determine the projection of the actual position coordinates of the calibration point under the virtual camera, determines the virtual pixel coordinates, and then uses the difference between the virtual pixel coordinates and the actual pixel coordinates to determine the target camera parameters. That is, the virtual camera is used to estimate the posture of the target gun, replacing the existing coordinate system conversion, thereby improving the accuracy of the gun calibration.
[0130] The gun calibration device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0131] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.
[0132] An embodiment of the present invention further provides an electronic device having the above Figure 5 The bolt calibration device shown.
[0133] See also Figure 6 , Figure 6 is a structural diagram of an electronic device provided by an optional embodiment of the present invention, such as Figure 6As shown, the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, a memory 54, and at least one communication bus 52. The communication bus 52 is used to realize the connection and communication between these components. The communication interface 53 may include a display screen (Display), a keyboard (Keyboard), and the optional communication interface 53 may also include a standard wired interface and a wireless interface. The memory 54 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 54 may optionally be at least one storage device located away from the aforementioned processor 51. The processor 51 may be combined with Figure 5 In the described apparatus, the memory 54 stores an application program, and the processor 51 calls the program code stored in the memory 54 to execute any of the above method steps.
[0134] The communication bus 52 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus 52 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0135] Among them, the memory 54 may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM); the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory), hard disk drive (English: hard disk drive, abbreviated: HDD) or solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 54 may also include a combination of the above types of memory.
[0136] The processor 51 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP.
[0137] The processor 51 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0138] Optionally, the memory 54 is further configured to store program instructions. The processor 51 may call the program instructions to implement the bolt calibration method as shown in any embodiment of the present application.
[0139] An embodiment of the present invention further provides a non-transitory computer storage medium storing computer-executable instructions capable of executing the bolt calibration method of any of the above-described method embodiments. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); the storage medium may also include a combination of the above-described types of memory.
[0140] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A bolt calibration method, characterized in that: include: Obtain the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun; Based on a preset search range, obtaining virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range; Determining target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each of the calibration points; Determining target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each of the calibration points includes: Calculating the difference between the virtual pixel coordinates of each calibration point and the corresponding actual pixel coordinates under each set of virtual camera parameters; When all the differences meet a preset condition, optimal virtual camera parameters are determined, and target camera parameters of the target camera are determined based on the optimal virtual camera parameters.
2. The method according to claim 1, characterized in that The step of obtaining, based on a preset search range, virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each virtual camera parameter within the preset search range includes: Get the current search step size and the initial virtual camera parameters of the virtual camera; Determining the preset search range based on the current search step size and the initial virtual camera parameters; Determining multiple sets of virtual camera parameters within the preset search range; The virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters are obtained.
3. The method according to claim 2, characterized in that When each of the differences satisfies a preset condition, determining an optimal virtual camera parameter and determining a target camera parameter of the target camera based on the optimal virtual camera parameter comprises: Determining whether the current search step size reaches the search accuracy; When the current search step does not reach the search accuracy, updating the initial virtual camera parameters of the virtual camera based on the optimal virtual camera parameters; Reducing the current search step size to obtain an updated search step size; Determining an updated search range based on the updated initial virtual camera parameters and the updated search step size; Acquire multiple sets of virtual camera parameters from the updated search range according to the updated search step size to re-determine the target camera parameters.
4. The method according to claim 3, characterized in that When each of the differences satisfies a preset condition, determining an optimal virtual camera parameter and determining a target camera parameter of the target camera based on the optimal virtual camera parameter further includes: When the search step reaches the search accuracy, the optimal virtual camera parameters are determined as the target camera parameters.
5. The method according to claim 1, wherein Determining target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each of the calibration points includes: Obtaining fixed camera parameters of the virtual camera and camera parameters determined based on the difference between the virtual pixel coordinates corresponding to each of the calibration points and the actual pixel coordinates; The target camera parameters are determined based on the camera parameters and the fixed camera parameters.
6. The method according to claim 1, characterized in that The method further comprises: Obtaining the pixel coordinates of each pixel point in the image corresponding to the target gun; Based on the target camera parameters and the pixel coordinates, the actual position coordinates corresponding to each pixel point are determined.
7. A bolt calibration device, characterized in that: include: The first acquisition module is used to obtain the actual pixel coordinates and actual position coordinates of each calibration point in the real scene corresponding to the target gun; A second acquisition module is configured to acquire, based on a preset search range, virtual pixel coordinates corresponding to the actual position coordinates of each calibration point under each set of virtual camera parameters within the preset search range; an adjustment module, configured to determine target camera parameters of the target gun according to differences between the virtual pixel coordinates and the actual pixel coordinates corresponding to each of the calibration points; Determining target camera parameters of the target gun camera according to the difference between the virtual pixel coordinates and the actual pixel coordinates corresponding to each of the calibration points includes: Calculating the difference between the virtual pixel coordinates of each calibration point and the corresponding actual pixel coordinates under each set of virtual camera parameters; When all the differences meet a preset condition, optimal virtual camera parameters are determined, and target camera parameters of the target camera are determined based on the optimal virtual camera parameters.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the gun calibration method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the gun calibration method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Positioning method and system, electronic equipment and computer readable storage medium
CN113393520A