【发布时间】:2010-11-07 13:28:12
【问题描述】:
我想找到光流的平均值,我可以从第一帧中提取特征并在下一帧中找到它们的位置。现在,我想找到位移的平均值,以便将图像转换回其静止背景以稳定图像。
// here I take the optical flow
cvCalcOpticalFlowPyrLK(frame1_1C, frame2_1C, pyramid1, pyramid2, frame1_features,
frame2_features, corner_count, optical_flow_window, 5,
optical_flow_found_feature, NULL,
optical_flow_termination_criteria, NULL);
// here the features that I extract them
for( int i=0; i < corner_count; i++ ) {
CvPoint p,q;
if ( optical_flow_found_feature[i] == 0 ) continue;
p.x = (int) frame1_features[i].x;
p.y = (int) frame1_features[i].y;
q.x = (int) frame2_features[i].x;
q.y = (int) frame2_features[i].y;
double angle = atan2( (double) p.y - q.y, (double) p.x - q.x );
double hypotenuse = sqrt( square(p.y - q.y) + square(p.x - q.x) );
现在我想取它们的平均值,如果你想让我向你展示更多代码,我已经准备好这样做了。
corner_count 是特征的数量。
【问题讨论】:
-
我建议您 (a) 提出一个问题 - 您现在所做的就是告诉我们您想做什么,我们猜测您遇到的问题,(b) 格式您的代码即代码 - 请参阅您在其中创建/编辑问题的文本框上方的图标,(c)
标签: c++ image-processing opencv