Ask Your Question

OpenCV 3.1 - unresolved external symbol cvUpdateMotionHistory

asked 2016-04-10 04:57:21 -0500

I'm using OpenCV 3.1 and have compiled together opencv_contrib downloaded from GitHub on 2016-3-24.

I have these codes that detect moving vehicles in video and am trying to build it with VS2012 on Windows 7.

One line of the codes is cvUpdateMotionHistory:

cvUpdateMotionHistory( silh, mhi, timestamp, MHI_DURATION );

The only errors I got are these:

1>ocv-test-vc11.obj : error LNK2001: unresolved external symbol cvUpdateMotionHistory
1>E:\projects\C++\OpenCV\ocv-test-vc11\x64\Release\ocv-test-vc11.exe : fatal error LNK1120: 1 unresolved externals

The other lines work just fine, because when I comment out this single line, the solution can be successfully built and run.

I have linked opencv_video310.lib and opencv_optflow310.lib in Linker | Input. In fact, I have linked every single .lib file in my opencv's vc11\lib directory.

How do I solve this LNK error?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-04-10 05:40:46 -0500

berak gravatar image

updated 2016-04-10 06:11:05 -0500

the implementation was moved into the optflow module in opencv_contrib. and the c-api implementation seems gone alltogether.

you will have to use the c++ api:

#include "opencv2/optflow/motempl.hpp"

using namespace cv::motempl;


and link against opencv_optflow310.lib

edit flag offensive delete link more


Switching to updateMotionHistory() worked! Yet, I have to convert IplImage to Mat using cv::cvarrToMat and convert them back afterwards. Thanks anyway!

John Hany gravatar imageJohn Hany ( 2016-04-10 07:35:12 -0500 )edit

try to get rid of any IplImages entirely

berak gravatar imageberak ( 2016-04-10 07:36:58 -0500 )edit

Question Tools

1 follower


Asked: 2016-04-10 04:57:21 -0500

Seen: 1,194 times

Last updated: Apr 10 '16