Method and device for determining correction precision of binocular equipment and computer equipment
By acquiring images of the binocular device at different distances and calculating the homography matrix and deviation parameters, the problem of being unable to accurately determine the correction accuracy in the existing technology is solved, and comprehensive correction and accuracy measurement of the binocular device are achieved.
Patent Information
- Application Number
- CN202410742393.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-24
AI Technical Summary
The existing technology cannot comprehensively and accurately determine the correction accuracy of binocular equipment, especially the magnification deviation, center deviation and rotation deviation of the two-channel cameras after correction cannot be directly obtained.
By obtaining the test card images of each camera of the binocular device at different distances, the homography matrix is calculated, the magnification deviation, center deviation and rotation deviation are determined, and the deviation parameters are obtained using the singular value decomposition method and the Euler angle rotation matrix.
It achieves a comprehensive measurement of the correction accuracy of binocular equipment, solves the problem that existing technology cannot accurately determine the correction accuracy, and improves the three-dimensional effect and comfort of the equipment.
Smart Images

Figure CN118691682A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of binocular devices, and in particular to a method, device and computer device for determining the correction accuracy of a binocular device. Background Art
[0002] With the development of technology, binocular devices are gradually being widely used. Before using binocular devices, it is necessary to calibrate the binocular camera and use the calibration results to determine whether the binocular device meets the requirements.
[0003] In the prior art, the correction accuracy of the binocular device is determined mainly by using the first image captured by the first camera of the binocular device and the second image captured by the second camera, and according to the pixel error or reprojection error of the first image and the second image. However, this method cannot directly obtain the magnification deviation, center deviation and rotation deviation of the two cameras after the binocular device is corrected, and therefore, it is impossible to fully and accurately determine the correction accuracy of the binocular device.
[0004] With regard to the problem that the existing technology cannot comprehensively and accurately determine the calibration accuracy of the binocular device, no effective solution has been proposed yet. Summary of the invention
[0005] Based on this, it is necessary to provide a method, device and computer equipment for determining the correction accuracy of a binocular device in order to address the above technical problems.
[0006] In a first aspect, the present application provides a method for determining the correction accuracy of a binocular device. The method comprises the following steps:
[0007] Obtain the left image and the right image of the test card captured by each camera of the binocular device at different distances;
[0008] Determine a magnification deviation of the binocular device based on the acquired left image and the acquired right image;
[0009] Calculating the homography matrix corresponding to the image group captured by each camera of the binocular device; a left image and a right image of the test card captured by each camera of the binocular device at the same distance constitute a group of the image group;
[0010] Based on the homography matrix, two-way center deviation and rotation deviation of the binocular device are determined.
[0011] In one embodiment, determining the magnification deviation of the binocular device based on the acquired left image and the right image comprises the following steps:
[0012] Based on the acquired left image and right image, determine the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image;
[0013] Determine a magnification ratio parameter corresponding to each camera of the binocular device based on the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image; the magnification ratio parameter is a ratio of the focal length of the current camera to the pixel size;
[0014] The magnification deviation of the binocular device is determined based on a magnification ratio parameter corresponding to each camera of the binocular device.
[0015] In one of the embodiments, determining the magnification ratio parameter corresponding to each camera of the binocular device based on the average number of column pixels in the ROI area of the left image and the average number of column pixels in the ROI area of the right image comprises the following steps:
[0016] Determine a plurality of magnification ratio parameters corresponding to different shooting distances for each camera of the binocular device based on the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image;
[0017] An average value of the multiple magnification ratio parameters is used as the magnification ratio parameter corresponding to the current camera of the binocular device.
[0018] In one of the embodiments, the step of calculating the homography matrix corresponding to the image groups captured by each camera of the binocular device comprises the following steps:
[0019] Based on the image groups captured by the cameras of the binocular device, determining the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system;
[0020] Based on the coordinates of the same feature point in the left image and the right image of the same image group, the homography matrix corresponding to the image group captured by each camera of the binocular device is determined.
[0021] In one of the embodiments, determining the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system based on the image group captured by each camera of the binocular device comprises the following steps:
[0022] Based on the image groups captured by the cameras of the binocular device, determining the feature points of the left image and the feature points of the right image of the same image group;
[0023] Based on the feature points of the left image and the feature points of the right image, determine the coordinates of the feature points of the left image and the coordinates of the feature points of the right image, and the correspondence between the feature points of the left image and the feature points of the right image in the same image group;
[0024] Based on the corresponding relationship and the coordinates of the feature points of the left image and the right image, the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system are determined.
[0025] In one of the embodiments, determining the homography matrix corresponding to the image group captured by each camera of the binocular device based on the coordinates of the same feature point in the left image and the right image of the same image group, comprises the following steps:
[0026] Based on the coordinates of the same feature point in the left image and the right image of the same image group, the homography matrix corresponding to the image group captured by each camera of the binocular device is determined by using the least squares method.
[0027] In one embodiment, determining the two-way center deviation and rotation deviation of the binocular device based on the homography matrix comprises the following steps:
[0028] Decomposing the homography matrix by singular value decomposition to obtain a decomposed matrix;
[0029] Based on the decomposed matrix and the definition formula of the homography matrix, the two-way center deviation and the rotation deviation of the binocular device are obtained.
[0030] In one embodiment, obtaining the two-way center deviation and the rotation deviation of the binocular device based on the decomposed matrix and the definition formula of the homography matrix includes the following steps:
[0031] Based on the decomposed matrix, determining a relative rotation matrix and a relative translation vector between two cameras of the binocular device;
[0032] Based on the relative rotation matrix, obtaining the Euler angle rotation matrix formula between the two cameras of the binocular device;
[0033] Based on the Euler angle rotation matrix formula, determining the rotation deviation of the binocular device;
[0034] Based on the relative translation vector, the two-way center deviation of the binocular device is determined.
[0035] In a second aspect, the present application also provides a device for determining the correction accuracy of a binocular device. The device comprises:
[0036] An image acquisition module is used to acquire the left image and the right image of the test card captured by each camera of the binocular device at different distances;
[0037] A first deviation determination module, configured to determine a magnification deviation of the binocular device based on the acquired left image and the acquired right image;
[0038] A matrix determination module, used for calculating the homography matrix corresponding to the image group captured by each camera of the binocular device; a left image and a right image of the test card captured by each camera of the binocular device at the same distance constitute a group of the image group;
[0039] And a second deviation determination module is used to determine the two-way center deviation and rotation deviation of the binocular device based on the homography matrix.
[0040] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for determining the correction accuracy of the binocular device described in the first aspect is implemented.
[0041] The above-mentioned method, device and computer device for determining the correction accuracy of the binocular device obtain the left image and the right image of the test card captured by each camera of the binocular device at different distances, and determine the magnification deviation of the binocular device based on the acquired left image and right image, and then calculate the homography matrix corresponding to the image group captured by each camera of the binocular device, and then determine the two-way center deviation and rotation deviation of the binocular device based on the homography matrix. It obtains the magnification deviation of the binocular device, as well as the two-way center deviation and rotation deviation, and uses the acquisition of multiple deviation parameters to achieve a comprehensive measurement of the correction accuracy of the binocular device, solving the problem that the existing technology cannot comprehensively and accurately determine the correction accuracy of the binocular device.
[0042] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0044] Figure 1A hardware structure block diagram of a terminal of a method for determining the correction accuracy of a binocular device provided in an embodiment of the present application;
[0045] Figure 2 A flowchart of a method for determining the calibration accuracy of a binocular device provided in one embodiment of the present application;
[0046] Figure 3 A flowchart of a method for determining the calibration accuracy of a binocular device provided in a preferred embodiment of the present application;
[0047] Figure 4 A structural block diagram of a device for determining the correction accuracy of a binocular device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0049] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not represent quantitative restrictions, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. Usually, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0050] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 is a hardware structure block diagram of a terminal of the method for determining the correction accuracy of a binocular device of this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 and memory 104 for storing data, wherein processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0051] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for determining the correction accuracy of the binocular device in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0052] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by the communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.
[0053] In this embodiment, a method for determining the calibration accuracy of a binocular device is provided. Figure 2 is a flow chart of the method for determining the correction accuracy of the binocular device of this embodiment. Figure 2 As shown, the process includes the following steps:
[0054] Step S210, obtaining the left image and the right image of the test card captured by each camera of the binocular device at different distances.
[0055] The binocular device may be a binocular imaging device, for example, a binocular endoscope or a binocular microscope. The binocular device includes two left and right cameras, each camera includes a lens, specifically a left lens and a right lens. The test card may be a test card with a fixed shape area with known parameters in the middle under a certain color background. For example, the test card may be a white paper with a square area with known side length in the middle under a white background. The fixed shape area may be set as a checkerboard or other calibration plate with obvious corner point features. It should be noted that in order to ensure that the image captured by the test card has enough feature points, it is necessary to ensure that the corner points in the test card reach a preset number of corner points. The preset number of corner points may be set according to the specific situation. For example, the number of corner points in the test card is greater than or equal to 4. The above-mentioned acquisition of the left image and the right image of the test card captured by each camera of the binocular device at different distances can be performed by adjusting the distance between the lens of the camera and the test card under the premise of keeping the optical path of each camera perpendicular to the test card, so as to acquire multiple left images and multiple right images of the test card captured at different distances. It should be noted that the acquisition of the left image and the right image is acquired in the form of an image group, and each image group is a left image and a right image of the test card captured by each camera of the binocular device at the same distance and at the same time. The above-mentioned same distance refers to the distance between the small hole of the left camera and the test card, which is equal to the distance between the small hole of the right camera and the test card. The small hole of the left camera can be the position where the small hole of the left camera is located. The small hole of the right camera can be the position where the small hole of the right camera is located. This step is to obtain the left image and the right image of the test card captured by each camera of the binocular device at different distances, so as to determine the magnification deviation of the binocular device according to the acquired left image and right image.
[0056] Step S220: determining a magnification deviation of the binocular device based on the acquired left image and right image.
[0057] In this step, the magnification deviation of the binocular device may be the magnification deviation between the left camera and the right camera of the binocular device, that is, the deviation between the magnification of the left camera and the magnification of the right camera. When the magnification deviation of the binocular device is larger, it means that the size deviation of the left image and the right image of the same object captured is larger, and the three-dimensional effect of the object captured by the binocular device is worse. When the magnification deviation of the binocular device is smaller, it means that the size deviation of the left image and the right image of the same object captured is smaller, and the three-dimensional effect of the object captured by the binocular device is better. The above determination of the magnification deviation of the binocular device may be to first obtain the magnification ratio parameters of each camera of the binocular device, and then determine the magnification deviation of the binocular device according to the magnification ratio parameters of each camera of the binocular device. By obtaining the magnification deviation of the binocular device, it realizes the determination of the correction accuracy of the binocular device through the magnification deviation.
[0058] Step S230, calculating the homography matrix corresponding to the image group captured by each camera of the binocular device; a left image and a right image of the test card captured by each camera of the binocular device at the same distance are a group of images.
[0059] The above homography matrix can be a two-dimensional homogeneous coordinate constraining points in the same three-dimensional space on two pixel planes, or a transformation matrix between two points in different planes, and can specifically include the intrinsic parameters and extrinsic parameters of the camera of the binocular device. The above calculation of the homography matrix corresponding to the image group captured by each camera of the binocular device can be based on the image group captured by each camera of the binocular device, determining the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system, and then, based on the coordinates of the same feature point in the left image and the right image of the same image group, using a preset correspondence formula, determining the homography matrix corresponding to the image group captured by each camera of the binocular device.
[0060] Among them, the preset corresponding relationship formula is:
[0061]
[0062] Where (x, y) is the coordinate of the feature point on the left image of the same image group, and (x′, y′) is the coordinate of the same feature point on the right image of the same image group. ab represents each element of the homography matrix, where a represents the ath row of the homography matrix and b represents the bth column of the homography matrix. For example, h 11 Represents the first row and first column of the homography matrix.
[0063] Step S240: determining the two-way center deviation and rotation deviation of the binocular device based on the homography matrix.
[0064] The two-way center deviation may be the baseline distance deviation and vertical deviation between the left image and the right image obtained by the two cameras of the binocular device shooting the same target image, and the rotation deviation may be the rotation deviation between the left image and the right image obtained by the two cameras of the binocular device shooting the same target image, which may be expressed by Euler angles. The horizontal deviation may be a parameter of lens design. The horizontal deviation may be combined with other parameters to affect the comfort of the binocular device. The vertical deviation may be a vertical parallax, which affects the three-dimensional effect of the image shot by the binocular device. The larger the vertical parallax, the worse the three-dimensional effect of the image shot by the binocular device; the smaller the vertical parallax, the better the three-dimensional effect of the image shot by the binocular device. The rotation deviation may be the relative rotation angle between the left image and the right image of the image group shot by the camera of the binocular device. The larger the rotation deviation, the worse the effect of the image shot by the binocular device; the smaller the rotation deviation, the better the effect of the image shot by the binocular device. This step determines the two-way center deviation and rotation deviation of the binocular device, thereby achieving a comprehensive measurement of the correction accuracy of the binocular device through multiple deviation parameters, thereby solving the problem that the prior art cannot comprehensively and accurately determine the correction accuracy of the binocular device.
[0065] In the above steps S210 to S240, the left image and the right image of the test card captured by each camera of the binocular device at different distances are obtained, and the magnification deviation of the binocular device is determined according to the obtained left image and right image, and then the homography matrix corresponding to the image group captured by each camera of the binocular device is calculated, and then the two-way center deviation and rotation deviation of the binocular device are determined based on the homography matrix corresponding to the image group captured by each camera. It achieves a comprehensive measurement of the correction accuracy of the binocular device by obtaining the magnification deviation of the binocular device, the two-way center deviation and the rotation deviation, and using the acquisition of multiple deviation parameters, and solves the problem that the prior art cannot comprehensively and accurately determine the correction accuracy of the binocular device.
[0066] In one embodiment, step S220, determining the magnification deviation of the binocular device based on the acquired left image and right image, includes the following steps:
[0067] Step S222: Based on the acquired left image and right image, determine the average number of column pixels in the ROI area of the left image and the average number of column pixels in the ROI area of the right image.
[0068] The mean value of the number of column pixels in the ROI (Region of Interest) area of the left image may be the mean value of the number of pixels in each column of the ROI area of the left image. Specifically, because the ROI area of the captured left image is a rectangular image, when the test card is well placed, the number of pixels in each column of the ROI area of the left image is the same, that is, the number of column pixels in the ROI area of the left image may be used as the number of pixels in each column; when the test card is skewed, the number of ROI areas in some columns will be small, and these columns should be removed and the average value should be taken in the final statistics. The mean value of the number of column pixels in the ROI area of the right image may be the mean value of the number of pixels in each column of the ROI area of the right image. Specifically, because the ROI area of the captured right image is a rectangular image, when the test card is well placed, the number of pixels in each column of the ROI area of the right image is the same. That is, the number of column pixels in the ROI area in the right image can be used as the number of pixels in each column; when the test card is placed crookedly, the number of ROI areas in some columns will be smaller. In the final statistics, these columns should be removed and the average should be taken.
[0069] Step S224, based on the average number of column pixels in the ROI area of the left image and the average number of column pixels in the ROI area of the right image, determine the magnification ratio parameter corresponding to each camera of the binocular device; the magnification ratio parameter is the ratio of the focal length of the current camera to the pixel size.
[0070] In this step, the above-mentioned magnification ratio parameter corresponding to each camera of the binocular device is determined based on the mean number of column pixels of the ROI area of the left image and the mean number of column pixels of the ROI area of the right image. It can be based on the mean number of column pixels of the ROI area of the left image to determine the magnification ratio parameter corresponding to the left camera of the binocular device, and based on the mean number of column pixels of the ROI area of the right image to determine the magnification ratio parameter corresponding to the right camera of the binocular device. The above-mentioned magnification ratio parameter is the ratio of the focal length of the current camera to the pixel size, which is used to represent a parameter related to the magnification of the current camera. In this embodiment, by solving a magnification ratio parameter, the magnification ratio parameter of the current camera can be determined without calculating the specific camera focal length and pixel size, and then the magnification deviation of the binocular device is calculated through the magnification ratio parameters of each camera. The calculation of the magnification deviation of the binocular device can be realized without calculating the specific camera focal length and pixel size.
[0071] Specifically, the above-mentioned determination of the magnification ratio parameter corresponding to the left camera of the binocular device based on the mean value of the number of column pixels in the ROI area of the left image can be performed by first determining the mean value of the number of column pixels in multiple ROI areas corresponding to multiple left images of the test card captured by the left camera of the binocular device at different distances, calculating the magnification ratio parameters at different distances, and determining the average value of the magnification ratio parameters of the left camera at different distances as the magnification ratio parameter corresponding to the left camera of the binocular device.
[0072] In addition, the above-mentioned determination of the magnification ratio parameter corresponding to the right camera of the binocular device based on the mean value of the number of column pixels in the ROI area of the right image can be that the mean value of the number of column pixels in multiple ROI areas corresponding to multiple right images of the test card captured by the right camera of the binocular device at different distances is first determined, the magnification ratio parameters at different distances are calculated, and the average value of the magnification ratio parameters of the right camera at different distances is determined as the magnification ratio parameter corresponding to the right camera of the binocular device.
[0073] Step S226, determining the magnification deviation of the binocular device based on the magnification ratio parameter corresponding to each camera of the binocular device.
[0074] The calculation process of the magnification deviation L1 of the above binocular device can be expressed as follows:
[0075]
[0076] Among them, A is the magnification ratio parameter corresponding to the left camera, and B is the magnification ratio parameter corresponding to the right camera.
[0077] In the above steps S222 to S226, the mean number of column pixels in the ROI area of the left image and the mean number of column pixels in the ROI area of the right image are determined by the acquired left image and right image, and the magnification ratio parameter corresponding to each camera of the binocular device is determined according to the mean number of column pixels in the ROI area of the left image and the mean number of column pixels in the ROI area of the right image, and finally the magnification ratio deviation of the binocular device is determined according to the magnification ratio parameter corresponding to each camera of the binocular device. By acquiring the magnification ratio deviation of the binocular device, the correction accuracy of the binocular device is determined by the magnification ratio deviation.
[0078] In addition, in one embodiment, step S224, based on the average number of column pixels in the ROI area of the left image and the average number of column pixels in the ROI area of the right image, determines the magnification ratio parameter corresponding to each camera of the binocular device, including the following steps:
[0079] Step S2242: determining a plurality of magnification ratio parameters corresponding to different shooting distances of each camera of the binocular device based on the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image.
[0080] In this step, the above-mentioned method of determining multiple magnification ratio parameters corresponding to different shooting distances of each camera of the binocular device based on the mean number of column pixels in the ROI area of the left image and the mean number of column pixels in the ROI area of the right image can be based on the mean number of column pixels in the ROI area of the left image, determining multiple magnification ratio parameters corresponding to different shooting distances of the left camera of the binocular device, and based on the mean number of column pixels in the ROI area of the right image, determining multiple magnification ratio parameters corresponding to different shooting distances of the right camera of the binocular device.
[0081] Specifically, the above-mentioned determination of multiple magnification ratio parameters corresponding to different shooting distances of the left camera of the binocular device based on the mean number of column pixels of the ROI area of the left image can be performed by first determining the mean number of column pixels of multiple ROI areas corresponding to multiple left images of the test card captured by the left camera of the binocular device at different distances, and calculating the magnification ratio parameters at different shooting distances.
[0082] The calculation formula for calculating the magnification ratio parameter corresponding to the left camera at the current distance is as follows:
[0083]
[0084] That is, the magnification parameter A corresponding to the left camera at the current distance can be expressed as:
[0085]
[0086] Where a is the side length of the ROI area on the test card, l m is the current distance between the pinhole of the left camera and the test card, is the mean number of column pixels in the ROI area of the left image captured by the left camera at the current distance, f l is the focal length of the left camera, is the pixel size.
[0087] In addition, the above-mentioned determination of multiple magnification ratio parameters corresponding to different shooting distances of the right camera of the binocular device based on the mean number of column pixels of the ROI area of the right image can be performed by first determining the mean number of column pixels of multiple ROI areas corresponding to multiple right images of the test card captured by the right camera of the binocular device at different distances, and calculating the magnification ratio parameters at different distances.
[0088] The calculation formula for calculating the magnification ratio parameter corresponding to the right camera at the current distance is as follows:
[0089]
[0090] That is, the magnification parameter B corresponding to the right camera at the current distance can be expressed as:
[0091]
[0092] Where a is the side length of the ROI area on the test card, r m is the current distance between the pinhole of the right camera and the test card, is the mean number of column pixels in the ROI area of the right image captured by the right camera at the current distance, f r is the focal length of the right camera, is the pixel size.
[0093] Step S2244: taking the average value of the multiple magnification ratio parameters of the current camera as the magnification ratio parameter corresponding to the current camera of the binocular device.
[0094] In this step, the average value of multiple magnification ratio parameters of the left camera at multiple distances can be determined as the magnification ratio parameter corresponding to the left camera of the binocular device; the average value of multiple magnification ratio parameters of the right camera at multiple distances can be determined as the magnification ratio parameter corresponding to the right camera of the binocular device.
[0095] In the above steps S2242 to S2244, multiple magnification ratio parameters corresponding to different shooting distances of each camera of the binocular device are determined through the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image, and then the magnification ratio parameters corresponding to each camera are determined. By determining the magnification ratio parameters corresponding to each camera, the subsequent calculation of the magnification deviation of the binocular device is facilitated.
[0096] In one embodiment, step S230, calculating the homography matrix corresponding to the image group captured by each camera of the binocular device, includes the following steps:
[0097] Step S232, based on the image groups captured by the cameras of the binocular device, determine the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system.
[0098] The above-mentioned same coordinate system can be a coordinate system based on the coordinate system where the left image is located, or a coordinate system based on the coordinate system where the right image is located, or a coordinate system based on other coordinate systems. It should be noted that the method for obtaining the above-mentioned coordinate system is not specifically limited in this embodiment, as long as it can be ensured that the left image and the right image are in the same coordinate system by adjusting the left image and / or the right image. The above-mentioned determination of the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system can be first determining all the feature points of the left image and all the feature points of the right image of the same image group in the same coordinate system, and then determining the coordinates of all the feature points of the left image and the coordinates of all the feature points of the right image, as well as the correspondence between all the feature points of the left image and all the feature points of the right image, and using the coordinates of the feature points of the left image and the coordinates of the feature points of the right image that have a corresponding relationship as the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system.
[0099] Step S234, based on the coordinates of the same feature point in the left image and the right image of the same image group, determine the homography matrix corresponding to the image group captured by each camera of the binocular device.
[0100] Specifically, based on the coordinates of the same feature point in the left image and the right image of the same image group, the homography matrix corresponding to the image group captured by each camera of the binocular device can be determined using the least squares method.
[0101] Because there are multiple corresponding feature points in the left image and the right image in the same image group, multiple identical feature points will be determined for each image group, and multiple homography matrices can be obtained based on multiple identical feature points. Therefore, the least squares method can be used to determine the homography matrix corresponding to the same feature point with the smallest error as the homography matrix corresponding to the image group captured by each camera of the binocular device. The above error can be the reprojection error corresponding to the homography matrix corresponding to the same feature point in the image coordinate mapping. The above reprojection error can be the Euclidean distance between the two coordinate positions of the same feature point projected to the same plane in the left image and the right image of the same image group. For example, the coordinate system where the right image is located is used as the reference coordinate system, Xi1 is the coordinate of the feature point in the right image, Xi′ is the coordinate of the same feature point in the left image after the coordinate Xi2 is mapped in the right image, and the Euclidean distance between Xi1 and Xi′ is the reprojection error of Xi1 and Xi2. It should be noted that in order to improve the accuracy of the homography matrix, multiple groups of images can be obtained to determine the multiple homography matrices corresponding to the multiple groups of images, and the homography matrix with the smallest error can be determined as the homography matrix corresponding to the image groups captured by each camera of the binocular device.
[0102] In the above steps S232 to S234, the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system are determined through the image groups captured by the cameras of the binocular device, and then the coordinates of the same feature point in the left image and the right image of the same image group are used to determine the homography matrix corresponding to the image groups captured by the cameras of the binocular device. By determining the homography matrix corresponding to the image groups captured by the cameras, it is convenient to determine the two-way center deviation and rotation deviation of the binocular device according to the homography matrix.
[0103] Further, in one embodiment, step S232, based on the image groups captured by the cameras of the binocular device, determines the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system, including the following steps:
[0104] Step S2322: Based on the image groups captured by the cameras of the binocular device, feature points of the left image and feature points of the right image of the same image group are determined.
[0105] The above method of determining the feature points of the image may be to use a feature point detection algorithm such as the SIFT (Scale Invariant Feature Transform) algorithm or the Harris algorithm, or other feature point detection algorithms, as long as the feature points of the left image and the right image can be determined. This embodiment does not specifically limit the method for obtaining the feature points of the image.
[0106] Step S2324, based on the feature points of the left image and the feature points of the right image, determine the coordinates of the feature points of the left image and the coordinates of the feature points of the right image, as well as the correspondence between the feature points of the left image and the feature points of the right image in the same image group.
[0107] Step S2326, based on the correspondence relationship and the coordinates of the feature points of the left image and the coordinates of the feature points of the right image, determine the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system.
[0108] In the above steps S2322 to S2326, based on the image groups captured by the cameras of the binocular device, the feature points of the left image and the feature points of the right image of the same image group are determined, and then the coordinates of the feature points of the left image and the coordinates of the feature points of the right image, as well as the correspondence between the feature points of the left image and the feature points of the right image in the same image group are determined. Finally, based on the correspondence and the coordinates of the feature points of the left image and the coordinates of the feature points of the right image, the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system are determined. This facilitates determining the homography matrix corresponding to the image groups captured by the cameras of the binocular device according to the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system.
[0109] In one embodiment, step S240, based on the homography matrix, determining the two-way center deviation and rotation deviation of the binocular device includes the following steps:
[0110] Step S242, using the singular value decomposition method, decompose the homography matrix to obtain a decomposed matrix.
[0111] In this step, the singular value decomposition method can be used to decompose the homography matrix into three matrices. The specific decomposition process is as follows:
[0112] H=USV T
[0113] Among them, H is the homography matrix, U represents the new standard orthogonal basis after the homography matrix transformation; S represents the proportional (scaling) relationship between the vector in U and the corresponding vector in V, and V represents the standard orthogonal basis of the original domain.
[0114] Step S244, based on the decomposed matrix and the definition formula of the homography matrix, obtain the two-way center deviation and rotation deviation of the binocular device.
[0115] The definition formula of the above homography matrix is:
[0116]
[0117] Among them, K2 is the intrinsic parameter of the right camera of the binocular device, K1 is the intrinsic parameter of the left camera of the binocular device, R is the relative rotation matrix of the left and right cameras of the binocular device in the same coordinate system, t is the relative translation vector of the left and right cameras of the binocular device in the same coordinate system, d is the distance from the camera pinhole of the binocular device to the test card, is the normal vector of the plane where the test card is located.
[0118] Among them, the calculation method of the intrinsic parameters of the left camera of the binocular device is as follows:
[0119]
[0120] Among them, (u 01 , v 01 ) are the coordinates of the center point of the left image.
[0121] The calculation method of the intrinsic parameters of the right camera of the binocular device is as follows:
[0122]
[0123] (u 02 , v 02 ) are the coordinates of the center point of the right image.
[0124] Based on the definition formula of the homography matrix, it can be seen that when the intrinsic parameters of the right camera of the binocular device and the intrinsic parameters of the left camera of the binocular device are known, the homography matrix only has external parameters and parameters related to the test card. Among them, the distance d from the camera of the binocular device to the test card is the distance r from the small hole of the right camera to the test card m The distance from the small hole of the left camera to the test card is l m , because the optical path of the binocular device is perpendicular to the test card, the distance from the pinhole of the right camera to the test card is equal to the distance from the pinhole of the left camera to the test card when the same image group is acquired. Therefore, the center deviation and rotation deviation of the binocular device can be obtained by calculating the relative rotation matrix and relative translation vector between the two cameras of the binocular device.
[0125] Further, in one embodiment, step S244, based on the decomposed matrix and the definition formula of the homography matrix, obtaining the two-way center deviation and rotation deviation of the binocular device includes the following steps:
[0126] Step S2442: Determine the relative rotation matrix and relative translation vector between the two cameras of the binocular device based on the decomposed matrix.
[0127] Based on the decomposed matrix, the relative rotation matrix R between the two cameras of the binocular device is solved as follows:
[0128] R=UV T
[0129] Based on the decomposed matrix, the relative translation vector t between the two cameras of the binocular device is solved as:
[0130]
[0131] Among them, N is the last column of the diagonal matrix S. The relative translation vector t between the two cameras of the binocular device includes three parameters: baseline distance deviation, vertical deviation and depth direction deviation.
[0132] Step S2444: Based on the relative rotation matrix, obtain the Euler angle rotation matrix formula between the two cameras of the binocular device.
[0133] The specific process is as follows:
[0134] If the relative rotation matrix R is:
[0135]
[0136] Among them, r ab Represents the elements of the relative rotation matrix, where a represents the ath row of the relative rotation matrix and b represents the bth column of the relative rotation matrix. For example, r 11 Represents the first row and first column of the relative rotation matrix.
[0137] The Euler angle deviations of the relative rotation matrix in the x-axis, y-axis, and z-axis directions can be expressed as:
[0138]
[0139] in, is the relative rotation deviation of the binocular device in the X-axis direction, θ is the relative rotation deviation of the binocular device in the Y-axis direction, It is the relative rotation deviation of the binocular device in the Z-axis direction. The unit of rotation deviation is angle.
[0140] Based on the Euler angle deviations in each direction of the relative rotation matrix, the formula for the Euler angle rotation matrix between the two cameras of the binocular device is:
[0141]
[0142] Step S2446, determining the rotation deviation of the binocular device based on the Euler angle rotation matrix formula.
[0143] By solving the Euler angle rotation matrix formula, we can get the rotation deviation of the binocular device. The solution is as follows:
[0144]
[0145] Step S2448, determining the two-way center deviation of the binocular device based on the relative translation vector.
[0146] The two-way center deviation of the above-mentioned binocular device may include a baseline distance deviation and a vertical deviation between the two cameras of the binocular device.
[0147] In the above steps S2442 to S2448, the relative rotation matrix and relative translation vector between the two cameras of the binocular device are determined through the decomposed matrix, and the Euler angle rotation matrix formula between the two cameras of the binocular device is obtained based on the relative rotation matrix, and then the rotation deviation of the binocular device is determined based on the Euler angle rotation matrix formula, and then the two-way center deviation of the binocular device is determined based on the relative translation vector. By obtaining the two-way center deviation and rotation deviation of the binocular device and using the acquisition of multiple deviation parameters, a comprehensive measurement of the correction accuracy of the binocular device is achieved, which solves the problem that the prior art cannot comprehensively and accurately determine the correction accuracy of the binocular device.
[0148] The present embodiment is described and illustrated below through preferred embodiments.
[0149] Figure 3 : is a flow chart of a method for determining the calibration accuracy of a binocular device provided by a preferred embodiment of the present application. Figure 3 As shown, the method for determining the correction accuracy of the binocular device includes the following steps:
[0150] Step S301, obtaining a left image and a right image of a test card captured by each camera of a binocular device at different distances;
[0151] Step S302, based on the acquired left image and right image, determining the mean number of column pixels in the ROI area of the left image and the mean number of column pixels in the ROI area of the right image;
[0152] Step S303, determining a magnification ratio parameter corresponding to each camera of the binocular device based on the average number of column pixels in the ROI area of the left image and the average number of column pixels in the ROI area of the right image;
[0153] Step S304, determining a magnification deviation of the binocular device based on a magnification ratio parameter corresponding to each camera of the binocular device;
[0154] Step S305, calculating the homography matrix corresponding to the image group captured by each camera of the binocular device;
[0155] Step S306, using singular value decomposition method to decompose the homography matrix to obtain a decomposed matrix;
[0156] Step S307, determining the relative rotation matrix and relative translation vector between the two cameras of the binocular device based on the decomposed matrix;
[0157] Step S308, obtaining the Euler angle rotation matrix formula between the two cameras of the binocular device based on the relative rotation matrix;
[0158] Step S309, determining the rotation deviation of the binocular device based on the Euler angle rotation matrix formula;
[0159] Step S310: determining the two-way center deviation of the binocular device based on the relative translation vector.
[0160] In the above steps S301 to S310, the left image and the right image of the test card captured by each camera of the binocular device at different distances are obtained, and the magnification deviation of the binocular device is determined according to the obtained left image and right image, and then the homography matrix corresponding to the image group captured by each camera of the binocular device is calculated, and then the two-way center deviation and the rotation deviation of the binocular device are determined based on the homography matrix. By obtaining the magnification deviation of the binocular device, the two-way center deviation and the rotation deviation, and using the acquisition of multiple deviation parameters, a comprehensive measurement of the correction accuracy of the binocular device is achieved, which solves the problem that the prior art cannot comprehensively and accurately determine the correction accuracy of the binocular device.
[0161] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0162] Based on the same inventive concept, a device for determining the correction accuracy of a binocular device is also provided in this embodiment, and the device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. The terms "module", "unit", "subunit", etc. used below can implement a combination of software and / or hardware for predetermined functions. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0163] In one embodiment, Figure 4 is a structural block diagram of a device for determining the correction accuracy of a binocular device provided in an embodiment of the present application, such as Figure 4 As shown, the correction accuracy determination device of the binocular device includes:
[0164] An image acquisition module 42 is used to acquire a left image and a right image of the test card captured by each camera of the binocular device at different distances;
[0165] A first deviation determination module 44 is used to determine the magnification deviation of the binocular device based on the acquired left image and right image;
[0166] The matrix determination module 46 is used to calculate the homography matrix corresponding to the image group captured by each camera of the binocular device; a left image and a right image of the test card captured by each camera of the binocular device at the same distance are a group of images;
[0167] And a second deviation determination module 48 is used to determine the two-way center deviation and rotation deviation of the binocular device based on the homography matrix.
[0168] The above-mentioned device for determining the calibration accuracy of the binocular device obtains the left image and the right image of the test card captured by each camera of the binocular device at different distances, and determines the magnification deviation of the binocular device based on the acquired left image and right image, and then calculates the homography matrix corresponding to the image group captured by each camera of the binocular device, and then determines the two-way center deviation and rotation deviation of the binocular device based on the homography matrix. It obtains the magnification deviation of the binocular device, as well as the two-way center deviation and rotation deviation, and uses the acquisition of multiple deviation parameters to achieve a comprehensive measurement of the calibration accuracy of the binocular device, solving the problem that the prior art cannot comprehensively and accurately determine the calibration accuracy of the binocular device.
[0169] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0170] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, any one of the methods for determining the correction accuracy of a binocular device in the above embodiments is implemented.
[0171] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0172] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0173] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0174] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for determining the calibration accuracy of a binocular device, characterized in that: The method comprises: Obtain the left image and the right image of the test card captured by each camera of the binocular device at different distances; Determine a magnification deviation of the binocular device based on the acquired left image and the acquired right image; Calculating the homography matrix corresponding to the image group captured by each camera of the binocular device; a left image and a right image of the test card captured by each camera of the binocular device at the same distance constitute a group of the image group; Based on the homography matrix, two-way center deviation and rotation deviation of the binocular device are determined.
2. The method for determining the correction accuracy of a binocular device according to claim 1, characterized in that: The determining the magnification deviation of the binocular device based on the acquired left image and the right image includes: Based on the acquired left image and right image, determine the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image; Determine a magnification ratio parameter corresponding to each camera of the binocular device based on the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image; the magnification ratio parameter is a ratio of the focal length of the current camera to the pixel size; The magnification deviation of the binocular device is determined based on a magnification ratio parameter corresponding to each camera of the binocular device.
3. The method for determining the correction accuracy of a binocular device according to claim 2, characterized in that: The determining the magnification ratio parameter corresponding to each camera of the binocular device based on the average number of column pixels in the ROI area of the left image and the average number of column pixels in the ROI area of the right image includes: Determine a plurality of magnification ratio parameters corresponding to different shooting distances for each camera of the binocular device based on the mean value of the number of column pixels in the ROI area of the left image and the mean value of the number of column pixels in the ROI area of the right image; An average value of the multiple magnification ratio parameters is used as the magnification ratio parameter corresponding to the current camera of the binocular device.
4. The method for determining the calibration accuracy of a binocular device according to claim 1, characterized in that: The calculating the homography matrix corresponding to the image group captured by each camera of the binocular device includes: Based on the image groups captured by the cameras of the binocular device, determining the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system; Based on the coordinates of the same feature point in the left image and the right image of the same image group, the homography matrix corresponding to the image group captured by each camera of the binocular device is determined.
5. The method for determining the calibration accuracy of a binocular device according to claim 4, characterized in that: The determining, based on the image groups captured by the cameras of the binocular device, coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system, comprises: Determine, based on the image groups captured by the cameras of the binocular device, feature points of the left image and feature points of the right image of the same image group; Based on the feature points of the left image and the feature points of the right image, determine the coordinates of the feature points of the left image and the coordinates of the feature points of the right image, and the correspondence between the feature points of the left image and the feature points of the right image in the same image group; Based on the corresponding relationship and the coordinates of the feature points of the left image and the right image, the coordinates of the same feature point in the left image and the right image of the same image group in the same coordinate system are determined.
6. The method for determining the calibration accuracy of a binocular device according to claim 4, characterized in that: The determining, based on the coordinates of the same feature point in the left image and the right image of the same image group, the homography matrix corresponding to the image group captured by each camera of the binocular device comprises: Based on the coordinates of the same feature point in the left image and the right image of the same image group, the homography matrix corresponding to the image group captured by each camera of the binocular device is determined by using the least squares method.
7. The method for determining the calibration accuracy of a binocular device according to claim 1, characterized in that: The determining of the two-way center deviation and the rotation deviation of the binocular device based on the homography matrix includes: Decomposing the homography matrix by singular value decomposition to obtain a decomposed matrix; Based on the decomposed matrix and the definition formula of the homography matrix, the two-way center deviation and the rotation deviation of the binocular device are obtained.
8. The method for determining the calibration accuracy of a binocular device according to claim 7, characterized in that: The step of obtaining the two-way center deviation and the rotation deviation of the binocular device based on the decomposed matrix and the definition formula of the homography matrix includes: Based on the decomposed matrix, determining a relative rotation matrix and a relative translation vector between two cameras of the binocular device; Based on the relative rotation matrix, obtaining the Euler angle rotation matrix formula between the two cameras of the binocular device; Based on the Euler angle rotation matrix formula, determining the rotation deviation of the binocular device; Based on the relative translation vector, the two-way center deviation of the binocular device is determined.
9. A device for determining the calibration accuracy of a binocular device, characterized in that: The device comprises: An image acquisition module is used to acquire the left image and the right image of the test card captured by each camera of the binocular device at different distances; A first deviation determination module, configured to determine a magnification deviation of the binocular device based on the acquired left image and the acquired right image; A matrix determination module is used to calculate the homography matrix corresponding to the image group captured by each camera of the binocular device; a left image and a right image of the test card captured by each camera of the binocular device at the same distance constitute a group of the image group; And a second deviation determination module is used to determine the two-way center deviation and rotation deviation of the binocular device based on the homography matrix.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method for determining the correction accuracy of the binocular device according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Binocular equipment correction method and device and computer equipment
CN119941587A
