• 终于在我电脑上跑通ZK大神给的TLD代码了


      请阅读我前一篇文章

      在环境WIN7+VS2010+MATLAB2010b+OpenCV2.3.1,我一直没能跑起来,极度郁闷……

      今天在搜索matrix.hpp的时候,突然发现GitHub上面,居然有人碰到的问题跟我一样,之前遇到的error如下:

     1 ??? Unexpected Standard exception from MEX file.
     2 What() is:/Users/liam/projects/OpenCV-2.3.1/modules/core/src/matrix.cpp:1305:
     3 error: (-27) create() called for the missing output array in function create
     4 
     5 Error in ==> tldTracking at 30
     6 xFJ = lk(2,tld.img{I}.input,tld.img{J}.input,xFI,xFI); % track all points by
     7 Lucas-Kanade tracker from frame I to frame J, estimate Forward-Backward error,
     8 and NCC for each point
     9 
    10 Error in ==> tldProcessFrame at 25
    11 [tBB tConf tValid tld] = tldTracking(tld,tld.bb(:,I-1),I-1,I); % frame-to-frame
    12 tracking (MedianFlow)
    13 
    14 Error in ==> tldExample at 41
    15 tld = tldProcessFrame(tld,i); % process frame i
    16 
    17 Error in ==> run_TLD at 43
    18 [bb,conf] = tldExample(opt);

      居然在混编下出错,我当时已经放弃了,因为我根本就不知道是什么问题,但今天偶然看到了,解决办法是对于lk.cpp文件中的186行,这里看仔细了,是这一行:

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

      将上述红色的0改为status,如下:

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

      这样修改之后,注意,需要重新运行compile.m,然后运行run_TLD.m即可,得到的结果还是有点奇怪的,在VS2005+OPENCV2.2中,是存在跟丢的情况,每秒处理的帧数有16帧左右,在VS2010+OPENCV2.3中,不存在跟丢的情况,但每秒处理的帧数为12帧左右~~

      我的源码下载: 请重击我

  • 相关阅读:
    Redis的安装与使用
    jQuery操作input值总结
    jquery获得select option的值和对select option的操作
    jsp弹出新窗口代码
    MyEclipse10.0优化
    MyEclipse安装FreeMarker插件
    增强MyEclipse的代码自动提示功能
    PowerDesigner 技巧【3】
    PowerDesigner 快捷键
    PowerDesigner 技巧【2】
  • 原文地址:https://www.cnblogs.com/moondark/p/2444602.html
Copyright © 2020-2023  润新知