A large-angle binocular camera polar correction method and system for ophthalmic devices
Patent Information
- Application Number
- CN202611171294.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-04
- Publication Date
- 2026-10-23
AI Technical Summary
[0008]针对现有技术中所存在的问题,本发明提供了一种用于眼科设备的大夹角双目相机极线校正方法及系统,以解决现有技术中双目相机的极线校正存在图像偏移,匹配质量差,且极易破坏极线对齐的技术问题
[0044]1、通过四角点投影得到外接矩形,能在不迭代情况下快速估计“跑出画布”的偏移量,解决有效区域偏移严重的问题。
Smart Images

Figure CN122966743A_ABST
Abstract
Description
Technical Field
[0002] This invention relates to the field of ophthalmic optical measurement, and more specifically to a method and system for polarimeter correction of large-angle binocular cameras used in ophthalmic equipment. Background Technology
[0004] Before refractive testing, ophthalmic equipment (such as optometry equipment) typically requires precise positioning of the subject's pupil to determine the alignment between the measuring optical axis and the visual axis, ensuring the accuracy of the refraction results. In recent years, binocular cameras have been introduced into ophthalmic equipment to locate the pupil, enabling subsequent measurement of the eye's optical parameters. A binocular camera is a hardware module integrating two cameras. By simulating the binocular parallax of the human eye, it simultaneously captures two images from different angles. These images are then processed by computer vision algorithms to achieve functions such as depth perception, 3D reconstruction, object ranging, and tracking. Binocular cameras usually include a left and a right camera. They obtain the parallax by matching two images of the same scene and further calculate depth information. To simplify the matching process, epipolar correction is often used in engineering: transforming the left and right images to the same calibration coordinate system so that points lie on the same epipolar line, thus simplifying the two-dimensional search into a one-dimensional search. When the relative pose angle between binocular cameras is large (such as in strong convergence cameras), existing binocular epipolar correction methods (such as stereoRectify (OpenCV's stereo correction algorithm) based on binocular calibration results and directly generating correction maps) often encounter the following problems:
[0005] The effective area of the corrected image is significantly offset outside the output canvas, and the main content "runs out of the area." In order to maintain the fixed size of the output canvas, obvious stretching, cropping, or black borders are produced, which leads to a decrease in the quality of subsequent parallax matching. When simple translation or cropping is used to remedy the situation, it is easy to destroy the epipolar alignment of the left and right images, resulting in stereo matching failure.
[0006] It is evident that current epipolar correction methods for binocular cameras suffer from image shift, poor matching quality, and are highly prone to disrupting epipolar alignment. Summary of the Invention
[0008] To address the problems existing in the prior art, the present invention provides a method and system for epipolar correction of large-angle binocular cameras for ophthalmic equipment, so as to solve the technical problems of image offset, poor matching quality, and easy destruction of epipolar alignment in the epipolar correction of binocular cameras in the prior art.
[0009] This invention provides a method for epipolar correction of a large-angle binocular camera for ophthalmic equipment, comprising:
[0010] S1. Obtain the intrinsic parameter matrix, distortion parameters, and relative extrinsic parameters of the stereo camera, and obtain the input image size and output canvas size;
[0011] S2. Based on the intrinsic parameter matrix, distortion parameters and relative extrinsic parameters, call the stereo correction algorithm to obtain the correction rotation matrix, initial projection matrix and initial reprojection matrix;
[0012] S3. Construct corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera, respectively;
[0013] S4. Perform perspective transformation on the four corner points of the left and right camera images using the boundary projection matrix to obtain the positions of the four corner points in the corrected coordinate system.
[0014] S5. Based on the four corner points after correction, find the minimum bounding rectangle to obtain the left and right coverage areas of the left and right corrected images in the corrected coordinate system, respectively.
[0015] S6. Calculate the canvas translation amount based on the left and right covered areas to obtain the X-axis offset and Y-axis offset respectively.
[0016] S7. Based on the X-axis offset and the Y-axis offset, the principal point items of the initial projection matrix are translated and corrected;
[0017] S8. Based on the intrinsic parameter matrices, distortion parameters, correction rotation matrices, initial projection matrices after principal point term translation correction, and output canvas size of the left and right cameras, respectively generate distortion correction and epipolar correction mapping tables for the left and right cameras, and remap the left original image and the right original image according to the mapping tables to obtain the epipolar aligned left and right corrected images.
[0018] S9. Update the initial reprojection matrix according to the corrected initial projection matrix.
[0019] Optionally, corresponding boundary projection matrices are constructed based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera system, respectively, including:
[0020] The boundary projection matrix is represented as:
[0021]
[0022] in, Indicates each camera, Represents any of the aforementioned correction rotation matrices The first three columns form a 3×3 matrix. Let be the intrinsic parameter matrix.
[0023] Optionally, the four corner points of the left or right camera image are represented as follows:
[0024]
[0025] W represents the width of the image, and H represents the height of the image.
[0026] Optionally, the translation correction of the principal point terms of the initial projection matrix by the X-axis offset and the Y-axis offset includes:
[0027]
[0028] in, and These are the first and second offsets along the X-axis, respectively. Y-axis offset, Y-axis offset The same applies to both the left and right cameras.
[0029] Optionally, updating the initial reprojection matrix based on the translated principal point terms includes:
[0030] The initial reprojection matrix is represented as:
[0031]
[0032] in B is the baseline parameter, and f is the focal length parameter.
[0033] The present invention also provides a large-angle binocular camera epipolar correction system for ophthalmic equipment, comprising:
[0034] The parameter acquisition module is used to obtain the intrinsic parameter matrix, distortion parameters, and relative extrinsic parameters of the stereo camera, as well as the input image size and output canvas size.
[0035] The parameter correction module calls the stereo correction algorithm based on the intrinsic parameter matrix, distortion parameters and relative extrinsic parameters to obtain the correction rotation matrix, initial projection matrix and initial reprojection matrix;
[0036] The camera projection module constructs corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera, respectively.
[0037] The perspective transformation module is used to perform perspective transformation on the four corner points of the left and right camera images through the boundary projection matrix to obtain the positions of the four corner points in the corrected coordinate system.
[0038] The coverage area module calculates the minimum bounding rectangle based on the four corner points after correction, and obtains the left and right coverage areas of the left and right corrected images in the corrected coordinate system, respectively.
[0039] The translation calculation module calculates the canvas translation based on the left and right coverage areas, and obtains the offset in the X-axis direction and the offset in the Y-axis direction, respectively.
[0040] The translation correction module corrects the principal point items of the initial projection matrix based on the X-axis offset and the Y-axis offset.
[0041] The epipolar correction module generates distortion correction and epipolar correction mapping tables for the left and right cameras based on the intrinsic parameter matrix, distortion parameters, correction rotation matrix, projection matrix after principal point term translation correction, and output canvas size. It then remaps the left original image and the right original image according to the mapping tables to obtain the epipolar-aligned left and right corrected images.
[0042] The projection update module updates the initial reprojection matrix based on the corrected initial projection matrix.
[0043] Compared with the prior art, the present invention:
[0044] 1. By projecting the four corner points to obtain the circumscribed rectangle, the offset of "running out of the canvas" can be quickly estimated without iteration, solving the problem of severe offset of the effective area.
[0045] 2. By performing translation compensation on the principal point, which is equivalent to "moving the canvas center / optical center" in the calibration coordinate system, the effective content can be moved back into the canvas, reducing unnecessary cropping and stretching, and improving texture consistency and matching robustness.
[0046] 3. By constraining the uniform offset in the Y-axis direction, it is ensured that the corresponding points in the left and right correction images are still on the same scan line. This avoids the problem of the epipolar alignment being easily destroyed by the remedial operation. By reconstructing the initial reprojection matrix after modifying the initial projection matrix, it is ensured that the 3D reprojection formula is consistent with the new principal point / baseline. Attached Figure Description
[0048] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0049] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 This is a schematic diagram of the method flow of the present invention. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other implementation cases obtained by those skilled in the art without creative effort are within the scope of protection of this application. Functional units with the same reference numerals in the examples of this invention have the same and similar structures and functions.
[0053] See Figure 1 This invention provides a method for epipolar correction of a large-angle binocular camera for ophthalmic equipment, comprising:
[0054] S1. Obtain the intrinsic parameter matrix, distortion parameters, and relative extrinsic parameters of the stereo camera, and obtain the input image size and output canvas size;
[0055] S2. Based on the intrinsic parameter matrix, distortion parameters and relative extrinsic parameters, call the stereo correction algorithm to obtain the correction rotation matrix, initial projection matrix and initial reprojection matrix;
[0056] S3. Construct corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera, respectively;
[0057] S4. Perform perspective transformation on the four corner points of the left and right camera images using the boundary projection matrix to obtain the positions of the four corner points in the corrected coordinate system;
[0058] S5. Based on the four corner points after correction, find the minimum bounding rectangle to obtain the left and right coverage areas of the left and right corrected images in the corrected coordinate system, respectively.
[0059] S6. Calculate the canvas translation amount based on the left and right covered areas to obtain the X-axis offset and Y-axis offset respectively.
[0060] S7. Based on the X-axis offset and Y-axis offset, the principal point items of the initial projection matrix are translated and corrected;
[0061] S8. Based on the intrinsic parameter matrices, distortion parameters, correction rotation matrices, initial projection matrices after principal point term translation correction, and output canvas size of the left and right cameras, respectively generate distortion correction and epipolar correction mapping tables for the left and right cameras, and remap the left original image and the right original image according to the mapping tables to obtain the epipolar aligned left and right corrected images.
[0062] S9. Update the initial reprojection matrix according to the corrected initial projection matrix.
[0063] In this embodiment,
[0064] S1. Obtain the intrinsic parameter matrix, distortion parameters, and relative extrinsic parameters of the stereo camera, and obtain the input image size and output canvas size.
[0065] The intrinsic parameter matrix describes the transformation relationship of projecting 3D points in the camera coordinate system onto the pixel plane, and includes key information such as the camera's focal length and principal point coordinates. The intrinsic parameter matrix includes... Where K1 is the intrinsic parameter matrix of one of the stereo cameras, and K2 is the intrinsic parameter matrix of the other stereo camera.
[0066] The distortion parameters record the optical defects and distortion of the lens, including... Where D1 is the distortion parameter of one of the binocular cameras, and D2 is the distortion parameter of the other binocular camera.
[0067] The relative extrinsic parameters describe the pose of the right camera coordinate system relative to the left camera coordinate system. Where R is the rotation matrix and T is the translation vector.
[0068] Input image size Output canvas size The output canvas size is the size of the virtual canvas where the corrected image is planned to be stored.
[0069] The intrinsic parameters, distortion parameters, and relative extrinsic parameters of the stereo camera can be obtained as follows: For example, prepare a calibration board, which can be a checkerboard or a circular array calibration board. Fix the stereo camera and take multiple images of the calibration board from different angles and positions to ensure that the calibration board is clear and complete in both the left and right fields of view. Detect feature points in the images (such as checkerboard corner points), and use calibration algorithms (such as OpenCV's cv2.calibrateCamera() (monocular) or cv2.stereoCalibrate() (stereocular) functions) to solve for the camera's intrinsic parameters (K1 and K2), distortion (D1 and D2), and relative extrinsic parameters (rotation matrix R and translation vector T) between the left and right cameras by detecting feature points in the images.
[0070] The input image size can be the resolution of the image sensor in the stereo camera. W is the width of the input image, and H is the height of the input image.
[0071] The output canvas size can be preset according to requirements. For example, the output canvas size can be the same as the input image size, or it can be preset according to the device display area, algorithm processing resolution, or effective field of view requirements.
[0072] S2. Based on the intrinsic parameter matrix, distortion parameter, and relative extrinsic parameter, call the stereo correction algorithm to obtain the correction rotation matrix, initial projection matrix, and initial reprojection matrix.
[0073] The stereo correction algorithm is used to calculate correction parameters for the imaging geometry of the binocular cameras, obtaining the correction rotation matrix, initial projection matrix, and initial reprojection matrix. The algorithm establishes a unified correction coordinate system based on the relative rotation matrix R and relative translation vector T between the left and right cameras. The binocular baseline direction is used as the horizontal direction of the corrected image, and the vertical direction and viewing direction of the correction coordinate system are determined by combining the optical axis directions of the left and right cameras. Subsequently, the rotation transformations of the left and right camera coordinate systems to the unified correction coordinate system are calculated respectively, resulting in the left camera correction rotation matrix R1 and the right camera correction rotation matrix R2. After these rotation transformations, the left and right cameras have consistent equivalent imaging directions, and the ordinates of corresponding points in the left and right corrected images remain consistent. R1 and R2 can be automatically calculated by the stereo correction algorithm based on the binocular positioning parameters.
[0074] In one specific implementation, the above calculations can be performed using OpenCV's stereoRectify function or other stereo correction algorithms with the same functionality. This application does not limit the specific stereo correction algorithm used or its internal solution method.
[0075] The correction rotation matrix is used to rotate the left and right cameras to a unified correction coordinate system, so that the imaging planes of the left and right cameras meet the epipolar correction requirements, thereby placing corresponding points on the same scan line. The correction rotation matrix includes a left correction rotation matrix R1 and a right correction rotation matrix R2, which correspond to the rotation transformations applied to the coordinate systems of the left and right cameras, respectively.
[0076] The initial projection matrix includes the left initial projection matrix P1 corresponding to the left camera and the right initial projection matrix P2 corresponding to the right camera. It is used to describe the relationship between the three-dimensional points in the unified calibration coordinate system and the pixel coordinate systems of the left and right calibration images, respectively.
[0077] The initial reprojection matrix Q is used to describe the reprojection relationship between the pixel coordinates, left and right parallax, and three-dimensional spatial coordinates of the corrected image.
[0078] S3. Construct the corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera system, respectively, as follows:
[0079]
[0080] in, Indicates each camera, Represents any of the initial projection matrices The first three columns form a 3×3 matrix. Let Ri be the intrinsic parameter matrix. Where Ri is any correction rotation matrix. This is the boundary projection matrix.
[0081] The first three columns of Pi form a 3x3 matrix:
[0082] fx 0 cx
[0083] 0 fy cy 0 0 1
[0085] Where fx and fy are the equivalent focal lengths of the camera in the horizontal and vertical directions, respectively, and cx and cy are the coordinates of the principal point.
[0086] S4. Perform perspective transformation on the four corner points of the left and right camera images using the boundary projection matrix to obtain the positions of the four corner points in the corrected coordinate system.
[0087] First, calibrate the coordinate input image size. The corresponding coordinates on the left and right camera images are obtained, and the four corner points of the left and right camera images are transformed by perspective through the mapping matrix to obtain the positions of the four corner points in the corrected coordinate system.
[0088] The coordinates of the four corner points of the camera image (left or right camera image) are (0,0), (W-1,0), (W-1,H-1), and (0,H-1), respectively. Here, W is the width of the image, and H is the height of the image.
[0089] The four corner points are transformed using a mapping matrix, that is, the four corner points of the left and right camera images are converted into homogeneous coordinates, and then multiplied by the corresponding boundary projection matrix to obtain the homogeneous coordinates of each corner point in the corrected coordinate system. These homogeneous coordinates are then normalized to obtain the position of each corner point in the corrected image pixel coordinate system. Specifically, for the i-th camera, the coordinates (u, v) of any corner point are represented as a homogeneous coordinate vector:
[0090]
[0091] Multiplying the homogeneous coordinate vector by the boundary projection matrix Mi corresponding to the i-th camera yields the homogeneous coordinates of the corner point in the corrected coordinate system:
[0092]
[0093] The obtained homogeneous coordinates are normalized to obtain the coordinates of the corner point in the corrected image pixel coordinate system. That is, the transformed corner point coordinates are (u′, v′). The four corner points of the left and right camera images are processed in the same way to obtain the positions of the four corner points of the left and right images in the corrected coordinate system.
[0094] S5. Based on the four corner points after correction, find the minimum bounding rectangle to obtain the left and right coverage areas of the left and right corrected images in the corrected coordinate system.
[0095] In some embodiments, the minimum bounding rectangle of the four corner points can be obtained in various ways. The area covered by the minimum bounding rectangle is the corresponding coverage area. The calculation method for the left coverage area corresponding to the left corrected image is the same as the calculation method for the right coverage area corresponding to the right corrected image. Taking any corrected image as an example, assume that the coordinates of the four corner points after correction are: A(x1, y1), B(x2, y2), C(x3, y3), D(x4, y4). Then calculate the x-axis boundary Xmin=min(x1, x2, x3, x4), Xmax=max(x1, x2, x3, x4), and calculate the y-axis boundary Ymin=min(y1, y2, y3, y4), Ymax=max(y1, y2, y3, y4), thus obtaining the coverage area corresponding to the corrected image. The upper left corner of the coverage area is (Xmin, Ymin), and the lower right corner is (Xmax, Ymax). The length of the coverage area = Xmax - Xmin, and the width = Ymax - Ymin.
[0096] Assume the length of the left coverage area is X1 and the width is Y1, and the length of the right coverage area is X2 and the width is Y2.
[0097] S6. Calculate the canvas translation amount to obtain the offset in the X-axis direction and the offset in the Y-axis direction.
[0098] Calculate the offset along the X-axis. , This causes the areas covered by the left and right images to revert to the visible range of the canvas.
[0099] Specifically, the x-axis offset can be calculated using the following formula:
[0100] △x1 = horizontal center coordinates of the left covered area - cx1; where cx1 is the horizontal principal point coordinates in the left initial projection matrix P1;
[0101] = Horizontal center coordinates of the right coverage area - cx2; where cx2 is the horizontal principal point coordinates in the right initial projection matrix P2;
[0102] Calculate uniform offset in the Y-axis direction For example, take , y1 represents the vertical center coordinates of the left covered area, and y2 represents the vertical center coordinates of the right covered area, to ensure that the two images are aligned vertically.
[0103] S7. The principal point item of the initial projection matrix is translated and corrected based on the X-axis offset and the Y-axis offset, as follows:
[0104]
[0105] Based on the pi matrix above, it can be seen that P1(0,2) is cx in the pi matrix and P1(1,2) is cy in the pi matrix.
[0106] Since the left and right images use the same Y-axis translation Δy, the left and right corrected images remain consistent in the vertical direction, without disrupting the horizontal alignment of the epipolar lines; since the X-direction translation only changes the principal point term and does not change the rotation matrix and baseline term, it does not disrupt the relative geometric terms of stereo correction.
[0107] S8. Based on the intrinsic parameter matrices, distortion parameters, correction rotation matrices, projection matrices after principal point term translation correction, and output canvas size of the left and right cameras, respectively generate distortion correction and epipolar correction mapping tables for the left and right cameras, and remap the left original image and the right original image according to the mapping tables to obtain the epipolar aligned left and right corrected images.
[0108] For any pixel position in the output canvas, firstly, based on the projection matrix corrected by the principal point term translation, the pixel is back-projected to the normalized direction in the unified calibration coordinate system; then, based on the inverse transformation of the calibration rotation matrix, the normalized direction is transformed to the corresponding original camera coordinate system; next, distortion is applied to the normalized coordinates according to the camera distortion model, and the original camera intrinsic parameter matrix is used to convert them into the original image pixel coordinates. The original image horizontal and vertical coordinates corresponding to each pixel position in the output canvas are recorded respectively, resulting in a horizontal coordinate mapping table and a vertical coordinate mapping table.
[0109] In one specific implementation, the initUndistortRectifyMap function in OpenCV can be called to generate the mapping table based on Ki, Di, Ri, Pi′ and the output canvas size; this application does not limit the specific function for generating the mapping table, and other algorithms that satisfy the above coordinate transformation relationship can also be used to generate it.
[0110] S9. Update the initial reprojection matrix according to the corrected initial projection matrix.
[0111] Specifically, based on the corrected initial projection matrix, update cx and cy in the initial reprojection matrix, and update the initial reprojection matrix based on the initial reprojection matrix. The element updates the Q(3,3) of the initial reprojection matrix, and the updated initial reprojection matrix is represented as:
[0112]
[0113] in B is the baseline parameter, and f is the focal length parameter.
[0114] It can be understood that S8 generates a mapping table using the corrected P1 and P2, and outputs the left and right corrected images for image matching. S9 then updates Q based on the same set of corrected P1 and P2, which is used for depth or 3D coordinate calculation after obtaining the disparity. In other words, S8 ensures that the image correction result is consistent with the new principal point translation, and S9 ensures that the subsequent 3D reprojection model is also consistent with the new principal point translation.
[0115] This invention obtains the circumscribed rectangle through projection of the four corner points, enabling rapid estimation of the offset of "running off the canvas" without iteration, thus solving the problem of severe offset of the effective area. Furthermore, by performing translation compensation on the principal point items, equivalent to "moving the canvas center / optical center" in the calibration coordinate system, the effective content can be moved back into the canvas, reducing unnecessary clipping and stretching, and improving texture consistency and matching robustness. Finally, through the constraint of uniform offset in the Y-axis direction, it is ensured that the corresponding points in the left and right calibration images still satisfy the condition that they are on the same scan line, thus avoiding the problem of easily disrupting epipolar alignment during remedial operations. By reconstructing the initial reprojection matrix after modifying the initial projection matrix, it is ensured that the 3D reprojection formula is consistent with the new principal point / baseline.
[0116] The present invention also provides a large-angle binocular camera epipolar correction system for ophthalmic equipment, comprising:
[0117] The parameter acquisition module is used to obtain the intrinsic parameter matrix, distortion parameters, and relative extrinsic parameters of the stereo camera, as well as the input image size and output canvas size.
[0118] The parameter correction module calls the stereo correction algorithm based on the intrinsic parameter matrix, distortion parameters and relative extrinsic parameters to obtain the correction rotation matrix, initial projection matrix and initial reprojection matrix;
[0119] The camera projection module constructs corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera, respectively.
[0120] The perspective transformation module is used to perform perspective transformation on the four corner points of the left and right camera images through the boundary projection matrix to obtain the positions of the four corner points in the corrected coordinate system.
[0121] The coverage area module calculates the minimum bounding rectangle based on the four corner points after correction, and obtains the left and right coverage areas of the left and right corrected images in the corrected coordinate system, respectively.
[0122] The translation calculation module calculates the canvas translation based on the left and right coverage areas, and obtains the offset in the X-axis direction and the offset in the Y-axis direction, respectively.
[0123] The translation correction module corrects the principal point items of the initial projection matrix based on the X-axis offset and the Y-axis offset.
[0124] The epipolar correction module generates distortion correction and epipolar correction mapping tables for the left and right cameras based on the intrinsic parameter matrix, distortion parameters, correction rotation matrix, projection matrix after principal point term translation correction, and output canvas size. It then remaps the left original image and the right original image according to the mapping tables to obtain the epipolar-aligned left and right corrected images.
[0125] The projection update module updates the initial reprojection matrix based on the corrected initial projection matrix.
[0126] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0127] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for epipolar correction of a large-angle binocular camera used in ophthalmic equipment, characterized in that, include: S1. Obtain the intrinsic parameter matrix, distortion parameters, and relative extrinsic parameters of the stereo camera, and obtain the input image size and output canvas size; S2. Based on the intrinsic parameter matrix, distortion parameters and relative extrinsic parameters, call the stereo correction algorithm to obtain the correction rotation matrix, initial projection matrix and initial reprojection matrix; S3. Construct corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera, respectively; S4. Perform perspective transformation on the four corner points of the left and right camera images using the boundary projection matrix to obtain the positions of the four corner points in the corrected coordinate system; S5. Based on the four corner points after correction, find the minimum bounding rectangle to obtain the left and right coverage areas of the left and right corrected images in the corrected coordinate system, respectively. S6. Calculate the canvas translation amount based on the left and right covered areas to obtain the X-axis offset and Y-axis offset respectively. S7. Based on the X-axis offset and Y-axis offset, the principal point items of the initial projection matrix are translated and corrected; S8. Based on the intrinsic parameter matrices, distortion parameters, correction rotation matrices, initial projection matrices after principal point term translation correction, and output canvas size of the left and right cameras, respectively generate distortion correction and epipolar correction mapping tables for the left and right cameras, and remap the left original image and the right original image according to the mapping tables to obtain the epipolar aligned left and right corrected images. S9. Update the initial reprojection matrix according to the corrected initial projection matrix.
2. The method for epipolar correction of a large-angle binocular camera for ophthalmic equipment as described in claim 1, characterized in that, The construction of corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera system includes: The boundary projection matrix is represented as: , in, Indicates each camera, Represents any of the aforementioned correction rotation matrices The first three columns form a 3×3 matrix. Let be the intrinsic parameter matrix.
3. The method for epipolar correction of a large-angle binocular camera for ophthalmic equipment as described in claim 2, characterized in that, The four corner points of the left or right camera image are represented as follows: , W represents the width of the image, and H represents the height of the image.
4. The method for epipolar correction of a large-angle binocular camera for ophthalmic equipment as described in claim 3, characterized in that, The translation correction of the principal point terms of the initial projection matrix by the X-axis offset and the Y-axis offset includes: , in, and These are the first and second offsets along the X-axis, respectively. Y-axis offset, Y-axis offset The same applies to both the left and right cameras.
5. The method for epipolar correction of a large-angle binocular camera for ophthalmic equipment as described in claim 4, characterized in that, The step of updating the initial reprojection matrix based on the translated principal point terms includes: The initial reprojection matrix is represented as: , in B is the baseline parameter, and f is the focal length parameter.
6. A large-angle binocular camera epipolar correction system for ophthalmic equipment, characterized in that, include: The parameter acquisition module is used to obtain the intrinsic parameter matrix, distortion parameters, and relative extrinsic parameters of the stereo camera, as well as the input image size and output canvas size. The parameter correction module calls the stereo correction algorithm based on the intrinsic parameter matrix, distortion parameters and relative extrinsic parameters to obtain the correction rotation matrix, initial projection matrix and initial reprojection matrix; The camera projection module constructs corresponding boundary projection matrices based on the intrinsic parameter matrices, correction rotation matrices, and initial projection matrices of the left and right cameras in the binocular camera, respectively. The perspective transformation module is used to perform perspective transformation on the four corner points of the left and right camera images through the boundary projection matrix to obtain the positions of the four corner points in the corrected coordinate system. The coverage area module calculates the minimum bounding rectangle based on the four corner points after correction, and obtains the left and right coverage areas of the left and right corrected images in the corrected coordinate system, respectively. The translation calculation module calculates the canvas translation based on the left and right coverage areas, and obtains the offset in the X-axis direction and the offset in the Y-axis direction, respectively. The translation correction module corrects the principal point items of the initial projection matrix based on the X-axis offset and the Y-axis offset. The epipolar correction module generates distortion correction and epipolar correction mapping tables for the left and right cameras based on the intrinsic parameter matrix, distortion parameters, correction rotation matrix, projection matrix after principal point term translation correction, and output canvas size. It then remaps the left original image and the right original image according to the mapping tables to obtain the epipolar-aligned left and right corrected images. The projection update module updates the initial reprojection matrix based on the corrected initial projection matrix.