In-vivo SLAM method and system based on fusion of optical fiber strain sensor and monocular camera
Through the fusion method of fiber optic strain sensors and monocular cameras, the problem of positioning error of SLAM technology under illumination changes and textureless areas in pulmonary micro-nodule surgery is solved, and the precise pose estimation and environment of the surgical robot in the lungs are achieved. Mapping improves the accuracy and reliability of surgery.
Patent Information
- Application Number
- CN202111575033.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-12-21
AI Technical Summary
In pulmonary micro-nodule surgery, traditional SLAM technology increases or fails the end positioning error of the surgical robot due to illumination changes, textureless areas and dynamic scenes, making it difficult to achieve accurate three-dimensional mapping and precise positioning of the in vivo environment.
Using the fusion method of fiber optic strain sensors and monocular cameras, through visual fiber spatio-temporal alignment, data preprocessing, system initialization, soft tissue motion deformation elimination, pose calculation and optimization steps, combined with the strain information of fiber optic sensors, a visual fiber beam adjustment is established Optimize the formula to improve the accuracy of surgical robot end pose estimation and in vivo environment mapping.
In the in vivo environment with dynamic, insufficient illumination and textureless areas, the precise end positioning of the surgical robot and the mapping of the in vivo environment are achieved, solving the problem of visual SLAM positioning and mapping failure, meeting the real-time requirements, and achieving good positioning effects.
Smart Images

