我想绘制一条线来连接一个边界框的中心点,这些点存储在一个向量中,因为中心在一帧之间移动。OpenCV从一组点中绘制一条线
现在我正在尝试使用CvLine将这些点连接在一起。我正在关注。但CvLine函数满足了我给它的参数。
下面是代码:
vector<Point> Rightarm(20);
vector<Point> Leftarm(20);
vector<Point>::const_iterator RightIter;
vector<Point>::const_iterator LeftIter;
Point center = Point(oko[0].x + (oko[0].width/2), oko[0].y + (oko[0].height/2));
cout<<"Center Point of Box: 0 is: " <<center<<endl;
double area = (oko[0].width * oko[0].height);
cout<<"The Area of Box: 0 is: " <<area<<endl;
Point center1 = Point(oko[1].x + (oko[1].width/2), oko[1].y + (oko[1].height/2));
cout<<"Center Point of Box: 1 is: " <<center1<<endl;
double area1 = (oko[1].width * oko[1].height);
cout<<"The Area of Box: 1 is: " <<area1<<endl;
Rightarm.push_back(center);
Leftarm.push_back(center1);
if(oko[0].x > oko[1].x)
{
}
else
{
}
for(RightIter = Rightarm.begin(); RightIter != Rightarm.end(); ++RightIter)
{
circle(drawing, *RightIter, 3, Scalar(0,0,255), CV_FILLED);
}
if(Rightarm.size() == 20)
{
Rightarm.clear();
}
for(LeftIter = Leftarm.begin(); LeftIter != Leftarm.end(); ++LeftIter)
{
circle(drawing, *LeftIter, 3, Scalar(0,255,0), CV_FILLED);
}
if(Rightarm.size() == 20)
{
Leftarm.clear();
}
cvLine(drawing, center.x, center.y, Scalar(255,255,255),1 ,8 ,CV_AA);
imshow(window_Input, frame);
imshow(window_Output, drawing);
任何人都可以看到我这个去错了...?