0

EDIT Human walk motion Detect链接解释了如何Opencv 2.3使用 C++ 在 Visual Studio 2010 上检测人体运动。我下载了源代码motemp9.c以及文本文件walkImgs.txtoutput.txt标题filter.h,但不理解以下内容。

我很难执行这个程序。有人可以帮助我澄清这些观点吗?

  1. motiontemp9.c文件中,在 main 下,行中的文件不存在。还是这些文件 walkImgs 和输出?

    if((ReadFP=fopen("walk2.txt", "r")) == NULL) ErrorExit(ER_READ_OPEN);
    if((WriteFP=fopen("output2.txt", "w")) == NULL) ErrorExit(ER_WRITE_OPEN);
    
  2. 运行代码出现以下错误

    error C2660: 'cvGetSeqElem' : function does not take 3 arguments
    motemp9.cpp(186): error C2227: left of '->rect' must point to class/struct/union/generic type
    motemp9.cpp(189): error C2440: '=' : cannot convert from 'CvScalar' to 'int'
    1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    motemp9.cpp(218): error C2664: 'cvCircle' : cannot convert parameter 4 from 'int' to 'CvScalar'
    1>          No constructor could take the source type, or constructor overload resolution was ambiguous
    motemp9.cpp(220): error C2664: 'cvLine' : cannot convert parameter 4 from 'int' to 'CvScalar'
    1>          No constructor could take the source type, or constructor overload resolution was ambiguous
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    

请指导运行此代码需要做什么。

4

1 回答 1

1

你能重新表述你的第一个问题吗,因为我真的不明白。

if((ReadFP=fopen("walk2.txt", "r")) == NULL) ErrorExit(ER_READ_OPEN);
if((WriteFP=fopen("output2.txt", "w")) == NULL) ErrorExit(ER_WRITE_OPEN);

这两行只是在运行程序时检查文件是否存在。如果其中一个不存在,则返回 ErrorExit

对于你的第二个问题,在这个例子中,

创建运动历史图像。这包括将图像转换为灰度,按顺序一次查找两帧之间的差异,从而创建运动分层历史的剪影图像。执行

因此,您需要将您从自己的视频中提取的图像的路径放入 walk2.txt。

希望能帮助到你

于 2013-01-22T09:43:56.697 回答