zk00006 / OpenTLD

OpenTLD is an open source library for real-time 2D tracking of a single object in video. This repository is no longer under development. For latest version see: http://www.tldvision.com/tld2.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with lk.cpp and openCV 2.3.1

le-vision opened this issue · comments

Hi,

I am using Matlab R2011a and openCV 2.3.1 on a MacBook Pro (os x 10.6.8).

I successfully compiled the mex files as detailed here: https://github.com/zk00006/OpenTLD/wiki/Installation.

However, at runtime, I received the following error:


??? Unexpected Standard exception from MEX file.
What() is:/Users/liam/projects/OpenCV-2.3.1/modules/core/src/matrix.cpp:1305:
error: (-27) create() called for the missing output array in function create

Error in ==> tldTracking at 30
xFJ = lk(2,tld.img{I}.input,tld.img{J}.input,xFI,xFI); % track all points by
Lucas-Kanade tracker from frame I to frame J, estimate Forward-Backward error,
and NCC for each point

Error in ==> tldProcessFrame at 25
[tBB tConf tValid tld] = tldTracking(tld,tld.bb(:,I-1),I-1,I); % frame-to-frame
tracking (MedianFlow)

Error in ==> tldExample at 41
tld = tldProcessFrame(tld,i); % process frame i

Error in ==> run_TLD at 43
[bb,conf] = tldExample(opt);


I tracked the problem down to line 186 of lk.cpp, and changed the line from:

        cvCalcOpticalFlowPyrLK( IMG[J], IMG[I], PYR[J], PYR[I], points[1], points[2], nPts, cvSize(win_size,win_size), Level, 0     , 0, cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03), CV_LKFLOW_INITIAL_GUESSES | CV_LKFLOW_PYR_A_READY | CV_LKFLOW_PYR_B_READY );

to:

        cvCalcOpticalFlowPyrLK( IMG[J], IMG[I], PYR[J], PYR[I], points[1], points[2], nPts, cvSize(win_size,win_size), Level, status     , 0, cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03), CV_LKFLOW_INITIAL_GUESSES | CV_LKFLOW_PYR_A_READY | CV_LKFLOW_PYR_B_READY );

i.e. changed the 10th argument from '0' to 'status', and this solved the problem.

Hope this helps.

Just to update, I noticed that the same problem occurs on a windows (32bit and 64bit) compilation. So I assume this is an issue with moving from opencv2.2 to opencv2.3.1.

I therefore removed the reference to os x in the title of this issue.

The same solution I give in the above post resolves the issue :)