【三维重建】捆绑调整

ops/2024/11/15 0:41:54/

捆绑调整的目的是通过重构的点计算重投影误差,利用最优化方法是重投影误差最小。这是一个典型的非线性最小二乘问题,利用高斯-牛顿法进行优化(高斯-牛顿法原理参考https://blog.csdn.net/holle_world_ldx/article/details/138225785)

在这里插入图片描述

求雅可比矩阵

一、相机投影过程

1、世界坐标系到相机坐标系的变换

[ x c y c z c ] = R X + t = [ r 0 r 1 r 2 r 3 r 4 r 5 r 6 r 7 r 8 ] [ X Y Z ] + [ t 0 t 1 t 2 ] \begin{bmatrix} x_c\\ y_c\\ z_c \end{bmatrix}=RX+t=\begin{bmatrix}r_0 & r_1 &r_2 \\ r_3 & r_4 & r_5 \\ r_6 &r_7 &r_8 \end{bmatrix} \begin{bmatrix}X\\Y\\Z \end{bmatrix}+\begin{bmatrix}t_0\\t_1\\t_2\end{bmatrix} xcyczc =RX+t= r0r3r6r1r4r7r2r5r8 XYZ + t0t1t2

2、归一化像平面

x c = r 0 X + r 1 Y + r 2 Z + t 0 y c = r 3 X + r 4 Y + r 5 Z + t 1 z c = r 6 X + r 7 Y + r 8 Z + t 2 [ x y ] = [ x c z c y c z c ] \begin{aligned} &x_c = r_0X +r_1Y+r_2Z +t_0 \\ &y_c = r_3X +r_4Y+r_5Z +t_1 \\ &z_c = r_6X +r_7Y+r_8Z +t_2 \\ &\begin{bmatrix}x\\y\end{bmatrix}=\begin{bmatrix} \frac{x_c}{z_c}\\\frac{y_c}{z_c}\end{bmatrix} \end{aligned} xc=r0X+r1Y+r2Z+t0yc=r3X+r4Y+r5Z+t1zc=r6X+r7Y+r8Z+t2[xy]=[zcxczcyc]

3、相机成像平面

[ u v ] = [ f d ( k 0 , k 1 , r 2 ) x f d ( k 0 , k 1 , r 2 ) y ] , d ( k 0 , k 1 , r 2 ) = 1 + ( k 0 + k 1 r 2 ) r 2 , r 2 = x 2 + y 2 \begin{bmatrix}u\\v\end{bmatrix}=\begin{bmatrix} fd(k_0,k_1,r^2)x \\fd(k_0,k_1,r^2)y\end{bmatrix}, \ d(k_0,k_1,r^2)=1+(k_0+k_1r^2)r^2,\ r^2=x^2+y^2 [uv]=[fd(k0,k1,r2)xfd(k0,k1,r2)y], d(k0,k1,r2)=1+(k0+k1r2)r2, r2=x2+y2

二、Jacobian矩阵推导

1、计算焦距的偏导数 ∂ u ∂ f , ∂ v ∂ f \frac{\partial u}{\partial f},\frac{\partial v}{\partial f} fu,fv

∂ u ∂ f = d ( k 0 , k 1 , r 2 ) x ∂ v ∂ f = d ( k 0 , k 1 , r 2 ) y \begin{aligned} \frac{\partial u}{\partial f}=d(k_0,k_1,r^2)x \\ \frac{\partial v}{\partial f}=d(k_0,k_1,r^2)y \end{aligned} fu=d(k0,k1,r2)xfv=d(k0,k1,r2)y

2、计算径向畸变系数 ∂ u ∂ k 0 , ∂ u ∂ k 1 , ∂ v ∂ k 0 , ∂ v ∂ k 1 \frac{\partial u}{\partial k_0},\frac{\partial u}{\partial k_1},\frac{\partial v}{\partial k_0},\frac{\partial v}{\partial k_1} k0u,k1u,k0v,k1v

引入中间变量:
∂ u ∂ d ( k 0 , k 1 , r 2 ) = f x ∂ v ∂ d ( k 0 , k 1 , r 2 ) = f y ∂ d ( k 0 , k 1 , r 2 ) ∂ d ( k 0 ) = r 2 ∂ d ( k 0 , k 1 , r 2 ) ∂ d ( k 1 ) = r 4 \begin{aligned} \frac{\partial u}{\partial d(k_0,k_1,r^2)} = fx \\ \frac{\partial v}{\partial d(k_0,k_1,r^2)} = fy \\ \frac{\partial d(k_0,k_1,r^2)}{\partial d(k_0)} = r^2 \\ \frac{\partial d(k_0,k_1,r^2)}{\partial d(k_1)} = r^4 \end{aligned} d(k0,k1,r2)u=fxd(k0,k1,r2)v=fyd(k0)d(k0,k1,r2)=r2d(k1)d(k0,k1,r2)=r4
根据链式法则:
∂ u ∂ k 0 = ∂ u ∂ d ( k 0 , k 1 , r 2 ) ∂ d ( k 0 , k 1 , r 2 ) k 0 = f x r 2 ∂ u ∂ k 1 = ∂ u ∂ d ( k 0 , k 1 , r 2 ) ∂ d ( k 0 , k 1 , r 2 ) k 1 = f x r 4 ∂ v ∂ k 0 = ∂ v ∂ d ( k 0 , k 1 , r 2 ) ∂ d ( k 0 , k 1 , r 2 ) k 0 = f y r 2 ∂ v ∂ k 1 = ∂ v ∂ d ( k 0 , k 1 , r 2 ) ∂ d ( k 0 , k 1 , r 2 ) k 1 = f y r 4 \begin{aligned} \frac{\partial u}{\partial k_0} = \frac{\partial u}{\partial d(k_0,k_1,r^2)} \frac{\partial d(k_0,k_1,r^2)}{k_0}=fxr^2 \\ \frac{\partial u}{\partial k_1} = \frac{\partial u}{\partial d(k_0,k_1,r^2)} \frac{\partial d(k_0,k_1,r^2)}{k_1}=fxr^4 \\ \frac{\partial v}{\partial k_0} = \frac{\partial v}{\partial d(k_0,k_1,r^2)} \frac{\partial d(k_0,k_1,r^2)}{k_0}=fyr^2 \\ \frac{\partial v}{\partial k_1} = \frac{\partial v}{\partial d(k_0,k_1,r^2)} \frac{\partial d(k_0,k_1,r^2)}{k_1}=fyr^4 \\ \end{aligned} k0u=d(k0,k1,r2)uk0d(k0,k1,r2)=fxr2k1u=d(k0,k1,r2)uk1d(k0,k1,r2)=fxr4k0v=d(k0,k1,r2)vk0d(k0,k1,r2)=fyr2k1v=d(k0,k1,r2)vk1d(k0,k1,r2)=fyr4

3、计算关于平移向量的偏导 ∂ u ∂ t 0 , ∂ u ∂ t 1 , ∂ u ∂ t 2 , ∂ v ∂ t 0 , ∂ v ∂ t 1 , ∂ v ∂ t 2 \frac{\partial u}{\partial t_0},\frac{\partial u}{\partial t_1},\frac{\partial u}{\partial t_2},\frac{\partial v}{\partial t_0},\frac{\partial v}{\partial t_1},\frac{\partial v}{\partial t_2} t0u,t1u,t2u,t0v,t1v,t2v

∂ x c ∂ t 0 = 1 , ∂ y c ∂ t 1 = 1 , ∂ z c ∂ t 2 = 1 ∂ x ∂ x c = 1 z c , ∂ y ∂ y c = 1 z c , ∂ x ∂ z c = − x c ( z c ) 2 , ∂ y ∂ z c = − y c ( z c ) 2 ∂ x ∂ t 0 = ∂ x ∂ x c ∂ x c ∂ t 0 , ∂ y ∂ t 1 = ∂ y ∂ y c ∂ y c ∂ t 1 , ∂ x ∂ t 2 = ∂ x ∂ z c ∂ z c ∂ t 2 , ∂ y ∂ t 2 = ∂ y ∂ z c ∂ z c ∂ t 2 ∂ r 2 ∂ x = 2 x , ∂ r 2 ∂ y = 2 y , ∂ r 2 ∂ t 0 = ∂ r 2 ∂ x ∂ x ∂ t 0 , ∂ r 2 ∂ t 1 = ∂ r 2 ∂ y ∂ y ∂ t 1 , ∂ r 2 ∂ t 2 = ∂ r 2 ∂ x ∂ x ∂ t 2 + ∂ r 2 ∂ y ∂ y ∂ t 2 ∂ d ∂ r 2 = k 0 + 2 k 1 r 2 , ∂ d ∂ t 0 = ∂ d ∂ r 2 ∂ r 2 ∂ t 0 , ∂ d ∂ t 1 = ∂ d ∂ r 2 ∂ r 2 ∂ t 1 , ∂ d ∂ t 2 = ∂ d ∂ r 2 ∂ r 2 ∂ t 2 ∂ d ∂ x = ∂ d ∂ r 2 ∂ r 2 ∂ x , ∂ u ∂ x = f d + f x ∂ d ∂ x , ∂ d ∂ y = ∂ d ∂ r 2 ∂ r 2 ∂ y , ∂ v ∂ y = f d + f y ∂ d ∂ y ∂ u ∂ t 0 = ∂ u ∂ d ∂ d ∂ t 0 x + ∂ u ∂ x ∂ x ∂ t 0 d , ∂ u ∂ t 1 = ∂ u ∂ d ∂ d ∂ t 1 x , ∂ u ∂ t 2 = ∂ u ∂ d ∂ d ∂ t 2 x + ∂ u ∂ x ∂ x ∂ t 2 d ∂ v ∂ t 0 = ∂ v ∂ d ∂ d ∂ t 0 y , ∂ v ∂ t 1 = ∂ v ∂ d ∂ d ∂ t 1 y + ∂ v ∂ y ∂ y ∂ t 1 d , ∂ v ∂ t 2 = ∂ v ∂ d ∂ d ∂ t 2 y + ∂ v ∂ y ∂ y ∂ t 2 d \begin{aligned} &\frac{\partial x_c}{\partial t_0}=1 ,{\kern 10pt} \frac{\partial y_c}{\partial t_1}=1 ,{\kern 10pt} \frac{\partial z_c}{\partial t_2}=1 \\ &\frac{\partial x}{\partial x_c}=\frac{1}{z_c} ,{\kern 10pt} \frac{\partial y}{\partial y_c}=\frac{1}{z_c} ,{\kern 10pt}\frac{\partial x}{\partial z_c}=-\frac{x_c}{(z_c)^2},{\kern 10pt} \frac{\partial y}{\partial z_c}=-\frac{y_c}{(z_c)^2} \\ &\frac{\partial x}{\partial t_0} = \frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial t_0},{\kern 10pt}\frac{\partial y}{\partial t_1} = \frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial t_1},{\kern 10pt}\frac{\partial x}{\partial t_2} = \frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial t_2},{\kern 10pt} \frac{\partial y}{\partial t_2} = \frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial t_2} \\ &\frac{\partial r^2}{\partial x} = 2x,{\kern 10pt}\frac{\partial r^2}{\partial y} = 2y,{\kern 10pt} \frac{\partial r^2}{\partial t_0} = \frac{\partial r^2}{\partial x}\frac{\partial x}{\partial t_0},{\kern 10pt}\frac{\partial r^2}{\partial t_1} = \frac{\partial r^2}{\partial y}\frac{\partial y}{\partial t_1},{\kern 10pt}\frac{\partial r^2}{\partial t_2} = \frac{\partial r^2}{\partial x}\frac{\partial x}{\partial t_2} + \frac{\partial r^2}{\partial y}\frac{\partial y}{\partial t_2}\\ &\frac{\partial d}{\partial r^2}=k_0 + 2 k_1r^2,{\kern 10pt}\frac{\partial d}{\partial t_0} = \frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial t_0} ,{\kern 10pt}\frac{\partial d}{\partial t_1} = \frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial t_1} ,{\kern 10pt}\frac{\partial d}{\partial t_2} = \frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial t_2}\\ &\frac{\partial d}{\partial x}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial x} ,{\kern 10pt}\frac{\partial u}{\partial x} = fd+fx\frac{\partial d}{\partial x} ,{\kern 10pt}\frac{\partial d}{\partial y}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial y} ,{\kern 10pt}\frac{\partial v}{\partial y} = fd+fy\frac{\partial d}{\partial y} \\ &\color{red} \frac{\partial u}{\partial t_0} = \frac{\partial u}{\partial d}\frac{\partial d}{\partial t_0}x +\frac{\partial u}{\partial x}\frac{\partial x}{\partial t_0}d ,{\kern 10pt}\frac{\partial u}{\partial t_1} = \frac{\partial u}{\partial d}\frac{\partial d}{\partial t_1}x,{\kern 10pt}\frac{\partial u}{\partial t_2} = \frac{\partial u}{\partial d}\frac{\partial d}{\partial t_2}x +\frac{\partial u}{\partial x}\frac{\partial x}{\partial t_2}d \color{black}\\ &\color{red} \frac{\partial v}{\partial t_0} = \frac{\partial v}{\partial d}\frac{\partial d}{\partial t_0}y ,{\kern 10pt}\frac{\partial v}{\partial t_1} = \frac{\partial v}{\partial d}\frac{\partial d}{\partial t_1}y+\frac{\partial v}{\partial y}\frac{\partial y}{\partial t_1}d,{\kern 10pt}\frac{\partial v}{\partial t_2} = \frac{\partial v}{\partial d}\frac{\partial d}{\partial t_2}y +\frac{\partial v}{\partial y}\frac{\partial y}{\partial t_2}d \color{black} \end{aligned} t0xc=1,t1yc=1,t2zc=1xcx=zc1,ycy=zc1,zcx=(zc)2xc,zcy=(zc)2yct0x=xcxt0xc,t1y=ycyt1yc,t2x=zcxt2zc,t2y=zcyt2zcxr2=2x,yr2=2y,t0r2=xr2t0x,t1r2=yr2t1y,t2r2=xr2t2x+yr2t2yr2d=k0+2k1r2,t0d=r2dt0r2,t1d=r2dt1r2,t2d=r2dt2r2xd=r2dxr2,xu=fd+fxxd,yd=r2dyr2,yv=fd+fyydt0u=dut0dx+xut0xd,t1u=dut1dx,t2u=dut2dx+xut2xdt0v=dvt0dy,t1v=dvt1dy+yvt1yd,t2v=dvt2dy+yvt2yd

