Matlab调用VIBE算法

本文介绍了如何在Matlab中调用VIBE算法进行背景 subtraction。首先,从指定资源下载源码,将C文件转换为CPP以便于mex编译。接着,展示了mex接口文件VIBE_.cpp的编写,并提供了调用VIBE算法的示例代码。实验结果显示了算法的应用效果,所有代码可在提供的链接中下载。
摘要由CSDN通过智能技术生成

从参考[1]中下载源码,VIBE的算法实现由vibe-background-sequential.c和vibe-background-sequential.h构成,为了mex编译方便将vibe-background-sequential.c文件的后缀改为cpp。

mex的接口文件为VIBE_.cpp:

// VIBE_.cpp
// ------------------------------------------------------------------ -
// Reference: your-main-file-sequential.c and mexopencv-master/BackgroundSubtractorMOG2_.cpp
// Authors : LSS
// Date : 26 / 04 / 2017
// Last modified : 28 / 04 / 2017
// ------------------------------------------------------------------ -

#include "mex.h"
#include "matrix.h" // for the mxArray
#include <map>
#include <cstdint>
#include <vector>
#include <string>

#include "vibe-background-sequential.h"
#include "vibe-background-sequential.cpp"




using namespace std;


class VIBE
{
private:
	vibeModel_Sequential_t *model;
	bool bfirstFrame;
public:
	VIBE()
	{
		model = (vibeModel_Sequential_t*)libvibeModel_Sequential_New();
		bfirstFrame = true;
	};

	VIBE(const VIBE & vibe)
	{
		model = (vibeModel_Sequential_t*)libvibeModel_Sequential_New();

		/* Default parameters values. */
		model->numberOfSamples = vibe.model->numberOfSamples;
		model->matchingThreshold = vibe.model->matchingThreshold;
		model->matchingNumber = vibe.model->matchingNumber;
		model->updateFactor = vibe.model->updateFactor;

		/* Storage for the history. */
		model->historyImage = vibe.model->historyImage;
		model->historyBuffer = vibe.model->historyBuffer;
		model->lastHistoryImageSwapped = vibe.mode
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值