Figure CN114463433B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of surgical robotics, and more specifically, to an in-vivo SLAM method and system based on the fusion of an optical fiber strain sensor and a monocular camera. Specifically, it relates to an in-vivo SLAM method and system based on the fusion of an optical fiber strain sensor and a monocular camera, and a surgical robot thereof. Background Art
[0002] Small lung nodules, medically known as solitary pulmonary nodules, are a common thoracic surgical condition. Their etiology is complex, and their clinical manifestations lack specificity. Nodules are not detected until they have been dormant in the body for a certain period of time and have grown to a certain size, often requiring chest X-rays or other methods for diagnosis and treatment.
[0003] In recent years, continuum robotics has been widely used clinically in minimally invasive surgery, demonstrating significant advantages over traditional surgery. Using continuum robotics for sampling small lung nodules has helped improve diagnostic capabilities for these conditions. Precise positioning of the surgical robot's distal end and three-dimensional mapping of the in vivo environment are key technologies for localizing and sampling small lung nodules, and are crucial for improving the accuracy of their diagnosis.
[0004] Monocular cameras are a commonly used sensor for SLAM technology. Due to the complex structure of the lungs, the interference of surgical operations, and the interference of physiological movements such as breathing, the precise positioning of the surgical robot's end points and the creation of a three-dimensional map of the internal environment pose a higher technical challenge.
[0005] In this regard, due to its own advantages such as corrosion resistance, small size, and anti-electromagnetic interference, optical fiber sensors are widely used in the end positioning of surgical robots. In addition, the fusion of optical fiber strain sensors and monocular cameras can make up for the following problems: Figure 5 In the in vivo environment shown, the end-positioning error increases or fails due to illumination changes, textureless areas or dynamic scenes, thereby significantly improving the accuracy of end-positioning and 3D mapping. Summary of the Invention
[0006] In view of the defects in the prior art, the purpose of the present invention is to provide an in-vivo SLAM method and system based on the fusion of optical fiber strain sensor and monocular camera.
[0007] According to the present invention, an in vivo SLAM method based on the fusion of an optical fiber strain sensor and a monocular camera includes any one or more of the following steps:
[0008] Step S1, visual fiber spatiotemporal alignment step: align the clock source and timestamp of the monocular camera and the fiber sensor; estimate the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system; determine the scale of the monocular camera;
[0009] Step S2, data preprocessing step: performing feature extraction and feature tracking on the image acquired by the monocular camera; obtaining the curvature curve and torsion curve of the center line of the continuum robot through the measurement data of the optical fiber strain sensor;
[0010] Step S3, system initialization step: obtaining the end pose of the continuum robot according to the curvature curve and the torsion curve; performing triangulation based on the end pose obtained from the feature points and the optical fiber data to establish an initial map;
[0011] Step S4, soft tissue motion deformation elimination step: divide the monocular image into N×M rectangular blocks, and calculate the proportion of outliers in each rectangular block r s , remove the feature points of dynamic soft tissue and the map points corresponding to the feature points;
[0012] Step S5, pose calculation and optimization step: Based on the monocular image, calculate and optimize the pose of the current frame; based on the visual fiber loss function, perform global optimization on the camera pose and map points.
[0013] Preferably, in step S2, the step of performing feature extraction and feature tracking includes detecting and estimating the position of the feature points of the current frame in the next frame;
[0014] In step S3, the end position of the continuum robot is obtained by a shape reconstruction algorithm, the number of feature points is detected, and a key frame is selected if the number is greater than a set threshold. The motion consistency of the feature points is checked based on the end position obtained by the optical fiber, and outliers are removed;
[0015] In step S4, for each matrix block, the distance D from the feature point to the corresponding epipolar line is calculated, and the proportion of outliers in each rectangular block is calculated based on the relationship between the distance D and the set threshold. s ;
[0016] In step S5, the pose of the current frame is calculated and optimized based on the known 3D map point coordinates and 2D image coordinates. If the feature points of the current frame are less than the set threshold or the calculation fails through the above steps, the pose is calculated using the data of the fiber optic sensor, and a visual fiber beam adjustment optimization formula is established to optimize the camera pose and map points.
[0017] Preferably, in step 2, the strain information of the continuum robot at the current moment is obtained by using an optical fiber strain sensor, which is recorded as step 2.3 and includes the following steps:
[0018] Step S2.3.1, place the continuum robot in an environment with the same temperature as the working environment, and measure the reflection wavelength λ0 when it is not deformed using a spectrometer;
[0019] Step S2.3.2: Measure the peak value of the reflected wavelength λ at the current moment k when the continuum robot is deformed. k ;
[0020] Step S2.3.3: Based on the mathematical relationship between the optical fiber sensor and strain:
[0021]
[0022] Solve to obtain the strain information of the continuum robot at time k; where ε represents the strain value, Δλ = λ k -λ0,p ε is the optical fiber strain sensitivity coefficient, which is a constant;
[0023] In step 2, the curvature curve and torsion curve of the center line of the continuum robot are obtained through the measurement algorithm, which is recorded as step 2.4 and includes the following steps:
[0024] Step S2.4.1: Embed three optical fibers in the continuum robot. Write Bragg gratings into each fiber at equal intervals. The three gratings are arranged in an equilateral triangle on the same cross-section, with the centerline of the continuum robot located at the center of the equilateral triangle.
[0025] Step S2.4.2: The grating combination located at the same cross section divides the continuum robot into N small segments. According to the assumption of constant curvature and constant torsion of the segments, and the cross section of each segment remains constant during the bending process, the parametric equation of the center line s is i (t) is expressed as:
[0026]
[0027]
[0028] Among them, l i It represents the arc length of the center line of the i-th segment, and its length is expressed as:
[0029]
[0030]
[0031]
[0032] They represent the theoretical calculated lengths of the i-th section of the three optical fibers A, B, and C respectively; Figure 7 As shown, d A,id B,i d C,i Respectively represent the length of the three gratings A, B, and C from the center line on the same section; β C,i =2β B,i =240°;
[0033] On the same cross section, β A,i represents the azimuth angle of the grating of fiber A, β B,i β represents the azimuth angle of the grating of fiber B relative to the grating of fiber A. C,i Indicates the azimuth angle of the grating of fiber C relative to the grating of fiber A;
[0034] The strain at the grating is measured by the grating, and the actual lengths of the three optical fibers A, B, and C are
[0035]
[0036]
[0037]
[0038] where ε A,i , ε B,i , ε C,i They represent the strains measured by the corresponding gratings of optical fibers A, B, and C respectively; according to the equality of the calculated and actual lengths of the optical fibers, the parameter a is obtained by solving i , b i , α i ; Finally, the curvature κ of the center line of the i-th segment is obtained i and torsion τ i :
[0039]
[0040]
[0041] Step S2.4.3, {κ i s i} and {τ i s i} interpolation is performed to obtain a continuous curvature arc length curve κ(s) and torsion arc length curve τ(s);
[0042] κ i represents the curvature of the curve of the center line of the i-th segment;
[0043] s i The arc length of the curve representing the center line of segment i;
[0044] τi represents the curve torsion of the center line of segment i;
[0045] s represents the arc length parameter;
[0046] In step S3, the end position of the continuum robot is obtained by a shape reconstruction algorithm based on the curvature arc length curve κ(s) and the torsion arc length curve τ(s), which is recorded as step 3.1 and includes the following steps:
[0047] Step S3.1.1: Discretize the curvature arc length curve κ(s) and the torsion arc length curve τ(s) obtained in step S2 to obtain the sample point sets of curvature and torsion respectively: {κ(s i ), τ(s i )}, i = 1, 2, ..., ∞, dividing the continuum robot into N segments;
[0048] Step S3.1.2: Substitute the curvature and torsion into the shape reconstruction algorithm to obtain the homogeneous coordinate transformation matrix expression of the upper and lower sections for the i-th segment:
[0049]
[0050] Represents the homogeneous transformation matrix from the coordinate system of section i to the coordinate system of section i-1;
[0051] R represents the rotation matrix;
[0052] P represents the translation vector;
[0053] o i-1 represents the coordinate origin of section i-1;
[0054] o i represents the coordinate origin of section i;
[0055] l i represents the length of the centerline of the continuum robot in segment i;
[0056] Where c represents cosine and s represents sin. i For curve o i-1 o i The curvature, α i The bending plane and x i-1 Angle between the axes, θ i For curve o i-1 o i The corresponding central angle, θ i =κ i l i , Φ i =θ i -α i ;
[0057] Step S3.1.3: According to the matrix transformation, the position R of section i relative to the global coordinate system i And the global position coordinate P i Expressed as:
[0058]
[0059] The end position of the continuum robot can be obtained through the above formula;
[0060] T i Represents the homogeneous transformation matrix between the section i coordinate system and the global coordinate system;
[0061] T i-1 Represents the homogeneous transformation matrix between the section i-1 coordinate system and the global coordinate system;
[0062] N represents the number of segments into which the center line of the continuum robot is evenly divided.
[0063] Preferably, in step 5, a visual fiber bundle adjustment optimization formula is established to optimize the camera pose and map points, which is recorded as step S5.3 and includes the following steps:
[0064] Step S5.3.1. Establish the loss function C of the visual fiber:
[0065]
[0066] in,
[0067]
[0068] Among them, C is the total loss function, C k is the reprojection error, e a 、e b are the reprojection errors of the map points on key frames a and b, ρ is the robust kernel function, and e a,b is the homogeneous transformation error between key frames a and b;
[0069] Ω a,b is the covariance matrix of key frames a and b, i and j represent the image frames between key frames a and b, Ω a,i represents the covariance matrix between key frame a and image frame i, Ω b,i represents the covariance matrix between key frame b and image frame J;
[0070] k represents the matching set from key frame a to key frame b, including all feature points and 3D map points corresponding to the feature points.
[0071] Step S5.3.2: Use the Gauss-Newton method to iteratively solve the loss function, where the variables to be solved are the camera pose and map points.
[0072] According to the present invention, an in-vivo SLAM system based on the fusion of an optical fiber strain sensor and a monocular camera includes any one or more of the following steps:
[0073] Module M1, visual fiber spatiotemporal alignment steps: align the clock source and timestamp of the monocular camera and the fiber sensor; estimate the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system; determine the scale of the monocular camera;
[0074] Module M2, data preprocessing step: feature extraction and feature tracking are performed on the image acquired by the monocular camera; the curvature curve and torsion curve of the center line of the continuum robot are obtained through the measurement data of the optical fiber strain sensor;
[0075] Module M3, system initialization step: obtaining the end pose of the continuum robot according to the curvature curve and the torsion curve; performing triangulation based on the end pose obtained from the feature points and the fiber data to establish an initial map;
[0076] Module M4, soft tissue motion deformation elimination step: divide the monocular image into N×M rectangular blocks, calculate the proportion of outliers in each rectangular block r s , remove the feature points of dynamic soft tissue and the map points corresponding to the feature points;
[0077] Module M5, pose calculation and optimization steps: Based on the monocular image, calculate and optimize the pose of the current frame; based on the visual fiber loss function, perform global optimization of the camera pose and map points.
[0078] Preferably, in the module M2, the step of performing feature extraction and feature tracking includes detecting and estimating the position of the feature points of the current frame in the next frame;
[0079] In the module M3, the end position of the continuum robot is obtained through the shape reconstruction algorithm, the number of feature points is detected, and the key frame is selected if the number is greater than the set threshold. The motion consistency of the feature points is checked based on the end position obtained by the optical fiber, and outliers are eliminated;
[0080] In the module M4, for each matrix block, the distance D from the feature point to the corresponding epipolar line is calculated, and the proportion of outliers in each rectangular block is calculated based on the relationship between the distance D and the set threshold. s ;
[0081] In the module M5, the pose of the current frame is calculated and optimized based on the known 3D map point coordinates and 2D image coordinates. If the feature points of the current frame are less than the set threshold or the calculation fails through the above steps, the pose is calculated using the data of the fiber optic sensor, and a visual fiber bundle adjustment optimization formula is established to optimize the camera pose and map points.
[0082] Preferably, in step 2, the strain information of the continuum robot at the current moment is obtained by using an optical fiber strain sensor, which is recorded as step 2.3 and includes the following steps:
[0083] Module M2.3.1. Place the continuum robot in an environment with the same temperature as the working environment and use a spectrometer to measure the reflected wavelength λ0 when the robot is not deformed.
[0084] Module M2.3.2: Measure the peak value of the reflected wavelength λ at the current moment k when the continuum robot is deformed. k ;
[0085] Module M2.3.3, based on the mathematical relationship between fiber optic sensors and strain:
[0086]
[0087] Solve to obtain the strain information of the continuum robot at time k; where ε represents the strain value, Δλ = λ k -λ0,p ε is the optical fiber strain sensitivity coefficient, which is a constant;
[0088] In step 2, the curvature curve and torsion curve of the center line of the continuum robot are obtained through the measurement algorithm, which is recorded as step 2.4 and includes the following steps:
[0089] Module M2.4.1 embeds three optical fibers in a continuum robot. Bragg gratings are written into each fiber at equal intervals. The three gratings are arranged in an equilateral triangle on the same cross-section, with the centerline of the continuum robot located at the center of the equilateral triangle.
[0090] Module M2.4.2, the grating combination located at the same cross section divides the continuum robot into N small segments. According to the assumption of constant curvature and constant torsion of the segments, and the cross section of each segment remains constant during the bending process, the parametric equation of the center line s i (t) is expressed as:
[0091]
[0092]
[0093] Among them, l i It represents the arc length of the center line of the i-th segment, and its length is expressed as:
[0094]
[0095]
[0096]
[0097] They represent the theoretical calculated lengths of the i-th section of the three optical fibers A, B, and C respectively; Figure 7 As shown, d A,i d B,i d C,i Respectively represent the lengths of the three gratings A, B, and C from the center line on the same cross section;
[0098] β C,i =2β B,i =240°;
[0099] On the same cross section, β A,i represents the azimuth angle of the grating of fiber A, β B,i β represents the azimuth angle of the grating of fiber B relative to the grating of fiber A. C,i Indicates the azimuth angle of the grating of fiber C relative to the grating of fiber A;
[0100] The strain at the grating is measured by the grating, and the actual lengths of the three optical fibers A, B, and C are
[0101]
[0102]
[0103]
[0104] where ε A,i , ε B,i , ε C,i They represent the strains measured by the corresponding gratings of optical fibers A, B, and C respectively; according to the equality of the calculated and actual lengths of the optical fibers, the parameter a is obtained by solving i , b i , α i ; Finally, the curvature κ of the center line of the i-th segment is obtained i and torsion τ i :
[0105]
[0106]
[0107] Module M2.4.3, {κi s i} and {τ i s i} interpolation is performed to obtain a continuous curvature arc length curve κ(s) and torsion arc length curve τ(s);
[0108] κ i represents the curvature of the curve of the center line of the i-th segment;
[0109] s i The arc length of the curve representing the center line of segment i;
[0110] τ i represents the curve torsion of the center line of segment i;
[0111] s represents the arc length parameter;
[0112] In the module M3, the end position of the continuum robot is obtained by a shape reconstruction algorithm based on the curvature arc length curve κ(s) and the torsion arc length curve τ(s), which is recorded as step 3.1 and includes the following steps:
[0113] Module M3.1.1, discretize the curvature arc length curve κ(s) and torsion arc length curve τ(s) obtained from module M2 to obtain the sample point sets of curvature and torsion respectively: {κ(s i ), τ(s i )}, i = 1, 2, ..., ∞, dividing the continuum robot into N segments;
[0114] Module M3.1.2: Substitute the curvature and torsion into the shape reconstruction algorithm to obtain the homogeneous coordinate transformation matrix expression of the upper and lower sections for the i-th segment:
[0115]
[0116] Represents the homogeneous transformation matrix from the coordinate system of section i to the coordinate system of section i-1;
[0117] R represents the rotation matrix;
[0118] P represents the translation vector;
[0119] o i-1 represents the coordinate origin of section i-1;
[0120] o i represents the coordinate origin of section i;
[0121] l i represents the length of the centerline of the continuum robot in segment i;
[0122] Where c represents cosine and s represents sin.i For curve o i-1 o i The curvature, α i The bending plane and x i-1 Angle between the axes, θ i For curve o i-1 o i The corresponding central angle, θ i =κ i l i , Φ i =θ i -α i ;
[0123] Module M3.1.3, according to the matrix transformation, the position R of section i relative to the global coordinate system i And the global position coordinate P i Expressed as:
[0124]
[0125] The end position of the continuum robot can be obtained through the above formula;
[0126] T i Represents the homogeneous transformation matrix between the section i coordinate system and the global coordinate system;
[0127] T i-1 Represents the homogeneous transformation matrix between the section i-1 coordinate system and the global coordinate system;
[0128] N represents the number of segments into which the center line of the continuum robot is evenly divided.
[0129] Preferably, in step 5, a visual fiber bundle adjustment optimization formula is established to optimize the camera pose and map points, which is recorded as module M5.3 and includes the following steps:
[0130] Module M5.3.1. Establish the loss function C of the visual fiber:
[0131]
[0132] in,
[0133]
[0134] Among them, C is the total loss function, C k is the reprojection error, e a 、e b are the reprojection errors of the map points on key frames a and b, ρ is the robust kernel function, and e a,b is the homogeneous transformation error between key frames a and b;
[0135] Ω a,bis the covariance matrix of key frames a and b, i and j represent the image frames between key frames a and b, Ω a,i represents the covariance matrix between key frame a and image frame i, Ω b,i represents the covariance matrix between key frame b and image frame j;
[0136] k represents the matching set from key frame a to key frame b, including all feature points and 3D map points corresponding to the feature points.
[0137] Module M5.3.2: Use the Gauss-Newton method to iteratively solve the loss function, where the variables to be solved are the camera pose and map points.
[0138] According to the present invention, a computer-readable storage medium storing a computer program is provided. When the computer program is executed by a processor, the steps of the in-vivo SLAM method based on the fusion of an optical fiber strain sensor and a monocular camera are implemented.
[0139] A surgical robot provided according to the present invention includes the in-vivo SLAM system based on the fusion of an optical fiber strain sensor and a monocular camera, or includes the computer-readable storage medium storing a computer program.
[0140] Compared with the prior art, the present invention can provide the following beneficial effects:
[0141] 1. The present invention can adapt to the dynamic, insufficiently illuminated and large-scale textureless areas in the body environment.
[0142] 2. The present invention can solve the problem of visual SLAM positioning and mapping failure caused by environmental changes in practical applications, complete the task of accurate end-point positioning of continuum robots and mapping of the in vivo environment, and meet real-time requirements.
[0143] 3. The in-vivo SLAM solution proposed in this invention, which integrates the optical fiber strain sensor and the monocular camera, can cope with robustness issues such as noise, local deformation, and illumination changes, and has a good positioning effect.
[0144] 4. In the process of using SLAM technology to locate the end of a continuum robot in an in vivo environment, the present invention uses the following main functions of the fiber optic sensor data: 1. When the pose estimation using the image fails or the image feature points are insufficient, the fiber optic data is used to estimate the end pose to avoid the repositioning link; 2. It provides pose constraints between image frames to obtain more accurate pose and map point coordinates. BRIEF DESCRIPTION OF THE DRAWINGS
[0145] Other features, objects and advantages of the present invention will become more apparent upon reading the detailed description of non-limiting embodiments with reference to the following drawings:
[0146] Figure 1 The figure is a flowchart of the specific operation process of the method described in the present invention.
[0147] Figure 2 Schematic diagram of a distributed optical fiber network.
[0148] Figure 3 Flowchart for shape reconstruction based on fiber optic sensor data.
[0149] Figure 4 Schematic diagram of the simulation of shape reconstruction based on fiber optic sensor data.
[0150] Figure 5 This is a real picture of the internal environment (intestine).
[0151] Figure 6 This is a diagram of the SLAM technology framework based on the fusion of optical fiber and camera data.
[0152] Figure 7 Schematic diagram of the Bragg grating distribution structure with the same cross section. DETAILED DESCRIPTION
[0153] The present invention will be described in detail below with reference to specific embodiments. The following examples will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those skilled in the art, several changes and improvements can be made without departing from the scope of the present invention. These all fall within the scope of protection of the present invention.
[0154] The present invention provides an in-vivo SLAM solution based on the fusion of an optical fiber strain sensor and a monocular camera, comprising the following steps: (1) a visual optical fiber spatiotemporal alignment step; (2) a data preprocessing step; (3) a system initialization step; (4) a soft tissue motion deformation elimination step; and (5) a pose calculation and optimization step. The present invention can adapt to in-vivo environments that are dynamic, have insufficient illumination, and have a large number of textureless areas. When pose estimation using camera images fails or image feature points are insufficient, optical fiber data can be used to estimate the end pose, avoiding the repositioning step. In addition, optical fiber data can provide pose constraints between image frames, obtaining more accurate poses and map point coordinates, and completing the tasks of accurate end position positioning of a continuum robot and mapping the in-vivo environment.
[0155] According to the present invention, an in vivo SLAM method based on the fusion of an optical fiber strain sensor and a monocular camera includes any one or more of the following steps:
[0156] The visual fiber spatiotemporal alignment, denoted as step S1, specifically involves: in an offline state, based on the monocular camera image and the fiber strain value, the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system is estimated through hand-eye calibration; the monocular camera and the fiber sensor are clock-source aligned through hardware equipment, followed by timestamp alignment; the scale of the monocular camera is determined by observing an object at a known distance with the monocular camera;
[0157] The data preprocessing step, denoted as step S2, specifically includes: performing preprocessing on the environmental image obtained by the continuum robot during the operation, including feature extraction and feature tracking; at the same time, obtaining the strain information of the continuum robot during the operation through the optical fiber strain sensor, performing preprocessing, and obtaining the curvature curve and torsion curve of the continuum robot's centerline through the measurement algorithm;
[0158] System initialization, denoted as step S3, specifically: based on the curvature curve and torsion curve obtained from the optical fiber strain, the end-point pose of the continuum robot is obtained through a shape reconstruction algorithm; the number of feature points in the current frame is detected, and frames with a number greater than a set threshold are selected as key frames; based on the end-point pose obtained from the optical fiber, the feature points are subjected to a motion consistency check to eliminate outliers; based on the feature points and the end-point pose obtained from the optical fiber, triangulation is performed to establish an initial map;
[0159] Soft tissue motion deformation elimination is recorded as step S4. Specifically: according to the input image, the monocular image is divided into N×M rectangular blocks; the inliers are screened according to RANSAC, and the basic matrix is calculated based on the inliers; based on the matched feature point pairs, the distance D from the feature point to the corresponding epipolar line is calculated; based on the relationship between the distance D and the set threshold, the proportion of outliers in each rectangular block r is calculated. s If r s If the value is greater than the set threshold, the rectangular block is judged to be a dynamic soft tissue part, the feature points in the rectangular block are removed, and the map points corresponding to the feature points are removed;
[0160] Posture calculation and optimization, recorded as step S5, specifically: based on the known 3D feature point coordinates and 2D image coordinates, calculate the pose of the current frame and optimize it; if the current frame tracking fails, use the data of the fiber optic sensor to calculate the current frame pose; establish a visual fiber beam adjustment optimization formula to optimize the camera pose and map points.
[0161] Step S1 shown includes the following steps:
[0162] Step S1.1: Use hardware equipment to align the clock sources of the monocular camera and the fiber optic sensor, and then align the timestamps. This includes the following steps:
[0163] Step S1.1.1: Synchronize the timing of the two sensors through hardware, and synchronize the monocular camera and the fiber optic sensor with the clock source;
[0164] Step S1.1.2: Using the camera as the core sensor, each time camera data is received, the current camera data is used as the time point to be interpolated. The fiber optic sensor data before and after the time point is found, and then an appropriate interpolation method is selected to interpolate the data to obtain the fiber optic sensor data at the corresponding time point.
[0165] Step S1.2: In an offline state, estimate the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system (body coordinate system), including the following steps:
[0166] Step S1.2.1: Determine the intrinsic parameters of the monocular camera according to the Zhang Zhengyou calibration method;
[0167] Step S1.2.2: Solving the homogeneous transformation matrix X between the monocular camera and the fiber optic sensor can be considered a hand-eye calibration problem. In a pre-set trajectory, the coordinate transformation matrix A between the two camera frames at time i and j is determined by the monocular camera, as well as the coordinate transformation matrix B at time i and time j obtained by the fiber optic sensor corresponding to these two camera frames. According to the hand-eye equation:
[0168] AX=XB
[0169] Solving X yields the homogeneous transformation matrix between the monocular camera and the fiber optic sensor.
[0170] The step S2 comprises the following steps:
[0171] Step S2.1: Detecting feature points of the current frame, including the following steps:
[0172] Step S2.1.1: Use Soble to calculate the gradient values of the monocular image in the X and r directions, which are respectively denoted as I x , I y ;
[0173] Step S2.1.2: Calculate I x 2 , I y 2 , I x *I y , find the four element values of M, where the expression of M is:
[0174]
[0175] Step S2.1.3: Perform Gaussian smoothing filtering on the four elements of M to obtain a new M. The discrete two-dimensional zero-mean Gaussian function Gauss is:
[0176]
[0177] x and y represent variables;
[0178] σ represents variance
[0179] Step S2.1.4: Calculate the corner quantity cim (i.e., corner response R) of each pixel using M:
[0180]
[0181] Step S2.1.4: Make a judgment based on the value of the matrix cim. If cim is greater than a certain threshold and cim is a local maximum in a certain area, then the point is considered a corner point, that is, a feature point; otherwise, the point is not considered a feature point;
[0182] Step S2.2: Estimate the position of the feature points of the current frame in the next frame using the Lukas-Kanade optical flow method, including the following steps:
[0183] Step S2.2.1: Create image pyramids for monocular images k and k+1, which are:
[0184] k represents the kth image frame;
[0185] I L represents the image pyramid built on image frame k;
[0186] J L represents the image pyramid built on image frame k+1;
[0187] L represents the number of layers of the pyramid, L = 0 represents the image of the 0th layer, L = L m Represents the image of the last layer;
[0188] L m Indicates the number of layers in the image pyramid.
[0189] Step S2.2.2: Initialize the displacement estimate on the pyramid to 0,
[0190] g represents the L m The displacement estimator of the layer image pyramid, that is, the initial value of the optical flow calculation;
[0191] Indicates the L m The displacement estimate of the layer image pyramid in the x-axis direction, that is, the initial value of the optical flow calculation in the x-axis direction;
[0192] Indicates the L mThe displacement estimate of the layer image pyramid in the y-axis direction, that is, the initial value of the optical flow calculation in the y-axis direction.
[0193] Step S2.2.3: Make L = L m , calculate the feature point u in image I L Position in I L Partial derivatives of x and y, calculate the spatial derivative matrix G:
[0194]
[0195] Initialize LK iteration:
[0196] p x Represents image I L The x-axis coordinate of the feature point u on ;
[0197] p y Represents image I L The y-axis coordinate of the feature point u on ;
[0198] w x 、w y The size of the rectangular window on the image is set respectively (2*w x +1)、(2*w y +1);
[0199] I x (x, y) represents the partial derivative of each pixel on image I with respect to x;
[0200] I y (x, y) represents the partial derivative of y for each pixel on image I;
[0201] Represents the initial optical flow estimate.
[0202] Step S2.2.4: Starting from k=1, calculate the image pixel difference δI k :
[0203]
[0204] δI k Indicates the image pixel difference;
[0205] I(x, y) represents the grayscale value of the corresponding position of the feature point in the image frame k;
[0206] J(x, y) represents the grayscale value of the corresponding position of the feature point in image frame k+1;
[0207] Represents the optical flow estimation value of the image pyramid of the k-1th layer in the x-axis direction;
[0208] Represents the optical flow estimation value of the k-1th layer of the image pyramid in the y-axis direction.
[0209] Calculate image mismatch vector
[0210]
[0211] Calculate optical flow: Calculate the cumulative iteration amount: When k is greater than K or When it is less than the set threshold, step S2.2.4 terminates the loop and the optical flow estimation of the Lth layer is obtained as
[0212] Represents the optical flow estimate of the k-th layer of the image pyramid;
[0213] Represents the optical flow estimate of the k-1th layer of the image pyramid;
[0214] Indicates the number of optical flow iterations for each layer of the image pyramid;
[0215] d L Represents the final optical flow of the L-th level image pyramid.
[0216] Step S2.2.5: Based on step S2.2.4, the initial estimate of the L-1 layer is calculated as Repeat steps S2.2.3 and S2.2.4 until m = 0, and finally obtain the feature point at the position of image k + 1 as v = u + d;
[0217] u represents the feature point in image I;
[0218] v represents the feature point corresponding to the feature point u in image J;
[0219] Step S2.3, obtaining the strain information of the continuum robot at the current moment through the optical fiber strain sensor, includes the following steps:
[0220] Step S2.3.1, place the continuum robot in an environment with the same temperature as the working environment, and measure the reflection wavelength λ0 when it is not deformed using a spectrometer;
[0221] Step S2.3.2: Measure the peak value of the reflected wavelength λ at the current moment k when the continuum robot is deformed. k ;
[0222] Step S2.3.3: Based on the mathematical relationship between the optical fiber sensor and strain:
[0223]
[0224] Solve to obtain the strain information of the continuum robot at time k; where ε represents the strain value, Δλ = λ k -λ0,p ε is the optical fiber strain sensitivity coefficient, which is a constant;
[0225] Step S2.4: Obtain the curvature curve and torsion curve of the center line of the continuum robot through the measurement algorithm:
[0226] Step S2.4.1: In order to calculate the end position of the continuum robot, the strain information at multiple locations must be measured. Since strain is one-dimensional information, in order to measure the three-dimensional information of curvature and torsion, multiple sensors are required to measure the strain at the same axial position simultaneously and then calculate it. Therefore, the strain is measured by Figure 2 The distributed fiber optic sensing network shown in the figure: three optical fibers are embedded in the continuum robot, and Bragg gratings are written on each fiber at equal distances. The three gratings are distributed in an equilateral triangle on the same cross section, and the center line of the continuum robot is located at the center of the equilateral triangle;
[0227] Step S2.4.2: The grating combination located at the same cross section divides the continuum robot into N small segments. According to the assumption of constant curvature and constant torsion of the segments, and the cross section of each segment remains constant during the bending process, the parametric equation of the center line s is i (t) can be expressed as:
[0228]
[0229]
[0230] Among them, l i represents the arc length of the center line of the i-th segment, and its length can be expressed as:
[0231]
[0232]
[0233]
[0234] They represent the theoretical calculated lengths of the i-th section of the three optical fibers A, B, and C respectively; Figure 7 As shown, d A,i d B,i d C,i Respectively represent the lengths of the three gratings A, B, and C from the center line on the same cross section;
[0235] β C,i=2β B,i =240°;
[0236] On the same cross section, β A,i represents the azimuth angle of the grating of fiber A, β B,i β represents the azimuth angle of the grating of fiber B relative to the grating of fiber A. C,i Indicates the azimuth angle of the grating of fiber C relative to the grating of fiber A.
[0237] The grating can measure the strain at the grating, so the actual lengths of the three optical fibers A, B, and C are
[0238]
[0239]
[0240]
[0241] where ε A,i , ε B,i , ε C,i They represent the strains measured by the corresponding gratings of optical fibers A, B, and C respectively; according to the equality of the calculated and actual lengths of the optical fibers, the parameter a is obtained by solving i , b i , α i Finally, the curvature κ of the center line of the i-th segment is obtained i and torsion τ i :
[0242]
[0243]
[0244] Step S2.4.3: From the above steps, we can get a few sample points, namely the curvature and torsion of the grating measurement points. According to the cubic B-spline interpolation, we can get the curvature and torsion of {κ i s i} and {τ i s i} to interpolate, the interpolation basis function p(t) is:
[0245]
[0246] Interpolation results in a continuous curvature arc length curve κ(s) and torsion arc length curve τ(s).
[0247] κi represents the curvature of the center line of segment i;
[0248] s i The arc length of the curve representing the center line of segment i;
[0249] τ i represents the curve torsion of the center line of segment i;
[0250] t represents the normalization parameter;
[0251] p0, p1, p2, and p3 represent the control points of the cubic B-spline curve;
[0252] s represents the arc length parameter.
[0253] The step S3 comprises the following steps:
[0254] Step S3.1: Obtain the end pose of the continuum robot using a shape reconstruction algorithm based on the curvature arc length curve κ(s) and the torsion arc length curve τ(s), including the following steps:
[0255] Step S3.1.1: Discretize the curvature arc length curve κ(s) and the torsion arc length curve τ(s) obtained in step S2 to obtain the sample point sets of curvature and torsion respectively: {κ(s i ), τ(s i )}, i = 1, 2, ..., ∞, dividing the continuum robot into N segments;
[0256] Step S3.1.2: Substitute the curvature and torsion into the shape reconstruction algorithm to obtain the homogeneous coordinate transformation matrix expression of the upper and lower sections for the i-th segment:
[0257]
[0258] Represents the homogeneous transformation matrix from the coordinate system of section i to the coordinate system of section i-1;
[0259] R represents the rotation matrix;
[0260] P represents the translation vector;
[0261] o i-1 represents the coordinate origin of section i-1;
[0262] o i represents the coordinate origin of section i;
[0263] l i represents the length of the centerline of the continuum robot in segment i;
[0264] Where c represents cosine and s represents sin. i For curve o i-1 o i The curvature, α i The bending plane and x i-1 Angle between the axes, θi For curve o i-1 o i The corresponding central angle, θ i =κ i l i , Φ i =θ i -α i ;
[0265] Step S3.1.3: According to the matrix transformation, the position R of section i relative to the global coordinate system i And the global position coordinate P i It can be expressed as:
[0266]
[0267] The end position of the continuum robot can be obtained through the above formula;
[0268] T i Represents the homogeneous transformation matrix between the section i coordinate system and the global coordinate system;
[0269] T i-1 Represents the homogeneous transformation matrix between the section i-1 coordinate system and the global coordinate system;
[0270] N represents the number of segments into which the center line of the continuum robot is evenly divided.
[0271] Step S3.2: Detect the number of feature points. If the number is greater than a set threshold, it is selected as a key frame.
[0272] Step S3.3: Based on the terminal position obtained by the optical fiber, the feature points are subjected to motion consistency check to eliminate outliers, including the following steps:
[0273] Step S3.3.1. Calculate the basic matrix F based on the end-point pose R, translation vector t, and the camera's intrinsic parameter matrix K. The calculation formula is:
[0274]
[0275] Superscript symbol Represents the antisymmetric symbol, converting the vector t into its corresponding antisymmetric matrix;
[0276] Step S3.3.2: Based on the basic matrix F, calculate the distance D from each feature point pair p1 and p2 to the epipolar line. The calculation formula is:
[0277]
[0278]
[0279] X, Y, and z represent the coordinates of the feature point p1 in three-dimensional space;
[0280] u1 and v1 represent the coordinates of feature point p1 in the normalized coordinate system;
[0281] u2 and v2 represent the coordinates of feature point p2 in the normalized coordinate system;
[0282] Step S3.3.3: Based on the calculated relationship between the distance D and the set threshold, if the distance D is less than the set threshold, the point is determined to be an inlier and added to the inlier set;
[0283] Step S3.4, performing triangulation based on the terminal pose obtained from the feature points and the optical fiber to establish an initial map, including the following steps;
[0284] Step S3.4.1: Perform triangulation based on the terminal position R and translation vector t calculated by the fiber optic sensor and the interior point set obtained in the above steps. The calculation formula is:
[0285]
[0286] By solving the above equation, the depth corresponding to the feature point p2 can be obtained, and then the equation is used:
[0287] s1p1=s2Rp2+t
[0288] s1 represents the depth value corresponding to the feature point p1;
[0289] s2 represents the depth value corresponding to the feature point p2;
[0290] Calculate the depth corresponding to the feature point p2.
[0291] The step S4 comprises the following steps:
[0292] Step S4.1: Divide the monocular image into N×M rectangular blocks according to the input image;
[0293] Step S4.2: For each matrix block, calculate the distance D from the feature point to the corresponding epipolar line, including the following steps:
[0294] Step S4.2.1: Filter the inliers according to RANSAC and remove the outliers. Then calculate the basic matrix based on the inliers. The calculation equation is:
[0295]
[0296] By solving the above equations, we can obtain the basic matrix;
[0297] Step S4.2.2: Calculate the distance D from the feature point to the corresponding epipolar line based on the matched feature point pair. The calculation formula is:
[0298]
[0299] Step S4.3: Calculate the ratio of outliers in each rectangular block based on the relationship between the distance D and the set threshold. s , the calculation formula is:
[0300]
[0301] Among them, N i is the number of feature point pairs in the small rectangular block, N o is the number of outliers;
[0302] Step S4.4: If r s If the value is greater than the set threshold, the small rectangular block is judged to be a dynamic soft tissue part, all feature points in the rectangular block are removed, and the corresponding map points are removed.
[0303] The step S5 comprises the following steps:
[0304] Step S5.1: Calculate the pose of the current frame based on the known 3D map point coordinates and 2D image coordinates, and optimize it, including the following steps:
[0305] Step S5.1.1: Based on the 3D map points obtained by system initialization and the corresponding 2D feature point pairs in the image coordinate system, the camera pose is solved by epipolar constraints. The calculation equation is:
[0306]
[0307] By solving the above equations, we get the basic matrix. Then, we use singular value decomposition (SVD) to recover the camera’s running state R,t;
[0308] Step S5.1.2: By establishing the 3D-2D reprojection error, constructing the optimization objective function, and optimizing the variable as the pose of the current frame, a more accurate camera pose is obtained;
[0309] Step S5.2: If the number of feature points in the current frame is less than the set threshold or the calculation fails through the above steps, the pose calculation is performed using the data from the optical fiber sensor;
[0310] Step S5.3: Establish a visual fiber bundle adjustment optimization formula to optimize the camera pose and map points, including the following steps:
[0311] Step S5.3.1. Establish the loss function C of the visual fiber:
[0312]
[0313] in,
[0314]
[0315] Among them, C is the total loss function, C k is the reprojection error, e a 、e b are the reprojection errors of the map points on key frames a and b, ρ is the robust kernel function, and e a,b is the homogeneous transformation error between key frames a and b;
[0316] Ω a,b is the covariance matrix of key frames a and b, i and j represent the image frames between key frames a and b, Ω a,i represents the covariance matrix between key frame a and image frame i, Ω b,i represents the covariance matrix between key frame b and image frame j;
[0317] k represents the matching set from key frame a to key frame b, including all feature points and 3D map points corresponding to the feature points.
[0318] Step S5.3.2: Use the Gauss-Newton method to iteratively solve the loss function, where the variables to be solved are the camera pose and map points.
[0319] The present invention also provides corresponding
[0320] According to the present invention, an in vivo SLAM method based on the fusion of an optical fiber strain sensor and a monocular camera includes any one or more of the following modules:
[0321] The visual fiber spatiotemporal alignment, denoted as module M1, specifically: in an offline state, based on the monocular camera image and fiber strain values, the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system is estimated through hand-eye calibration; the monocular camera and the fiber sensor are clock-source aligned through hardware equipment, followed by timestamp alignment; the scale of the monocular camera is determined by observing objects at a known distance with the monocular camera;
[0322] The data preprocessing module, denoted as module M2, specifically performs preprocessing based on the environmental images obtained by the continuum robot during the surgery, including feature extraction and feature tracking. At the same time, the strain information of the continuum robot during the surgery is obtained through the optical fiber strain sensor and preprocessed, and the curvature curve and torsion curve of the continuum robot centerline are obtained through the measurement algorithm.
[0323] System initialization, denoted as module M3, specifically: Based on the curvature curve and torsion curve obtained from the optical fiber strain, the shape reconstruction algorithm is used to obtain the end-point pose of the continuum robot; the number of feature points in the current frame is detected, and frames with a value greater than a set threshold are selected as key frames; based on the end-point pose obtained from the optical fiber, the feature points are checked for motion consistency and outliers are removed; based on the feature points and the end-point pose obtained from the optical fiber, triangulation is performed to establish an initial map;
[0324] Soft tissue motion deformation elimination, denoted as module M4, specifically: according to the input image, the monocular image is divided into N×M rectangular blocks; the inliers are screened according to RANSAC, and the basic matrix is calculated based on the inliers; based on the matched feature point pairs, the distance D from the feature point to the corresponding epipolar line is calculated; based on the relationship between the distance D and the set threshold, the proportion of outliers in each rectangular block r is calculated s If r s If the value is greater than the set threshold, the rectangular block is judged to be a dynamic soft tissue part, the feature points in the rectangular block are removed, and the map points corresponding to the feature points are removed;
[0325] Pose calculation and optimization, denoted as module M5, specifically: based on the known 3D feature point coordinates and 2D image coordinates, calculate the pose of the current frame and optimize it; if the current frame tracking fails, use the data of the fiber optic sensor to calculate the current frame pose; establish a visual fiber beam adjustment optimization formula to optimize the camera pose and map points.
[0326] The module M1 shown includes the following modules:
[0327] Module M1.1: Use hardware devices to align the clock sources of the monocular camera and the fiber optic sensor, and then align the timestamps. This module includes the following modules:
[0328] Module M1.1.1: Synchronize the timing of the two sensors through hardware, synchronizing the monocular camera and fiber optic sensor with the clock source;
[0329] Module M1.1.2: Using the camera as the core sensor, each time camera data is received, the current camera data is used as the time point to be interpolated. The fiber optic sensor data before and after the time point is found, and then an appropriate interpolation method is selected to interpolate the data to obtain the fiber optic sensor data at the corresponding time point.
[0330] Module M1.2: Estimates the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system (body coordinate system) in an offline state. It includes the following modules:
[0331] Module M1.2.1: Determine the intrinsic parameters of the monocular camera according to Zhang Zhengyou calibration method;
[0332] Module M1.2.2: Solving the homogeneous transformation matrix X between the monocular camera and the fiber optic sensor can be considered a hand-eye calibration problem. In a pre-set trajectory, the coordinate transformation matrix A between the two camera frames at time i and j is determined by the monocular camera, as well as the coordinate transformation matrix B at time i and time j obtained by the fiber optic sensor corresponding to these two camera frames. According to the hand-eye equation:
[0333] AX=XB
[0334] Solving X yields the homogeneous transformation matrix between the monocular camera and the fiber optic sensor.
[0335] The module M2 includes the following modules:
[0336] Module M2.1: Detects the feature points of the current frame, including the following modules:
[0337] Module M2.1.1: Use Soble to calculate the gradient values of the monocular image in the X and Y directions, denoted as I x , I y ;
[0338] Module M2.1.2: Calculate I x 2 , I y 2 , I x *I y , find the four element values of M, where the expression of M is:
[0339]
[0340] Module M2.1.3: Perform Gaussian smoothing on the four elements of M to obtain a new M. The discrete two-dimensional zero-mean Gaussian function Gauss is:
[0341]
[0342] x and y represent variables;
[0343] σ represents variance
[0344] Module M2.1.4: Use M to calculate the corner quantity cim (i.e. corner response R) of each pixel:
[0345]
[0346] Module M2.1.4: Based on the value of the matrix cim, if cim is greater than a certain threshold and cim is a local maximum in a certain area, then the point is considered a corner point, that is, a feature point; otherwise, the point is not considered a feature point;
[0347] Module M2.2: Estimates the position of feature points in the current frame in the next frame using the Lukas-Kanade optical flow method. This module includes the following:
[0348] Module M2.2.1: Create image pyramids for monocular images k and k+1, which are:
[0349] k represents the kth image frame;
[0350] I L represents the image pyramid built on image frame k;
[0351] J L represents the image pyramid built on image frame k+1;
[0352] L represents the number of layers of the pyramid, L = 0 represents the image of the 0th layer, L = L m Represents the image of the last layer;
[0353] L m Indicates the number of layers in the image pyramid.
[0354] Module M2.2.2: Initialize the displacement estimates on the pyramid to 0,
[0355] g represents the L m The displacement estimator of the layer image pyramid, that is, the initial value of the optical flow calculation;
[0356] Indicates the L m The displacement estimate of the layer image pyramid in the x-axis direction, that is, the initial value of the optical flow calculation in the x-axis direction;
[0357] Indicates the L m The displacement estimate of the layer image pyramid in the y-axis direction, that is, the initial value of the optical flow calculation in the y-axis direction.
[0358] Module M2.2.3: Make L = L m , calculate the feature point u in image I L Position in I L Partial derivatives of x and y, calculate the spatial derivative matrix G:
[0359]
[0360] Initialize LK iteration:
[0361] p x Represents image I L The x-axis coordinate of the feature point u on ;
[0362] p y Represents image I L The y-axis coordinate of the feature point u on ;
[0363] w x 、w y The size of the rectangular window on the image is set respectively (2*w x +1)、(2*w y +1);
[0364] I x (x, y) represents the partial derivative of each pixel on image I with respect to x;
[0365] I y (x, y) represents the partial derivative of y for each pixel on image I;
[0366] Represents the initial optical flow estimate.
[0367] Module M2.2.4, starting from k=1, calculate the image pixel difference δI k :
[0368]
[0369] δI k Indicates the image pixel difference;
[0370] I(x, y) represents the grayscale value of the corresponding position of the feature point in the image frame k;
[0371] J(x, y) represents the grayscale value of the corresponding position of the feature point in image frame k+1;
[0372] Represents the optical flow estimation value of the image pyramid of the k-1th layer in the x-axis direction;
[0373] Represents the optical flow estimation value of the k-1th layer of the image pyramid in the y-axis direction.
[0374] Calculate image mismatch vector
[0375]
[0376] Calculate optical flow: Calculate the cumulative iteration amount: When k is greater than K or When it is less than the set threshold, module M2.2.4 terminates the loop and obtains the optical flow estimation of the Lth layer as
[0377] Represents the optical flow estimate of the k-th layer of the image pyramid;
[0378] Represents the optical flow estimate of the k-1th layer of the image pyramid;
[0379] Indicates the number of optical flow iterations for each layer of the image pyramid;
[0380] d L Represents the final optical flow of the L-th level image pyramid.
[0381] Module M2.2.5, based on Module M2.2.4, calculates the preliminary estimate of the L-1 layer as Repeat modules M2.2.3 and M2.2.4 until m = 0, and finally obtain the feature point at position v = u + d in image k + 1;
[0382] u represents the feature point in image I;
[0383] v represents the feature point corresponding to the feature point u in image J;
[0384] Module M2.3, which uses optical fiber strain sensors to obtain the strain information of the continuum robot at the current moment, includes the following modules:
[0385] Module M2.3.1. Place the continuum robot in an environment with the same temperature as the working environment and use a spectrometer to measure the reflected wavelength λ0 when the robot is not deformed.
[0386] Module M2.3.2: Measure the peak value of the reflected wavelength λ at the current moment k when the continuum robot is deformed. k ;
[0387] Module M2.3.3, based on the mathematical relationship between fiber optic sensors and strain:
[0388]
[0389] Solve to obtain the strain information of the continuum robot at time k; where ε represents the strain value, Δλ = λ k -λ0,p ε is the optical fiber strain sensitivity coefficient, which is a constant;
[0390] Module M2.4: Obtain the curvature and torsion curves of the centerline of the continuum robot through measurement algorithms:
[0391] Module M2.4.1. In order to calculate the end pose of the continuum robot, strain information at multiple locations must be measured. Since strain is one-dimensional information, in order to measure the three-dimensional information of curvature and torsion, multiple sensors are required to measure the strain at the same axial position simultaneously and then calculate it. Therefore, the strain is measured using Figure 2 The distributed fiber Bragg grating sensing network shown in Figure 1 is a network in which three optical fibers are embedded in a continuum robot, and Bragg gratings are written into each fiber at equal distances. Figure 7 As shown, the three gratings on the same cross section are distributed in an equilateral triangle, and the center line of the continuum robot is located at the center of the equilateral triangle;
[0392] Module M2.4.2, the grating combination located at the same cross section divides the continuum robot into N small segments. According to the assumption of constant curvature and constant torsion of the segments, and the cross section of each segment remains constant during the bending process, the parametric equation of the center line s i (t) can be expressed as:
[0393]
[0394]
[0395] Among them, l i represents the arc length of the center line of the i-th segment, and its length can be expressed as:
[0396]
[0397]
[0398]
[0399] They represent the theoretical calculated lengths of the i-th section of the three optical fibers A, B, and C respectively; Figure 7 As shown, d A,i d B,i d C,i Respectively represent the lengths of the three gratings A, B, and C from the center line on the same cross section;
[0400] β C,i =2β B,i =240°;
[0401] On the same cross section, β A,i represents the azimuth angle of the grating of fiber A, β B,i β represents the azimuth angle of the grating of fiber B relative to the grating of fiber A. C,i Indicates the azimuth angle of the grating of fiber C relative to the grating of fiber A.
[0402] The grating can measure the strain at the grating, so the actual lengths of the three optical fibers A, B, and C are
[0403]
[0404]
[0405]
[0406] where ε A,i , ε B,i , ε C,i They represent the strains measured by the corresponding gratings of optical fibers A, B, and C respectively; according to the equality of the calculated and actual lengths of the optical fibers, the parameter a is obtained by solving i , b i , α i Finally, the curvature κ of the center line of the i-th segment is obtained i and torsion τ i :
[0407]
[0408]
[0409] Module M2.4.3, from the above modules, we can get a few sample points, namely the curvature and torsion of the grating measurement points. According to the cubic B-spline interpolation, {κ i s i} and {τ i s i} to interpolate, the interpolation basis function p(t) is:
[0410]
[0411] Interpolation results in a continuous curvature arc length curve κ(s) and torsion arc length curve τ(s).
[0412] κ i represents the curvature of the curve of the center line of the i-th segment;
[0413] s i The arc length of the curve representing the center line of segment i;
[0414] τ i represents the curve torsion of the center line of segment i;
[0415] t represents the normalization parameter;
[0416] p0, p1, p2, and p3 represent the control points of the cubic B-spline curve;
[0417] s represents the arc length parameter.
[0418] The module M3 includes the following modules:
[0419] Module M3.1, based on the curvature arc length curve κ(s) and the torsion arc length curve τ(s), obtains the end pose of the continuum robot through the shape reconstruction algorithm, including the following modules:
[0420] Module M3.1.1, discretize the curvature arc length curve κ(s) and torsion arc length curve τ(s) obtained from module M2 to obtain the sample point sets of curvature and torsion respectively: {κ(s i ), τ(s i )}, i = 1, 2, ..., ∞, dividing the continuum robot into N segments;
[0421] Module M3.1.2: Substitute the curvature and torsion into the shape reconstruction algorithm to obtain the homogeneous coordinate transformation matrix expression of the upper and lower sections for the i-th segment:
[0422]
[0423] Represents the homogeneous transformation matrix from the coordinate system of section i to the coordinate system of section i-1;
[0424] R represents the rotation matrix;
[0425] P represents the translation vector;
[0426] o i-1 represents the coordinate origin of section i-1;
[0427] o i represents the coordinate origin of section i;
[0428] l i represents the length of the centerline of the continuum robot in segment i;
[0429] Where c represents cosine and s represents sin. i For curve o i-1 o i The curvature, α i The bending plane and x i-1 Angle between the axes, θ i For curve o i-1 o i The corresponding central angle, θ i =κ i l i , Φ i =θ i -α i ;
[0430] Module M3.1.3, according to the matrix transformation, the position R of section i relative to the global coordinate system i And the global position coordinate P i It can be expressed as:
[0431]
[0432] The end position of the continuum robot can be obtained through the above formula;
[0433] T i Represents the homogeneous transformation matrix between the section i coordinate system and the global coordinate system;
[0434] T i-1 Represents the homogeneous transformation matrix between the section i-1 coordinate system and the global coordinate system;
[0435] N represents the number of segments into which the center line of the continuum robot is evenly divided.
[0436] Module M3.2: Detect the number of feature points. If the number is greater than the set threshold, it will be selected as a key frame.
[0437] Module M3.3, based on the terminal position obtained by the optical fiber, performs motion consistency check on the feature points and removes outliers. It includes the following modules:
[0438] Module M3.3.1, based on the end-point pose R and translation vector t and the camera's intrinsic parameter matrix K, calculate the basic matrix F, the calculation formula is:
[0439]
[0440] Superscript symbol Represents the antisymmetric symbol, converting the vector t into its corresponding antisymmetric matrix;
[0441] Module M3.3.2: Based on the basic matrix F, calculate the distance D from each feature point pair p1 and p2 to the epipolar line. The calculation formula is:
[0442]
[0443] p1=[u1 v1 1] T , p2=[u2 v2 1] T ;
[0444] x, Y, and Z represent the coordinates of the feature point p1 in three-dimensional space;
[0445] u1 and v1 represent the coordinates of feature point p1 in the normalized coordinate system;
[0446] u2 and v2 represent the coordinates of feature point p2 in the normalized coordinate system;
[0447] Module M3.3.3: Based on the calculated relationship between the distance D and the set threshold, if the distance D is less than the set threshold, it is determined to be an inlier and added to the inlier set;
[0448] Module M3.4, based on the terminal pose obtained from the feature points and optical fibers, performs triangulation and establishes an initial map, including the following modules;
[0449] Module M3.4.1, based on the terminal position R and translation vector t calculated by the fiber optic sensor, and the internal point set obtained by the above module, triangulate the solution. The calculation formula is:
[0450]
[0451] By solving the above equation, the depth corresponding to the feature point p2 can be obtained, and then the equation is used:
[0452] s1p1=s2Rp2+t
[0453] s1 represents the depth value corresponding to the feature point p1;
[0454] s2 represents the depth value corresponding to the feature point p2;
[0455] Calculate the depth corresponding to the feature point p2.
[0456] The module M4 includes the following modules:
[0457] Module M4.1: Divide the monocular image into N×M rectangular blocks based on the input image;
[0458] Module M4.2: For each matrix block, calculate the distance D from the feature point to the corresponding epipolar line, including the following modules:
[0459] Module M4.2.1, filter the inliers according to RANSAC, remove the outliers, and then calculate the basic matrix based on the inliers. The calculation equation is:
[0460]
[0461] By solving the above equations, we can obtain the basic matrix;
[0462] Module M4.2.2: Calculate the distance D from the feature point to the corresponding epipolar line based on the matched feature point pair. The calculation formula is:
[0463]
[0464] Module M4.3, based on the relationship between the distance D and the set threshold, calculate the proportion of outliers in each rectangular block r s , the calculation formula is:
[0465]
[0466] Among them, N i is the number of feature point pairs in the small rectangular block, N o is the number of outliers;
[0467] Module M4.4, if r s If the value is greater than the set threshold, the small rectangular block is judged to be a dynamic soft tissue part, all feature points in the rectangular block are removed, and the corresponding map points are removed.
[0468] The module M5 includes the following modules:
[0469] Module M5.1 calculates the pose of the current frame based on the known 3D map point coordinates and 2D image coordinates and performs optimization. It includes the following modules:
[0470] Module M5.1.1, based on the 3D map points obtained by system initialization and the corresponding 2D feature point pairs in the image coordinate system, solve the camera pose through epipolar constraints. The calculation equation is:
[0471]
[0472] By solving the above equations, we get the basic matrix. Then, we use singular value decomposition (SVD) to recover the camera’s running state R,t;
[0473] Module M5.1.2: By establishing the 3D-2D reprojection error, constructing the optimization objective function, and optimizing the pose of the current frame as the variable, a more accurate camera pose is obtained;
[0474] Module M5.2: If the number of feature points in the current frame is less than the set threshold or the calculation by the above module fails, the pose calculation is performed using the data from the fiber optic sensor;
[0475] Module M5.3, establishes the visual fiber bundle adjustment optimization formula to optimize the camera pose and map points, including the following modules:
[0476] Module M5.3.1. Establish the loss function C of the visual fiber:
[0477]
[0478] in,
[0479]
[0480] Among them, C is the total loss function, C k is the reprojection error, e a 、e bare the reprojection errors of the map points on key frames a and b, ρ is the robust kernel function, and e a,b is the homogeneous transformation error between key frames a and b;
[0481] Ω a,b is the covariance matrix of key frames a and b, i and j represent the image frames between key frames a and b, Ω a,i represents the covariance matrix between key frame a and image frame i, Ω b,i represents the covariance matrix between key frame b and image frame j;
[0482] k represents the matching set from key frame a to key frame b, including all feature points and 3D map points corresponding to the feature points.
[0483] Module M5.3.2: Use the Gauss-Newton method to iteratively solve the loss function, where the variables to be solved are the camera pose and map points.
[0484] Those skilled in the art will appreciate that, in addition to implementing the system, device, and various modules provided by the present invention in purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, embedded microcontrollers, and the like by logically programming the method steps. Therefore, the system, device, and various modules provided by the present invention can be considered a hardware component, and the modules included therein for implementing various programs can also be considered structures within the hardware component; the modules for implementing various functions can also be considered both software programs for implementing the method and structures within the hardware component.
[0485] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the in-vivo SLAM method based on the fusion of an optical fiber strain sensor and a monocular camera.
[0486] The present invention also provides a surgical robot comprising the in-vivo SLAM system based on the fusion of an optical fiber strain sensor and a monocular camera, or comprising the computer-readable storage medium storing a computer program.
[0487] The above describes specific embodiments of the present invention. It should be understood that the present invention is not limited to the specific embodiments described above, and those skilled in the art may make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. The embodiments of this application and the features in the embodiments may be combined with each other in any manner unless there is a conflict.
Claims
1. An in vivo SLAM method based on the fusion of optical fiber strain sensor and monocular camera, characterized in that: The steps include: Step S1, visual fiber spatiotemporal alignment step: align the clock source and timestamp of the monocular camera and the fiber sensor; estimate the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system; determine the scale of the monocular camera; Step S2, data preprocessing step: extracting and tracking features of the image acquired by the monocular camera; obtaining the curvature curve and torsion curve of the center line of the continuum robot through the measurement data of the optical fiber strain sensor; Step S3, system initialization step: obtaining the terminal posture of the continuum robot according to the curvature curve and the torsion curve; performing triangulation according to the terminal posture obtained from the feature points and the optical fiber data to establish an initial map; Step S4, soft tissue motion deformation elimination step: divide the monocular image into rectangular blocks, calculate the proportion of outliers in each rectangular block , remove the feature points of dynamic soft tissue and the map points corresponding to the feature points; Step S5, posture calculation and optimization step: according to the monocular image, calculate and optimize the posture of the current frame; according to the visual fiber loss function, perform global optimization on the camera posture and map points.
2. The in vivo SLAM method based on the fusion of optical fiber strain sensor and monocular camera according to claim 1 is characterized in that: In step S2, the step of performing feature extraction and feature tracking includes detecting and estimating the position of the feature points of the current frame in the next frame; In step S3, the terminal posture of the continuum robot is obtained through a shape reconstruction algorithm, the number of feature points is detected, and a key frame is selected if the number is greater than a set threshold. The motion consistency of the feature points is checked according to the terminal posture obtained by the optical fiber, and outliers are removed; In step S4, for each matrix block, the feature points to The distance to the epipolar line , according to the distance Relationship with the set threshold, calculate the proportion of outliers in each rectangular block ; In step S5, the pose of the current frame is calculated and optimized based on the known 3D map point coordinates and 2D image coordinates. If the feature points of the current frame are less than the set threshold or the calculation fails through the above steps, the pose is calculated through the data of the optical fiber sensor, and a visual optical fiber beam adjustment optimization formula is established to optimize the camera pose and map points.
3. The in vivo SLAM method based on the fusion of optical fiber strain sensor and monocular camera according to claim 1, characterized in that: In step 2, the strain information of the continuum robot at the current moment is obtained through the optical fiber strain sensor, which is recorded as step 2.3 and includes the following steps: Step S2.3.1: Place the continuum robot in an environment with the same temperature as the working environment, and measure the reflection wavelength when it is not deformed by using a spectrometer. ; Step S2.3.2: Measure the current time When the continuum robot is deformed, the peak value of the reflected wavelength is measured by the spectrometer ; Step S2.3.3, according to the mathematical relationship between the optical fiber sensor and the strain: Solve to get the time Strain information of the continuum robot; among them, represents the strain value, , is the optical fiber strain sensitivity coefficient, which is a constant; In step 2, the curvature curve and the torsion curve of the center line of the continuum robot are obtained by the measurement algorithm, which is recorded as step 2.4 and includes the following steps: Step S2.4.1: embed three optical fibers in the continuum robot, write Bragg gratings into each optical fiber at equal distances, and the three gratings are distributed in an equilateral triangle on the same cross section, and the center line of the continuum robot is located at the center of the equilateral triangle; Step S2.4.2: The grating combination located on the same cross section divides the continuum robot into According to the assumption of constant curvature and constant torsion, and the cross section of each segment remains constant during the bending process, the parametric equation of the center line is It is expressed as: in, Indicates The arc length of the segment centerline, whose length is expressed as: , They represent the theoretical calculated lengths of the i-th segment of the three optical fibers A, B, and C respectively; , , Respectively represent the lengths of the three gratings A, B, and C from the center line on the same cross section; ; On the same cross section, represents the azimuth angle of the grating of fiber A, It indicates the azimuth angle of the grating of fiber B relative to the grating of fiber A. Indicates the azimuth angle of the C fiber grating relative to the A fiber grating; The strain at the grating is measured by the grating, and the actual lengths of the three optical fibers A, B, and C are , , : in , , Respectively represent the strains measured by the corresponding gratings of optical fibers A, B, and C; according to the equality of the calculated length and the actual length of the optical fiber, the parameters are solved and obtained , , Finally, we get Curve curvature of the segment centerline and torsion : ; Step S2.4.3: and Interpolate to get a continuous curvature arc length curve and the torsion arc length curve ; Indicates Curve curvature of the segment centerline; Indicates The arc length of the curve of the segment centerline; Indicates Curve torsion of the segment centerline; represents the arc length parameter; In step S3, according to the curvature arc length curve and the torsion arc length curve , through the shape reconstruction algorithm, the end position of the continuum robot is obtained, which is recorded as step 3.1, including the following steps: Step S3.1.1: Curvature arc length curve obtained in step S2 and the torsion arc length curve , discretize and obtain the sample point sets of curvature and torsion respectively: , , the continuum robot is divided into part; Step S3.1.2, substitute the curvature and torsion into the shape reconstruction algorithm to obtain The homogeneous coordinate transformation matrix expression of the upper and lower sections is: Representation of cross section Coordinate System to Section Homogeneous transformation matrix of coordinate system; represents the rotation matrix; represents the translation vector; Representation of cross section The coordinate origin of Representation of cross section The coordinate origin of Indicates The length of the centerline of the segment's continuum robot; in, express , express , For curve The curvature of The curved plane and The angle of the axis, For curve The corresponding central angle, , ; Step S3.1.3: According to the matrix transformation, the cross section Pose relative to the global coordinate system And the global position coordinates It is expressed as: The end position of the continuum robot can be obtained through the above formula; Representation of cross section Homogeneous transformation matrix between coordinate system and global coordinate system; Representation of cross section Homogeneous transformation matrix between coordinate system and global coordinate system; Describes the number of segments into which the center line of a continuum robot is evenly divided.
4. The in vivo SLAM method based on the fusion of optical fiber strain sensor and monocular camera according to claim 1, characterized in that: In step 5, a visual fiber beam adjustment optimization formula is established to optimize the camera posture and map points, which is recorded as step S5.3 and includes the following steps: Step S5.3.
1. Establish the loss function of the visual fiber : in, in, is the total loss function, is the reprojection error, , Keyframes , The reprojection error of the map points on is the robust kernel function, Is a keyframe and Homogeneous transformation error of ; Is a keyframe and The covariance matrix of and Represents a key frame , The image frames between Represents a key frame and image frames The covariance matrix between Represents a key frame and image frames The covariance matrix between ; Indicates from keyframe arrive The matching set includes all feature points and the 3D map points corresponding to the feature points; Step S5.3.2: Use the Gauss-Newton method to iteratively solve the loss function, where the variables to be solved are the camera's position and map points.
5. An in vivo SLAM system based on the fusion of optical fiber strain sensor and monocular camera, characterized in that: The steps include: Module M1, visual fiber spatiotemporal alignment steps: align the clock source and timestamp of the monocular camera and the fiber sensor; estimate the homogeneous transformation matrix between the camera coordinate system and the fiber coordinate system; determine the scale of the monocular camera; Module M2, data preprocessing step: feature extraction and feature tracking of the image acquired by the monocular camera; obtaining the curvature curve and torsion curve of the center line of the continuum robot through the measurement data of the optical fiber strain sensor; Module M3, system initialization step: obtaining the terminal posture of the continuum robot according to the curvature curve and the torsion curve; performing triangulation according to the terminal posture obtained from the feature points and the optical fiber data to establish an initial map; Module M4, soft tissue motion deformation elimination step: divide the monocular image into rectangular blocks, calculate the proportion of outliers in each rectangular block , remove the feature points of dynamic soft tissue and the map points corresponding to the feature points; Module M5, pose calculation and optimization step: Calculate and optimize the pose of the current frame based on the monocular image; According to the visual fiber loss function, the camera pose and map points are globally optimized.
6. The in vivo SLAM system based on the fusion of optical fiber strain sensor and monocular camera according to claim 5, characterized in that: In the module M2, the step of performing feature extraction and feature tracking includes detecting and estimating the position of the feature points of the current frame in the next frame; In the module M3, the terminal posture of the continuum robot is obtained through the shape reconstruction algorithm, the number of feature points is detected, and the key frame is selected if the number is greater than the set threshold. According to the terminal posture obtained by the optical fiber, the motion consistency of the feature points is checked to remove outliers; In the module M4, for each matrix block, the distance from the feature point to the corresponding epipolar line is calculated. , according to the distance Relationship with the set threshold, calculate the proportion of outliers in each rectangular block ; In the module M5, the pose of the current frame is calculated and optimized based on the known 3D map point coordinates and 2D image coordinates. If the feature points of the current frame are less than the set threshold or the calculation fails through the above steps, the pose is calculated through the data of the optical fiber sensor, and the visual optical fiber beam adjustment optimization formula is established to optimize the camera pose and map points.
7. The in vivo SLAM system based on the fusion of optical fiber strain sensor and monocular camera according to claim 5, characterized in that: In step 2, the strain information of the continuum robot at the current moment is obtained through the optical fiber strain sensor, which is recorded as step 2.3 and includes the following steps: Module M2.3.
1. Place the continuum robot in an environment with the same temperature as the working environment and use a spectrometer to measure the reflected wavelength when it is not deformed. ; Module M2.3.2, measuring the current moment When the continuum robot is deformed, the peak value of the reflected wavelength is measured by the spectrometer ; Module M2.3.3, based on the mathematical relationship between optical fiber sensor and strain: Solve to get the time Strain information of the continuum robot; among them, represents the strain value, , is the optical fiber strain sensitivity coefficient, which is a constant; In step 2, the curvature curve and the torsion curve of the center line of the continuum robot are obtained by the measurement algorithm, which is recorded as step 2.4 and includes the following steps: Module M2.4.1 embeds three optical fibers in the continuum robot, and writes Bragg gratings on each optical fiber at equal distances. The three gratings are distributed in an equilateral triangle on the same cross section, and the center line of the continuum robot is located at the center of the equilateral triangle; Module M2.4.2: The grating combination located on the same cross section divides the continuum robot into According to the assumption of constant curvature and constant torsion, and the cross section of each segment remains constant during the bending process, the parametric equation of the center line is It is expressed as: in, Indicates The arc length of the segment centerline, whose length is expressed as: , They represent the theoretical calculated lengths of the i-th segment of the three optical fibers A, B, and C respectively; , , Respectively represent the lengths of the three gratings A, B, and C from the center line on the same cross section; ; On the same cross section, represents the azimuth angle of the grating of fiber A, It indicates the azimuth angle of the grating of fiber B relative to the grating of fiber A. Indicates the azimuth angle of the C fiber grating relative to the A fiber grating; The strain at the grating is measured by the grating, and the actual lengths of the three optical fibers A, B, and C are , , : in , , Respectively represent the strains measured by the corresponding gratings of optical fibers A, B, and C; according to the equality of the calculated length and the actual length of the optical fiber, the parameters are solved and obtained , , Finally, we get Curve curvature of the segment centerline and torsion : ; Module M2.4.3, and Interpolate to get a continuous curvature arc length curve and the torsion arc length curve ; Indicates Curve curvature of the segment centerline; Indicates The arc length of the curve of the segment centerline; Indicates Curve torsion of the segment centerline; represents the arc length parameter; In the module M3, according to the curvature arc length curve and the torsion arc length curve , through the shape reconstruction algorithm, the end position of the continuum robot is obtained, which is recorded as step 3.1, including the following steps: Module M3.1.1, curvature arc length curve obtained from module M2 and the torsion arc length curve , discretize and obtain the sample point sets of curvature and torsion respectively: , , the continuum robot is divided into part; Module M3.1.2, Substitute the curvature and torsion into the shape reconstruction algorithm and obtain The homogeneous coordinate transformation matrix expression of the upper and lower sections is: Representation of cross section Coordinate System to Section Homogeneous transformation matrix of coordinate system; represents the rotation matrix; represents the translation vector; Representation of cross section The coordinate origin of Representation of cross section The coordinate origin of Indicates The length of the centerline of the segment's continuum robot; in, express , express , For curve The curvature of The curved plane and The angle of the axis, For curve The corresponding central angle, , ; Module M3.1.3, according to the matrix transformation, the cross section Pose relative to the global coordinate system And the global position coordinates It is expressed as: The end position of the continuum robot can be obtained through the above formula; Representation of cross section Homogeneous transformation matrix between coordinate system and global coordinate system; Representation of cross section Homogeneous transformation matrix between coordinate system and global coordinate system; Describes the number of segments into which the center line of a continuum robot is evenly divided.
8. The in vivo SLAM system based on the fusion of optical fiber strain sensor and monocular camera according to claim 5, characterized in that: In step 5, a visual fiber beam adjustment optimization formula is established to optimize the camera pose and map points, which is recorded as module M5.3 and includes the following steps: Module M5.3.
1. Establishing the loss function of visual fiber : in, in, is the total loss function, is the reprojection error, , Keyframes , The reprojection error of the map points on is the robust kernel function, Is a keyframe and Homogeneous transformation error of ; Is a keyframe and The covariance matrix of and Represents a key frame , The image frames between Represents a key frame and image frames The covariance matrix between Represents a key frame and image frames The covariance matrix between ; Indicates from keyframe arrive The matching set includes all feature points and the 3D map points corresponding to the feature points; Module M5.3.2: Use the Gauss-Newton method to iteratively solve the loss function, where the variables to be solved are the camera's position and map points.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the in-vivo SLAM method based on the fusion of an optical fiber strain sensor and a monocular camera according to any one of claims 1 to 4 are implemented.
10. A surgical robot, characterized in that: An in-vivo SLAM system based on the fusion of an optical fiber strain sensor and a monocular camera comprising any one of claims 5 to 8, or a computer-readable storage medium storing a computer program comprising claim 9.
Citation Information
Cited By
Arthroscopic surgical instrument pose real-time tracking system
CN122229565A
