您好!
我正在使用 VLIB 软件库进行视频稳定演示。
VLIB_harrisScore_7x7函数和 VLIB_nonMaxSuppress_7x7_S16函数用于检测跟踪点
(由于 VLIB_FeaturesustoTrack 函数无法处理我从 另一个线程中学到的太大的图像)
VLIB_TrackFeaturesLucasKanade_7x7 用于跟踪以下帧上的这些点(以匹配帧之间的特征点)、 还使用我从函数参考中的注释中学到的金字塔方法。
问题是在跟踪过程完成后、根据 outx / outy / error 输出、只有不到一半的点可以成功匹配。
这是正常现象还是我犯了什么错误?
我的代码:
//获取上面的 imPrev 和 imCur
uint8_t * oldpyr[4];
uint8_t * newpyr[4];
PyramidInit (oldpyr、oldpyrbuf、imPrev、width、height); //使用参考显示的方式
PyramidInit (newpyr、newpyrbuf、 imCur、width、height);
VLIB_imagePyramid8 (imPrev、宽度、高度、oldpyrbuf);
VLIB_imagePyramid8 (imCur、宽度、高度、newpyrbuf);
memset (gradx、0、sizeof (int16_t)*高度*宽度);
memset (Grady、0、sizeof (int16_t)*高度*宽度);
VLIB_xyGradents (imPrev、Gradx + width + 1、Grady + width + 1、width、height - 1);
memset (分数、0、身高*宽*尺寸(int16_t));
VLIB_harrisScore_7x7 (Gradx、Grady、宽度、高度、分数、 1310、缓冲器);
memset (f壮举、0、高度*宽度* sizeof (uint8_t));
INT THRESH = DSP_maxval (分数、宽度*高度)* 0.8;
VLIB_nonMaxSuppress_7x7_S16 (分数、宽度、高度、阈值、壮举+ 3 *宽度+ 3);
对于(I = 7;标志&& I <(高度- 7);I++)
{
for (j = 7;flag && j <(宽度- 7);j++)
{
if (f壮[I * width + j]=255)
{
X[nFeatures]= I << 4;
Y[nFeatures]= j << 4;
nfeatures ++;
}
}
}
if (nFeatures%2!= 0)
{
nfeatures --;
}
对于(i = 0;<nFeatures; i++)
{
newX[i]= X[i]>> 3;
Newy[i]= Y[i]>> 3;
}
对于(I = 3;I > 0;I-)
{
对于(j = 0;j < nFeatures;j++)
{
PyramidX[j]= X[j]>> I;
PyramidY[j]= Y[j]>> I;
}
memset (pyrgradx、0、sizeof (int16_t)*高度*宽度);
memset (pyrgrady、0、sizeof (int16_t)*高度*宽度);
VLIB_xyGradents (oldpyr[i]、pyrgradx +(width >> i)+ 1、pyrgrady +(width >> i)+ 1、width >> I、(height >> I)- 1);
VLIB_trackFeaturesLucasKanade_7x7 (oldpyr[i]、newpyr[i]、pyrgradx、pyrgrady、width >> I、 高度>> I、nFeatures、 PyramidX、PyramidY、newX、 Newy、NULL、10、1e-4、Scratch);
对于(j = 0;j < nFeatures;j++)
{
newX[j]= newX[j]<< 1;
Newy[j]= Newy[j]<<1;
}
}
//使用原始分辨率图像微调 newX,Newy 第四次
VLIB_trackFeaturesLucasKanade_7x7 (imPrev、imCur、Gradx、Grady、width、 高度、nFeatures、 X、Y、newX、 Newy、status、10、1e-4、Scratch);
期待您的响应!
谢谢、
Eddie