4、计算关于旋转向量的偏导 ∂ u ∂ r 0 , ∂ u ∂ r 2 , ∂ u ∂ r 3 , ∂ u ∂ r 4 , ∂ u ∂ r 5 , ∂ u ∂ r 6 , ∂ u ∂ r 7 , ∂ u ∂ r 8 \frac{\partial u}{\partial r_0},\frac{\partial u}{\partial r_2},\frac{\partial u}{\partial r_3},\frac{\partial u}{\partial r_4},\frac{\partial u}{\partial r_5},\frac{\partial u}{\partial r_6},\frac{\partial u}{\partial r_7},\frac{\partial u}{\partial r_8} r0u,r2u,r3u,r4u,r5u,r6u,r7u,r8u ∂ v ∂ r 0 , ∂ v ∂ r 2 , ∂ v ∂ r 3 , ∂ v ∂ r 4 , ∂ v ∂ r 5 , ∂ v ∂ r 6 , ∂ v ∂ r 7 , ∂ v ∂ r 8 \frac{\partial v}{\partial r_0},\frac{\partial v}{\partial r_2},\frac{\partial v}{\partial r_3},\frac{\partial v}{\partial r_4},\frac{\partial v}{\partial r_5},\frac{\partial v}{\partial r_6},\frac{\partial v}{\partial r_7},\frac{\partial v}{\partial r_8} r0v,r2v,r3v,r4v,r5v,r6v,r7v,r8v

∂ x c ∂ r 0 = ∂ y c ∂ r 3 = ∂ z c ∂ r 6 = X , ∂ x c ∂ r 1 = ∂ y c ∂ r 4 = ∂ z c ∂ r 7 = Y , ∂ x c ∂ r 2 = ∂ y c ∂ r 5 = ∂ z c ∂ r 8 = Z ∂ r 2 ∂ r 0 = ∂ r 2 ∂ x ∂ x ∂ x c ∂ x c ∂ r 0 , ∂ r 2 ∂ r 1 = ∂ r 2 ∂ x ∂ x ∂ x c ∂ x c ∂ r 1 , ∂ r 2 ∂ r 2 = ∂ r 2 ∂ x ∂ x ∂ x c ∂ x c ∂ r 2 ∂ r 2 ∂ r 3 = ∂ r 2 ∂ y ∂ y ∂ y c ∂ y c ∂ r 3 , ∂ r 2 ∂ r 4 = ∂ r 2 ∂ y ∂ y ∂ y c ∂ y c ∂ r 4 , ∂ r 2 ∂ r 5 = ∂ r 2 ∂ y ∂ y ∂ y c ∂ y c ∂ r 5 ∂ r 2 ∂ r 6 = ∂ r 2 ∂ x ∂ x ∂ z c ∂ z c ∂ r 6 + ∂ r 2 ∂ y ∂ y ∂ z c ∂ z c ∂ r 6 , ∂ r 2 ∂ r 7 = ∂ r 2 ∂ x ∂ x ∂ z c ∂ z c ∂ r 7 + ∂ r 2 ∂ y ∂ y ∂ z c ∂ z c ∂ r 7 , ∂ r 2 ∂ r 8 = ∂ r 2 ∂ x ∂ x ∂ z c ∂ z c ∂ r 8 + ∂ r 2 ∂ y ∂ y ∂ z c ∂ z c ∂ r 8 ∂ d ∂ r 0 = ∂ d ∂ r 2 ∂ r 2 ∂ r 0 , ∂ d ∂ r 1 = ∂ d ∂ r 2 ∂ r 2 ∂ r 1 , ∂ d ∂ r 2 = ∂ d ∂ r 2 ∂ r 2 ∂ r 2 ∂ d ∂ r 3 = ∂ d ∂ r 2 ∂ r 2 ∂ r 3 , ∂ d ∂ r 4 = ∂ d ∂ r 2 ∂ r 2 ∂ r 4 , ∂ d ∂ r 5 = ∂ d ∂ r 2 ∂ r 2 ∂ r 5 ∂ d ∂ r 6 = ∂ d ∂ r 2 ∂ r 2 ∂ r 6 , ∂ d ∂ r 7 = ∂ d ∂ r 2 ∂ r 2 ∂ r 7 , ∂ d ∂ r 8 = ∂ d ∂ r 2 ∂ r 2 ∂ r 8 ∂ x ∂ r 0 = ∂ x ∂ x c ∂ x c ∂ r 0 , ∂ x ∂ r 1 = ∂ x ∂ x c ∂ x c ∂ r 1 , ∂ x ∂ r 2 = ∂ x ∂ x c ∂ x c ∂ r 2 , ∂ x ∂ r 6 = ∂ x ∂ z c ∂ z c ∂ r 6 , ∂ x ∂ r 7 = ∂ x ∂ z c ∂ z c ∂ r 7 , ∂ x ∂ r 8 = ∂ x ∂ z c ∂ z c ∂ r 8 ∂ u ∂ r 0 = f x ∂ d ∂ r 0 + f d ∂ x ∂ r 0 , ∂ u ∂ r 1 = f x ∂ d ∂ r 1 + f d ∂ x ∂ r 1 , ∂ u ∂ r 2 = f x ∂ d ∂ r 2 + f d ∂ x ∂ r 2 ∂ u ∂ r 3 = f x ∂ d ∂ r 3 , ∂ u ∂ r 4 = f x ∂ d ∂ r 4 , ∂ u ∂ r 5 = f x ∂ d ∂ r 5 ∂ u ∂ r 6 = f x ∂ d ∂ r 6 + f d ∂ x ∂ r 6 , ∂ u ∂ r 7 = f x ∂ d ∂ r 7 + f d ∂ x ∂ r 7 , ∂ u ∂ r 8 = f x ∂ d ∂ r 8 + f d ∂ x ∂ r 8 ∂ y ∂ r 3 = ∂ y ∂ y c ∂ y c ∂ r 3 , ∂ y ∂ r 4 = ∂ y ∂ y c ∂ y c ∂ r 4 , ∂ y ∂ r 5 = ∂ y ∂ y c ∂ y c ∂ r 5 , ∂ y ∂ r 6 = ∂ y ∂ z c ∂ z c ∂ r 6 , ∂ y ∂ r 7 = ∂ y ∂ z c ∂ z c ∂ r 7 , ∂ y ∂ r 8 = ∂ y ∂ z c ∂ z c ∂ r 8 ∂ v ∂ r 0 = f y ∂ d ∂ r 0 , ∂ v ∂ r 1 = f y ∂ d ∂ r 1 , ∂ v ∂ r 2 = f y ∂ d ∂ r 2 ∂ v ∂ r 3 = f y ∂ d ∂ r 3 + f d ∂ y ∂ r 3 , ∂ v ∂ r 4 = f y ∂ d ∂ r 4 + f d ∂ y ∂ r 4 , ∂ v ∂ r 5 = f u ∂ d ∂ r 5 + f d ∂ y ∂ r 5 ∂ v ∂ r 6 = f y ∂ d ∂ r 6 + f d ∂ y ∂ r 6 , ∂ v ∂ r 7 = f y ∂ d ∂ r 7 + f d ∂ y ∂ r 7 , ∂ v ∂ r 8 = f y ∂ d ∂ r 8 + f d ∂ y ∂ r 8 \begin{aligned} &\frac{\partial x_c}{\partial r_0} =\frac{\partial y_c}{\partial r_3} =\frac{\partial z_c}{\partial r_6} = X ,{\kern 10pt}\frac{\partial x_c}{\partial r_1} =\frac{\partial y_c}{\partial r_4} =\frac{\partial z_c}{\partial r_7} = Y ,{\kern 10pt}\frac{\partial x_c}{\partial r_2} =\frac{\partial y_c}{\partial r_5} = \frac{\partial z_c}{\partial r_8} = Z \\\\ &\frac{\partial r^2}{\partial r_0}=\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial r_0},{\kern 10pt}\frac{\partial r^2}{\partial r_1}=\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial r_1},{\kern 10pt}\frac{\partial r^2}{\partial r_2}=\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial r_2}\\ & \frac{\partial r^2}{\partial r_3}=\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial r_3},{\kern 10pt}\frac{\partial r^2}{\partial r_4}=\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial r_4} ,{\kern 10pt}\frac{\partial r^2}{\partial r_5}=\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial r_5} \\ & \frac{\partial r^2}{\partial r_6}=\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial r_6}+\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial r_6},{\kern 10pt}\frac{\partial r^2}{\partial r_7}=\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial r_7}+\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial r_7},{\kern 10pt}\frac{\partial r^2}{\partial r_8}=\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial r_8}+\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial r_8}\\\\ &\frac{\partial d}{\partial r_0}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_0},{\kern 10pt}\frac{\partial d}{\partial r_1}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_1},{\kern 10pt}\frac{\partial d}{\partial r_2}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_2}\\ &\frac{\partial d}{\partial r_3}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_3},{\kern 10pt}\frac{\partial d}{\partial r_4}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_4},{\kern 10pt}\frac{\partial d}{\partial r_5}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_5} \\ &\frac{\partial d}{\partial r_6}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_6},{\kern 10pt}\frac{\partial d}{\partial r_7}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_7},{\kern 10pt}\frac{\partial d}{\partial r_8}=\frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial r_8} \\\\ &\frac{\partial x}{\partial r_0}=\frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial r_0},{\kern 10pt}\frac{\partial x}{\partial r_1}=\frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial r_1},{\kern 10pt}\frac{\partial x}{\partial r_2}=\frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial r_2},{\kern 10pt} \frac{\partial x}{\partial r_6}=\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial r_6},{\kern 10pt}\frac{\partial x}{\partial r_7}=\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial r_7},{\kern 10pt}\frac{\partial x}{\partial r_8}=\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial r_8} \\\\ &\color{red}\frac{\partial u}{\partial r_0} = fx\frac{\partial d}{\partial r_0}+fd\frac{\partial x}{\partial r_0},{\kern 10pt}\frac{\partial u}{\partial r_1} = fx\frac{\partial d}{\partial r_1}+fd\frac{\partial x}{\partial r_1},{\kern 10pt}\frac{\partial u}{\partial r_2} = fx\frac{\partial d}{\partial r_2}+fd\frac{\partial x}{\partial r_2}\\ &\color{red}\frac{\partial u}{\partial r_3} = fx\frac{\partial d}{\partial r_3},{\kern 10pt}\frac{\partial u}{\partial r_4} = fx\frac{\partial d}{\partial r_4},{\kern 10pt}\frac{\partial u}{\partial r_5} = fx\frac{\partial d}{\partial r_5}\\ &\color{red}\frac{\partial u}{\partial r_6} = fx\frac{\partial d}{\partial r_6}+fd\frac{\partial x}{\partial r_6},{\kern 10pt}\frac{\partial u}{\partial r_7} = fx\frac{\partial d}{\partial r_7}+fd\frac{\partial x}{\partial r_7},{\kern 10pt}\frac{\partial u}{\partial r_8} = fx\frac{\partial d}{\partial r_8}+fd\frac{\partial x}{\partial r_8}\\\\ &\frac{\partial y}{\partial r_3}=\frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial r_3},{\kern 10pt}\frac{\partial y}{\partial r_4}=\frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial r_4},{\kern 10pt}\frac{\partial y}{\partial r_5}=\frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial r_5},{\kern 10pt} \frac{\partial y}{\partial r_6}=\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial r_6},{\kern 10pt}\frac{\partial y}{\partial r_7}=\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial r_7},{\kern 10pt}\frac{\partial y}{\partial r_8}=\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial r_8} \\\\ &\color{red}\frac{\partial v}{\partial r_0} = fy\frac{\partial d}{\partial r_0},{\kern 10pt}\frac{\partial v}{\partial r_1} = fy\frac{\partial d}{\partial r_1},{\kern 10pt}\frac{\partial v}{\partial r_2} = fy\frac{\partial d}{\partial r_2}\\ &\color{red}\frac{\partial v}{\partial r_3} = fy\frac{\partial d}{\partial r_3}+fd\frac{\partial y}{\partial r_3},{\kern 10pt}\frac{\partial v}{\partial r_4} = fy\frac{\partial d}{\partial r_4}+fd\frac{\partial y}{\partial r_4},{\kern 10pt}\frac{\partial v}{\partial r_5} = fu\frac{\partial d}{\partial r_5}+fd\frac{\partial y}{\partial r_5}\\ &\color{red}\frac{\partial v}{\partial r_6} = fy\frac{\partial d}{\partial r_6}+fd\frac{\partial y}{\partial r_6},{\kern 10pt}\frac{\partial v}{\partial r_7} = fy\frac{\partial d}{\partial r_7}+fd\frac{\partial y}{\partial r_7},{\kern 10pt}\frac{\partial v}{\partial r_8} = fy\frac{\partial d}{\partial r_8}+fd\frac{\partial y}{\partial r_8}\\ \end{aligned} r0xc=r3yc=r6zc=X,r1xc=r4yc=r7zc=Y,r2xc=r5yc=r8zc=Zr0r2=xr2xcxr0xc,r1r2=xr2xcxr1xc,r2r2=xr2xcxr2xcr3r2=yr2ycyr3yc,r4r2=yr2ycyr4yc,r5r2=yr2ycyr5ycr6r2=xr2zcxr6zc+yr2zcyr6zc,r7r2=xr2zcxr7zc+yr2zcyr7zc,r8r2=xr2zcxr8zc+yr2zcyr8zcr0d=r2dr0r2,r1d=r2dr1r2,r2d=r2dr2r2r3d=r2dr3r2,r4d=r2dr4r2,r5d=r2dr5r2r6d=r2dr6r2,r7d=r2dr7r2,r8d=r2dr8r2r0x=xcxr0xc,r1x=xcxr1xc,r2x=xcxr2xc,r6x=zcxr6zc,r7x=zcxr7zc,r8x=zcxr8zcr0u=fxr0d+fdr0x,r1u=fxr1d+fdr1x,r2u=fxr2d+fdr2xr3u=fxr3d,r4u=fxr4d,r5u=fxr5dr6u=fxr6d+fdr6x,r7u=fxr7d+fdr7x,r8u=fxr8d+fdr8xr3y=ycyr3yc,r4y=ycyr4yc,r5y=ycyr5yc,r6y=zcyr6zc,r7y=zcyr7zc,r8y=zcyr8zcr0v=fyr0d,r1v=fyr1d,r2v=fyr2dr3v=fyr3d+fdr3y,r4v=fyr4d+fdr4y,r5v=fur5d+fdr5yr6v=fyr6d+fdr6y,r7v=fyr7d+fdr7y,r8v=fyr8d+fdr8y

5、计算关于三维点的偏导数 ∂ u ∂ X , ∂ u ∂ Y , ∂ u ∂ Z , ∂ v ∂ X , ∂ v ∂ Y , ∂ v ∂ Z \frac{\partial u}{\partial X},\frac{\partial u}{\partial Y},\frac{\partial u}{\partial Z},\frac{\partial v}{\partial X},\frac{\partial v}{\partial Y},\frac{\partial v}{\partial Z} Xu,Yu,Zu,Xv,Yv,Zv

∂ x c ∂ X = r 0 , ∂ x c ∂ Y = r 1 , ∂ x c ∂ Z = r 2 ∂ y c ∂ X = r 3 , ∂ y c ∂ Y = r 4 , ∂ y c ∂ Z = r 5 ∂ z c ∂ X = r 6 , ∂ z c ∂ Y = r 7 , ∂ z c ∂ Z = r 8 ∂ x ∂ X = ∂ x ∂ x c ∂ x c ∂ X + ∂ x ∂ z c ∂ z c ∂ X , ∂ y ∂ X = ∂ y ∂ y c ∂ y c ∂ X + ∂ y ∂ z c ∂ z c ∂ X ∂ x ∂ Y = ∂ x ∂ x c ∂ x c ∂ Y + ∂ x ∂ z c ∂ z c ∂ Y , ∂ y ∂ Y = ∂ y ∂ y c ∂ y c ∂ Y + ∂ y ∂ z c ∂ z c ∂ Y ∂ x ∂ Z = ∂ x ∂ x c ∂ x c ∂ Z + ∂ x ∂ z c ∂ z c ∂ Z , ∂ y ∂ Z = ∂ y ∂ y c ∂ y c ∂ Z + ∂ y ∂ z c ∂ z c ∂ Z ∂ r 2 ∂ X = ∂ r 2 ∂ x ∂ x ∂ X + ∂ r 2 ∂ y ∂ y ∂ X , ∂ r 2 ∂ Y = ∂ r 2 ∂ x ∂ x ∂ Y + ∂ r 2 ∂ y ∂ y ∂ Y , ∂ r 2 ∂ Z = ∂ r 2 ∂ x ∂ x ∂ Z + ∂ r 2 ∂ y ∂ y ∂ Z ∂ d ∂ X = ∂ d ∂ r 2 ∂ r 2 ∂ X , ∂ d ∂ Y = ∂ d ∂ r 2 ∂ r 2 ∂ Y , ∂ d ∂ Z = ∂ d ∂ r 2 ∂ r 2 ∂ Z ∂ u ∂ X = f x ∂ d ∂ X + f d ∂ x ∂ X , ∂ u ∂ Y = f x ∂ d ∂ Y + f d ∂ x ∂ Y , ∂ u ∂ Z = f x ∂ d ∂ Z + f d ∂ x ∂ Z ∂ v ∂ X = f y ∂ d ∂ X + f d ∂ y ∂ X , ∂ v ∂ Y = f y ∂ d ∂ Y + f d ∂ y ∂ Y , ∂ v ∂ Z = f y ∂ d ∂ Z + f d ∂ y ∂ Z \begin{aligned} &\frac{\partial x_c}{\partial X} = r0,{\kern 10pt}\frac{\partial x_c}{\partial Y} = r1,{\kern 10pt}\frac{\partial x_c}{\partial Z} = r2 \\ &\frac{\partial y_c}{\partial X} = r3,{\kern 10pt}\frac{\partial y_c}{\partial Y} = r4,{\kern 10pt}\frac{\partial y_c}{\partial Z} = r5 \\ &\frac{\partial z_c}{\partial X} = r6,{\kern 10pt}\frac{\partial z_c}{\partial Y} = r7,{\kern 10pt}\frac{\partial z_c}{\partial Z} = r8 \\\\ &\frac{\partial x}{\partial X} = \frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial X}+\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial X},{\kern 10pt}\frac{\partial y}{\partial X} = \frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial X}+\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial X}\\ &\frac{\partial x}{\partial Y} = \frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial Y}+\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial Y},{\kern 10pt}\frac{\partial y}{\partial Y} = \frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial Y}+\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial Y}\\ &\frac{\partial x}{\partial Z} = \frac{\partial x}{\partial x_c}\frac{\partial x_c}{\partial Z}+\frac{\partial x}{\partial z_c}\frac{\partial z_c}{\partial Z},{\kern 10pt}\frac{\partial y}{\partial Z} = \frac{\partial y}{\partial y_c}\frac{\partial y_c}{\partial Z}+\frac{\partial y}{\partial z_c}\frac{\partial z_c}{\partial Z} \\\\ &\frac{\partial r^2}{\partial X} =\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial X}+\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial X},{\kern 10pt}\frac{\partial r^2}{\partial Y} =\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial Y}+\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial Y},{\kern 10pt}\frac{\partial r^2}{\partial Z} =\frac{\partial r^2}{\partial x}\frac{\partial x}{\partial Z}+\frac{\partial r^2}{\partial y}\frac{\partial y}{\partial Z}\\\\ &\frac{\partial d}{\partial X} = \frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial X},{\kern 10pt}\frac{\partial d}{\partial Y} = \frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial Y},{\kern 10pt}\frac{\partial d}{\partial Z} = \frac{\partial d}{\partial r^2}\frac{\partial r^2}{\partial Z}\\ &\color{red}\frac{\partial u}{\partial X} = fx\frac{\partial d}{\partial X}+ fd\frac{\partial x}{\partial X},{\kern 10pt}\frac{\partial u}{\partial Y} = fx\frac{\partial d}{\partial Y}+ fd\frac{\partial x}{\partial Y} ,{\kern 10pt}\frac{\partial u}{\partial Z} = fx\frac{\partial d}{\partial Z}+ fd\frac{\partial x}{\partial Z}\\ &\color{red}\frac{\partial v}{\partial X} = fy\frac{\partial d}{\partial X}+ fd\frac{\partial y}{\partial X},{\kern 10pt}\frac{\partial v}{\partial Y} = fy\frac{\partial d}{\partial Y}+ fd\frac{\partial y}{\partial Y} ,{\kern 10pt}\frac{\partial v}{\partial Z} = fy\frac{\partial d}{\partial Z}+ fd\frac{\partial y}{\partial Z} \end{aligned} Xxc=r0,Yxc=r1,Zxc=r2Xyc=r3,Yyc=r4,Zyc=r5Xzc=r6,Yzc=r7,Zzc=r8Xx=xcxXxc+zcxXzc,Xy=ycyXyc+zcyXzcYx=xcxYxc+zcxYzc,Yy=ycyYyc+zcyYzcZx=xcxZxc+zcxZzc,Zy=ycyZyc+zcyZzcXr2=xr2Xx+yr2Xy,Yr2=xr2Yx+yr2Yy,Zr2=xr2Zx+yr2ZyXd=r2dXr2,Yd=r2dYr2,Zd=r2dZr2Xu=fxXd+fdXx,Yu=fxYd+fdYx,Zu=fxZd+fdZxXv=fyXd+fdXy,Yv=fyYd+fdYy,Zv=fyZd+fdZy

