运动跟踪(二):segmentMotion,运动模板

http://wiki.opencv.org.cn/index.php/Cv运动分析与对象跟踪

http://wiki.opencv.org.cn/index.php/增强现实%28AR%29


opencv2中的segmentMotion内部调用的还是cvSegmentMotion这个函数。

void cv::segmentMotion(InputArray _mhi, OutputArray _segmask,
                       vector<Rect>& boundingRects,
                       double timestamp, double segThresh)
{
    Mat mhi = _mhi.getMat();
    _segmask.create(mhi.size(), CV_32F);
    CvMat c_mhi = mhi, c_segmask = _segmask.getMat();
    Ptr<CvMemStorage> storage = cvCreateMemStorage();
    Seq<CvConnectedComp> comps = cvSegmentMotion(&c_mhi, &c_segmask, storage, timestamp, segThresh);
    Seq<CvConnectedComp>::const_iterator it(comps);
    size_t i, ncomps = comps.size();
    boundingRects.resize(ncomps);
    for( i = 0; i < ncomps; i++, ++it)
        boundingRects[i] = (*it).rect;
}
CvSeq* cvSegmentMotion( const CvArr* mhi, CvArr* seg_mask, CvMemStorage* storage,
                        double timestamp, double seg_thresh );
mhi             运动历史图像
seg_mask        发现应当存储的 mask 的图像, 单通道, 32bits, 浮点数.
storage         包含运动连通域序列的内存存储仓
timestamp       当前时间,毫秒单位
seg_thresh      分割阈值,推荐等于或大于运动历史“每步”之间的间隔。
函数 cvSegmentMotion 寻找所有的运动分割,并且在seg_mask 用不同的单独数字(1,2,...)
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值