2013-01-21 35 views
0

EDIT Human walk motion Detect链接说明如何在Visual Studio 2010中检测人体运动与Opencv 2.3与C++。我下载了源代码motemp9.c以及文本文件walkImgs.txtoutput.txt和标头filter.h,但不明白以下内容。运动检测代码{编辑}

我很难执行此程序。有人能帮我澄清这些问题吗?

  1. motiontemp9.c文件中,主要文件中的行不存在。或者这些文件是否为walkImgs和输出?上运行的代码

    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 ========== 
    

在需要做运行这段代码是什么请指导发生

if((ReadFP=fopen("walk2.txt", "r")) == NULL) ErrorExit(ER_READ_OPEN); 
if((WriteFP=fopen("output2.txt", "w")) == NULL) ErrorExit(ER_WRITE_OPEN); 
  • 以下错误。

  • 回答

    1

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

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

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

    关于第二个问题,在这个例子中,

    Create the motion history image. This includes converting the image to grayscale, finding the difference between two frames at a time in sequence order, which creates a silhouette image of the layered history of the motion. Implementation

    所以,你需要把walk2.txt您从提取的图像的路径你自己的视频。

    希望它有帮助

    +0

    嘿,谢谢你的答复。第一个问题意味着网页中提供的文件是walkImgs.txt和output.txt,if语句检查if((ReadFP = fopen(“walk2.txt”,“r”))== NULL)ErrorExit( ER_READ_OPEN); if((WriteFP = fopen(“output2.txt”,“w”))== NULL)ErrorExit(ER_WRITE_OPEN);所以,我认为它应该是((ReadFP = fopen(“walkImgs.txt”,“r”))== NULL)ErrorExit(ER_READ_OPEN);如果((WriteFP = fopen(“output.txt”,“w”))== NULL)ErrorExit(ER_WRITE_OPEN);(B)我需要捕获&框架我自己的视频。如何将提取的图像的路径walkImgs.txt,而不是wakl2.txt。 – Chaitali

    +0

    是的,你只需要改变你的价值即可。 – ThiS

    +0

    这意味着代码中的if语句中提到的文件名是不正确的?我如何在文件中写入帧号?此外,使用CV_RGB时出现此错误>>“#define CV_RGB(r,g,b )cvScalar((b),(g),(r),0)错误:没有合适的从cvScalar到int的转换函数存在“。该怎么办?请多解释一下。 – Chaitali