错误:'calcOpticalFlowPyrLK'不是'cv'的成员 - OpenCV 2.4.2

时间:2012-07-25 02:16:55

标签: c++ opencv g++ ubuntu-11.10

我在OpenCV 2.4.2上遇到此错误。

我正在使用这行代码:

 cv::calcOpticalFlowPyrLK(prev, next, prev_pts, next_pts, status, error);

在编译时它显示此错误:

testopticalflow.cpp:75:4: error: ‘calcOpticalFlowPyrLK’ is not a member of ‘cv’

如果我使用pkg-config

,这是结果
pkg-config opencv --libs
/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so  

抱歉,对于Linux环境,我还是个新手,所以我不知道哪里出错了。

1 个答案:

答案 0 :(得分:3)

抱歉,这个愚蠢的错误。 我忘了把它添加为标题:

#include <opencv2/video/tracking.hpp>