Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Issue with lk.cpp and openCV 2.3.1 #22

Open
le-vision opened this Issue Aug 19, 2011 · 1 comment

Comments

Projects
None yet
1 participant

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 :)

@le-vision le-vision closed this Oct 26, 2011

@le-vision le-vision reopened this Oct 26, 2011

laughinghan added a commit to laughinghan/OpenTLD that referenced this issue Nov 13, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment