IPM逆透视变换

逆透视变换矩阵

Image --> Ground:

T i g = h ⋅ [ − 1 f x cos ⁡ ( γ ) 1 f y sin ⁡ ( θ ) sin ⁡ ( γ ) c x f x cos ⁡ ( γ ) − c y f y sin ⁡ ( θ ) sin ⁡ ( γ ) − cos ⁡ ( θ ) sin ⁡ ( γ ) 0 1 f x sin ⁡ ( γ ) 1 f y sin ⁡ ( θ ) cos ⁡ ( γ ) − c x f x sin ⁡ ( γ ) − c y f y sin ⁡ ( θ ) cos ⁡ ( γ ) − cos ⁡ ( θ ) cos ⁡ ( γ ) 0 0 1 f y cos ⁡ ( θ ) − c y f y cos ⁡ ( θ ) + sin ⁡ ( θ ) 0 0 − 1 h f y cos ⁡ ( θ ) c y h f y cos ⁡ ( θ ) − 1 h sin ⁡ ( θ ) 0 ] T_{ig} = h \cdot \begin{bmatrix} -\frac{1}{f_x} \cos(\gamma) &\frac{1}{f_y} \sin(\theta) \sin(\gamma) &\frac{c_x}{f_x} \cos(\gamma) - \frac{c_y}{f_y} \sin(\theta) \sin(\gamma) - \cos(\theta) \sin(\gamma) &0 \\ \frac{1}{f_x} \sin(\gamma) &\frac{1}{f_y}\sin(\theta) \cos(\gamma) &-\frac{c_x}{f_x}\sin(\gamma) - \frac{c_y}{f_y} \sin(\theta) \cos(\gamma) - \cos(\theta) \cos(\gamma) &0 \\ 0 &\frac{1}{f_y}\cos(\theta) &-\frac{c_y}{f_y} \cos(\theta) + \sin(\theta) &0\\ 0 &-\frac{1}{h f_y} \cos(\theta) &\frac{c_y}{h f_y}\cos(\theta) - \frac{1}{h}\sin(\theta) &0 \end{bmatrix} Tig=hfx1cos(γ)fx1sin(γ)00fy1sin(θ)sin(γ)fy1sin(θ)cos(γ)fy1cos(θ)hfy1cos(θ)fxcxcos(γ)fycysin(θ)sin(γ)cos(θ)sin(γ)fxcxsin(γ)fycysin(θ)cos(γ)cos(θ)cos(γ)fycycos(θ)+sin(θ)hfycycos(θ)h1sin(θ)0000

Ground --> Image:

T g i = [ f x cos ⁡ ( γ ) + c x cos ⁡ ( θ ) sin ⁡ ( γ ) − f x sin ⁡ ( γ ) + c x cos ⁡ ( θ ) cos ⁡ ( γ ) − c x sin ⁡ ( θ ) 0 − f y sin ⁡ ( θ ) sin ⁡ ( γ ) + c y cos ⁡ ( θ ) sin ⁡ ( γ ) − f y sin ⁡ ( θ ) cos ⁡ ( γ ) + c y cos ⁡ ( θ ) cos ⁡ ( γ ) − f y cos ⁡ ( θ ) − c y sin ⁡ ( θ ) 0 cos ⁡ ( θ ) sin ⁡ ( γ ) cos ⁡ ( θ ) cos ⁡ ( γ ) − sin ⁡ ( θ ) 0 cos ⁡ ( θ ) sin ⁡ ( γ ) cos ⁡ ( θ ) cos ⁡ ( γ ) − sin ⁡ ( θ ) 0 ] T_{gi} = \begin{bmatrix} f_x \cos(\gamma) + c_x \cos(\theta) \sin(\gamma) &-f_x \sin(\gamma) + c_x \cos(\theta) \cos(\gamma) &-c_x \sin(\theta) &0 \\ -f_y \sin(\theta) \sin(\gamma) + c_y \cos(\theta) \sin(\gamma) &-f_y \sin(\theta) \cos(\gamma) + c_y \cos(\theta) \cos(\gamma) &-f_y \cos(\theta) - c_y \sin(\theta) &0 \\ \cos(\theta) \sin(\gamma) &\cos(\theta) \cos(\gamma) &-\sin(\theta) &0 \\ \cos(\theta) \sin(\gamma) &\cos(\theta) \cos(\gamma) &-\sin(\theta) &0 \end{bmatrix} Tgi=fxcos(γ)+cxcos(θ)sin(γ)fysin(θ)sin(γ)+cycos(θ)sin(γ)cos(θ)sin(γ)cos(θ)sin(γ)fxsin(γ)+cxcos(θ)cos(γ)fysin(θ)cos(γ)+cycos(θ)cos(γ)cos(θ)cos(γ)cos(θ)cos(γ)cxsin(θ)fycos(θ)cysin(θ)sin(θ)sin(θ)0000

你可能感兴趣的:(opencv,线性代数,几何学,矩阵)