“向量迭代器无法取消引用”……Visual Studio 2010 错误
<块引用>形态学操作后我检测到了指尖。矢量指尖 包含所有指尖的细节。我创建了一个迭代器来获取第一个和 第二指尖坐标。 但是当我尝试编译时,出现错误“向量迭代器不可取消引用”...
请帮助我!!1
while (1) { 。 。 向量::迭代器 p = 0;
p = fingerTips.begin();
CvPoint forefinger = *p;
*p++;
CvPoint secondfinger = *p;
int distance = secondfinger.y - forefinger.y;
char dist[6];
sprintf(x_pt,"%d",forefinger.x);
sprintf(y_pt,"%d",forefinger.y);
sprintf(dist,"%d",distance);
cvPutText(source,dist,cvPoint(220,320), &font, cvScalar(255, 0, 0, 0));
cvLine(source,cvPoint(forefinger.x,forefinger.y),cvPoint(secondfinger.x,secondfinger.y),cvScalar(255,0,0,0),4,8,0);
。 。 。 。 }
after morphological operations i detected the finger tip. the vector fingertips
contain the details of all the finger tip. i created an iterator to get the first and
the second fingertip coordinates.
but when i try to compile i get the error "vector iterator not dereferencable"...please help me !!1
while (1)
{
.
.
vector::iterator p = 0;
p = fingerTips.begin();
CvPoint forefinger = *p;
*p++;
CvPoint secondfinger = *p;
int distance = secondfinger.y - forefinger.y;
char dist[6];
sprintf(x_pt,"%d",forefinger.x);
sprintf(y_pt,"%d",forefinger.y);
sprintf(dist,"%d",distance);
cvPutText(source,dist,cvPoint(220,320), &font, cvScalar(255, 0, 0, 0));
cvLine(source,cvPoint(forefinger.x,forefinger.y),cvPoint(secondfinger.x,secondfinger.y),cvScalar(255,0,0,0),4,8,0);
.
.
.
.
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的向量声明是错误的。它应该是
vector::iterator p
Your vector declaration is wrong. It should have been
vector<cv::Point>::iterator p