代码实现

https://github.com/ldx-star/Bundle-Adjustment


http://www.ppmy.cn/ops/31642.html

相关文章

MATLAB初学者入门(27)—— 无监督学习神经网络

无监督学习神经网络,如自组织映射(SOM)和自编码器,是处理没有显式标签的数据集的强大工具。这些网络可以学习数据的内部结构和模式,用于特征提取、数据可视化和降维。在MATLAB中,可以使用神经网络工具箱来实…

LLM应用:工作流workflow创建自定义模版使用

参考: https://www.coze.cn/ 本案例是在coze平台上操作的,也有其他工具支持工作流的创建例如dify;也例如图像生成的comfyui工作流工具 创建自定义模版 可以根据自己需求创建自己的工作流工具;本文案例是创建一个联网搜索的LLM应用: 创建工作流页面: https://www.coze.c…

电力负荷超前96步预测,采用2024最新鹭鹰算法优化ELM实现,MATLAB代码

本期电力负荷预测数据来源为:《第九届电工数学建模竞赛试题_2016》 数据概况如下: 简介 本期内容: ①对电力负荷数据进行简单综合处理,划分训练集和测试集 ②采用标准的极限学习机ELM实现电力负荷预测 ③采用2024年最新鹭鹰算法优…

JavaScript Array 对象

JavaScript数组是一种特殊的对象,可以用来存储多个值并按照顺序访问这些值。Array对象提供了一些方法来操作数组。 创建数组: 使用数组字面量创建数组:var arr [1, 2, 3];使用Array构造函数创建数组:var arr new Array(1, 2, …

Servlet详解(从xml到注解)

文章目录 概述介绍作用 快速入门Servelt的执行原理执行流程:执行原理 生命周期概述API 服务器启动,立刻加载Servlet对象(理解)实现Servlet方式(三种)实现Servlet接口实现GenericServlet抽象类,只重写service方法实现HttpServlet实现类实现Htt…

电力智能监控系统JK0403-2监控模块JK0403-3控制器JK0401

电力智能监控系统JK0403-2监控模块JK0403-3控制器JK0401,ZTJK-04,ZTJK12,ZT-22005FT,ZT-22010FT,ZT-11005FT,ZT-11010FT,ZT-22010,ZT-22005,ZT-11010,ZT-1100…

Linux服务器常用命令总结

view查找日志关键词 注意日志级别,回车后等一会儿,因为文件可能比较大加载完需要时间 当内容显示出来后,使用“/关键词”搜索 回车就能搜到,n表示查找下一个,N表示查找上一个 find 查找 find Family -name book …

数据结构===散列表

文章目录 概要散列思想散列函数散列冲突开放寻址法装载因子 链表法 代码Java小结 概要 散列表是一种很有趣的数据结构。 散列表是一个很有用的数据结构。它是数组演练而来的,又是一个基于数组的扩展的数据结构。接下来看看。 散列思想 散列表用的是数组支持按照下…