简体   繁体   English

将CalcOpticalFlowPyrLK与OpenCV 2.3.1结合使用时出错

[英]Error using calcOpticalFlowPyrLK with OpenCV 2.3.1

I am trying to use calcOpticalFlowPyrLK for feature tracking. 我正在尝试使用calcOpticalFlowPyrLK进行功能跟踪。 Function is used as follows 功能用法如下

TermCriteria termcrit(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03); TermCriteria termcrit(CV_TERMCRIT_ITER | CV_TERMCRIT_EPS,20,0.03);

Size winSize(31,31); 大小winSize(31,31);

vector < uchar > status; vector <uchar>状态;

vector < float > err; 向量<float> err;

calcOpticalFlowPyrLK(prevGray, gray, point[0], point[1], status, err, winSize, 3, termcrit, 0, 0, 0.001); calcOpticalFlowPyrLK(prevGray,灰色,point [0],point [1],status,err,winSize,3,termcrit,0,0,0.001);

All the parameter are correct. 所有参数均正确。 In point[0] there are already given set of points. 在point [0]中已经给出了一组点。 But while i try to execute the program it gives following error. 但是,当我尝试执行程序时,会出现以下错误。 I am using Visual C++ 2010. 我正在使用Visual C ++ 2010。

..................................... .....................................

First-chance exception at 0x74c426df (msvcr100.dll) in GFFER.exe: 0xC0000005: Access violation writing location 0x058fe000. GFFER.exe中0x74c426df(msvcr100.dll)的首次机会异常:0xC0000005:访问冲突写入位置0x058fe000。 Unhandled exception at 0x74c426df (msvcr100.dll) in GFFER.exe: 0xC0000005: Access violation writing location 0x058fe000. GFFER.exe中0x74c426df(msvcr100.dll)的未处理异常:0xC0000005:访问冲突写入位置0x058fe000。

..................................... .....................................

Do you have any idea how can i resolve this problem. 您有任何想法如何解决此问题。

Thanks in advance!! 提前致谢!!

Access violation writing location 访问冲突写入位置

The error seems to occur when writing data to a location which is not initialized. 将数据写入未初始化的位置时似乎会发生错误。 In your code, point[1] , status and err are the only locations where a write occurs. 在您的代码中, point [1]statuserr是唯一发生写入的位置。

status and err and defined correctly. 状态和错误并正确定义。 The problem must be with point[1] . 问题必须出在point[1] Is it of the type vector<Point2f> . 它是vector<Point2f>类型的。

Why don't you try using two separate vectors instead of an array of vectors, say, point0 point1. 为什么不尝试使用两个单独的向量而不是向量数组,例如point0 point1。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM