#include <iostream>
#include <math.h>
#include "engine.h"
#include "engine.h"
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
bool mat2mxArray(Mat imgSrc,mxArray* pMat)
{
if (!imgSrc.empty())
{
mxArray * pv;
imgSrc = imgSrc.t();
pv = mxCreateNumericMatrix(imgSrc.cols,imgSrc.rows,mxSINGLE_CLASS, mxREAL);
memcpy(mxGetPr(pMat), imgSrc.data, mxGetNumberOfElements(pv)*sizeof(double));
mxDestroyArray(pv);
}
else
{
printf("imSrc is empty! \n");
return false;
}
}
void mxArray2mat(mxArray* pMat,Mat &imgSrc)
{
memcpy(imgSrc.data,mxGetPr(pMat),mxGetNumberOfElements(pMat)*sizeof(double));
imgSrc=imgSrc.t();
}
int calPinv(Mat a,Mat &b)
{
Engine *ep; //定义Matlab引擎指针。
if (!(ep=engOpen(NULL))) //测试是否启动Matlab引擎成功。
{
cout <<"Can't start Matlab engine!
c++调用matlab求伪逆
最新推荐文章于 2023-05-23 20:39:22 发布