TIM_READ2

Robust Camera Calibration by Optimal Localization of Spatial Control Points

文章提出了一种新的定位最优控制点的方法。他可以使用没有对焦清晰的图像,而且可以免去高精度检测控制点的需要。

In our work, we formulate the accurate determination of control points’ localization as an optimization process. This optimization process takes determined control points’ uncertainty area as input. A global searching algorithm combined with Levenberg–Marquardt optimization algorithm is introduced for searching the optimal control points and refining camera parameters.

文章吧控制点的确定过程形式化的转化为一个优化的过程,这个优化过程把控制点所在的大致区域作为输入,一个全局的最搜索优化算法(LM)被使用来搜索最优的精致来调整相机参数。

失焦的原因:
- 没有自动聚焦devices。这个时候自动聚焦的工作is vert tedious.
-在孔径较大的时候,景深很小。
在失焦的图像中传统的控制点检测方法无效。

To handle the problem of how to accurate determine the localization of control points under a certain degree of defocus blurring, perspective distortion, and lens distortion, we propose a novel generic localization optimization method of 2-D control points for camera’s parameters estimation. In this method, we first determine the points’ uncertainty area (PUA) map for potential optimal 2-D control points which by considering localization bias stem from out-of-focus blurring, distortion bias from perspective transformation, and lens distortion. Then, an optimal 2-D control points searching algorithm together with Levenberg–Marquardt (L–M) optimization algorithm are developed to accurately obtain the optimal 2-D control points meanwhile refining the parameters of a general pinhole model camera.
我解决问题如何在一定比例的失焦模糊,透视失真,镜头畸变下精确的定位控制点,文章提出了一种可泛化的定位优化方法,对于相机的2D控制点的估计。在这个方法中,我们首先确定点的大致区域(PUA),然后使用一种LM的优化算法来获取2D最优控制点,同时调整相机模型的参数。

失焦模糊偏差映射估计

我们在每个控制的位置估计失焦模糊半径,给定一个具有一定失焦的标定板,光线经过标定反射进入镜头无法汇聚到一点。他们分布在一定的区域内,所谓的COC(circle of confusion),COC的直径为

c=|ddf|df0D(dff0)

f0D分别为焦距和数值孔径。ddf为distance from the object plane to the lens plane and the focal plane to lens plane in a fixed lens system。失焦的作用可用一个点扩散函数和理想清晰图像的卷积来描述。理想点的针孔模型假设景深为无穷大。点扩散函数一般建模为2D圆形高斯形式。
G(x,y,σ)=12πσexp(x2+y22σ2)

离焦图像的灰度为
ib(x,y)=aIu(x,y)G(x,y)

It is worthy noticing that the inaccurate target is one of the main reasons for calibration precision degenerate


当LCD关闭的时候

I0(x)=(A+n(x))G(x,σx)

图像有一个未知的偏置A,噪声n(x)。当LCD打开显示一个白屏,捕获的图像偏置增加B
I1(x)=(A+B+n(x))G(x,σx)
。当LCD打开显示一个棋盘格,捕获的图像偏置增加B
Ib(x)=(A+Iu(x)+n(x))G(x,σx)

去掉噪声的影响,模糊的图像可以表示为
Ibn(x)=Ib(x)I0(x)I1(x)I0(x)G(x,σx)=Iu(x)BG(x,σx)
使用高斯滤波,并求取梯度
Inb(x)=(Inb(x)G(x,σ0))==Iu(x)BG(x,σ2x+σ20)

在聚焦清晰的图像中棋盘格的边缘作为阶跃函数,再模糊和初始模糊梯度图像的比值可以表示为
Inb(x)Inb(x)x=0=σ2xσ2x+σ20
,Assuming the magnitude along with x-axis is denoted by 1/Rx.
1Rx=σ2xσ2x+σ20
这样可以估计模糊半径可以估计出来。
σx=1R1x1σ0
,由此可知估计所得半径与LCD显示偏置亮度AB无关。对于2D的情况类似
nb(x,y)=2Inb(x)+2Inb(y)G(x,y,σ0)

在实验中,红合成条纹图像。

the control PUA is defined as a circle-like area that takes the initial refined control point through perspective distortion and lens distortion adjustment
as the circle center and the perspective distortion and lens distortion radius (γ ),

D¯i,j,1=(i,γi)|iNj

where Nj is the j th input image for calibration, Dij,1is one of the control PUA for perspective distortion bias and lens distortion bias. i is the index number of control point in each input image.
D¯i,j,2=(i,δ)|iNj

D¯i,j,2the control PUA for defocus blurring radius.
PUA={mi,j|mi,jD¯ij,D¯ij=D¯ij,1D¯ij,2}

Localization Optimization of 2-D Control Points for Camera’s Parameters Further Refinement

这样给定PUA,它包含了靶标的控制点,控制点最优定位点可以使用2D搜索方法获得,使用LM来更新或者调整相机的参数。具体是最小化损失函数。给定n个输入图像,每个图像包含m个控制点,损失函数定义为

F(mi,j)=i=1nj=1nmi,jm^(A,K,Ri,Ti,Mij)2,s.t.{mi,jPUAMi,jMi+1,jD<ε

where mi,jis the observed control point on the image plane. Mi,j is the corresponding point of the observed control point on target plane in 3-D space. m¯(A,K,Ri,Ti,Mi,j) is the reprojection point of 3-D position point Mi,j on image plane.

评价

在图像坐标系中判定控制点是否精确十分困难,越精确的控制点得到的误差越小:一种方式均方重建误差E1,他通过计算2D控制点和重投影点的欧式距离。
另外一个评价标准是相邻控制点的距离导数,相机被标定之后,使用3D投影点Mc,i=(X_{d,i},Y_{d,i},Z_{d,i},),直接计算3D空间中点的距离:

E2x=1N1(N2+1)i=1N1×j=1N2+1(M¯c,i,jM¯c,i+1,jD1)2

E2y=1N2(N1+1)i=1N1+1×j=1N2(M¯c,i,jM¯c,i,j+1D2)2

实验结果

一个事实是如果图像越模糊,标定结果的精度会越差。使用高斯核with不同的标准差去平滑out-of-focus的图像,然后如输入到所提出的算法中,当图像越来模糊的时候,焦距和主点增大。

#include "ENCODER.h" /* 左 定时器2 PA15 PB3 计数AIN1 AIN2 */ /* 右 定时器4 PB6 PB7 计数BIN1 BIN2 */ /************************************ 函数功能:把TIM2初始化为编码器接口模式 左一 入口参数:无 返回 值:无 *************************************/ void Encoder_TIM2_Init(void) { GPIO_InitTypeDef GPIO_InitStruct; TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct; TIM_ICInitTypeDef TIM_ICInitStruct; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO,ENABLE);//开启时钟 RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2,ENABLE); //要使用PA15、PB3、PA2、PA3的端口组合,要调用下面的语句进行部分重映射: //RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); //重映射必须要开AFIO时钟 // GPIO_PinRemapConfig(GPIO_PartialRemap1_TIM2, ENABLE); GPIO_PinRemapConfig(GPIO_PartialRemap1_TIM2,ENABLE); GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable , ENABLE); //禁止JTAG功能,把PB3,PB4作为普通IO口使用 GPIO_InitStruct.GPIO_Mode=GPIO_Mode_IN_FLOATING;//初始化GPIO--PA15 GPIO_InitStruct.GPIO_Pin=GPIO_Pin_15; GPIO_Init(GPIOA,&GPIO_InitStruct); GPIO_InitStruct.GPIO_Mode=GPIO_Mode_IN_FLOATING;//初始化GPIO--PB3 GPIO_InitStruct.GPIO_Pin=GPIO_Pin_3; GPIO_Init(GPIOB,&GPIO_InitStruct); TIM_TimeBaseStructInit(&TIM_TimeBaseInitStruct);//初始化定时器。 TIM_TimeBaseInitStruct.TIM_ClockDivision=TIM_CKD_DIV1; TIM_TimeBaseInitStruct.TIM_CounterMode=TIM_CounterMode_Up; TIM_TimeBaseInitStruct.TIM_Period=65535; TIM_TimeBaseInitStruct.TIM_Prescaler=0; TIM_TimeBaseInit(TIM2,&TIM_TimeBaseInitStruct); TIM_EncoderInterfaceConfig(TIM2,TIM_EncoderMode_TI12,TIM_ICPolarity_Rising,TIM_ICPolarity_Rising);//配置编码器模式 TIM_ICStructInit(&TIM_ICInitStruct);//初始化输入捕获 TIM_ICInitStruct.TIM_ICFilter=10; TIM_ICInit(TIM2,&TIM_ICInitStruct); TIM_ClearFlag(TIM2,TIM_FLAG_Update); TIM_ITConfig(TIM2,TIM_IT_Update,ENABLE);//配置溢出更新中断标志位 TIM_SetCounter(TIM2,0);//清零定时器计数值 TIM_Cmd(TIM2,ENABLE);//开启定时器 } /************************************ 函数功能:把TIM4初始化为编码器接口模式 右一 入口参数:无 返回 值:无 *************************************/ void Encoder_TIM4_Init(void) { GPIO_InitTypeDef GPIO_InitStruct; TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStruct; TIM_ICInitTypeDef TIM_ICInitStruct; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4,ENABLE); GPIO_InitStruct.GPIO_Mode=GPIO_Mode_IN_FLOATING; GPIO_InitStruct.GPIO_Pin=GPIO_Pin_6 |GPIO_Pin_7; GPIO_Init(GPIOB,&GPIO_InitStruct); TIM_TimeBaseStructInit(&TIM_TimeBaseInitStruct); TIM_TimeBaseInitStruct.TIM_ClockDivision=TIM_CKD_DIV1; TIM_TimeBaseInitStruct.TIM_CounterMode=TIM_CounterMode_Up; TIM_TimeBaseInitStruct.TIM_Period=65535; TIM_TimeBaseInitStruct.TIM_Prescaler=0; TIM_TimeBaseInit(TIM4,&TIM_TimeBaseInitStruct); TIM_EncoderInterfaceConfig(TIM4,TIM_EncoderMode_TI12,TIM_ICPolarity_Rising,TIM_ICPolarity_Rising); TIM_ICStructInit(&TIM_ICInitStruct); TIM_ICInitStruct.TIM_ICFilter=10; TIM_ICInit(TIM4,&TIM_ICInitStruct); TIM_ClearFlag(TIM4,TIM_FLAG_Update); TIM_ITConfig(TIM4,TIM_IT_Update,ENABLE); TIM_SetCounter(TIM4,0); TIM_Cmd(TIM4,ENABLE); } /*读取速度函数(读取位移函数)*/ /********************** 编码器速度读取函数 (编码器读到的是速度) (编码器产生的是脉冲,计数器记脉冲数,脉冲数就是位移) 入口参数:定时器 **********************/ int Read_Speed(u8 TIMx) { int value_1; switch(TIMx) { case 2: value_1=(short)TIM_GetCounter(TIM2);TIM_SetCounter(TIM2,0);break; /*如果是定时器二,1.采集编码器的计数值并保存 2.将定时器的计数值清零*/ case 4: value_1=(short)TIM_GetCounter(TIM4);TIM_SetCounter(TIM4,0);break; default:value_1=0; } return value_1; } /*TIM2的中断服务函数*/ void TIM2_IRQHandler(void) { if(TIM2->SR&0X0001) //Overflow interrupt //溢出中断 { } TIM2->SR&=~(1<<0); //Clear the interrupt flag bit //清除中断标志位 } /*TIM4的中断服务函数*/ void TIM4_IRQHandler(void) { if(TIM4->SR&0X0001) //Overflow interrupt //溢出中断 { } TIM4->SR&=~(1<<0); //Clear the interrupt flag bit //清除中断标志位 } 这引脚怎么接?
06-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值