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

我在 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配置的结果


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环境新手,不知道是哪里出错了。

时间:

抱歉,这是个愚蠢的错误。我忘记添加头了:


#include <opencv2/video/tracking.hpp>

...