📄 mex_gausstransform.c.svn-base
字号:
/*%%=====================================================================
%% Project: Pointset Registration using Gaussian Mixture Model
%% Module: $RCSfile: mex_GaussTransform.c,v $
%% Language: C
%% Author: $Author: bjian $
%% Date: $Date: 2008/04/06 03:59:16 $
%% Version: $Revision: 1.1 $
%%=====================================================================*/
#include "mex.h"
double GaussTransform(double* A, double* B, int m, int n, int dim, double scale, double* grad);
void mexFunction(int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
/* Declare variables */
int m, n, dim;
double *A, *B, *result, *grad, scale;
/* Check for proper number of input and output arguments */
if (nrhs != 3) {
mexErrMsgTxt("Three input arguments required.");
}
if (nlhs > 2){
mexErrMsgTxt("Too many output arguments.");
}
/* Check data type of input argument */
if (!(mxIsDouble(prhs[0]))) {
mexErrMsgTxt("Input array must be of type double.");
}
if (!(mxIsDouble(prhs[1]))) {
mexErrMsgTxt("Input array must be of type double.");
}
if (!(mxIsDouble(prhs[2]))) {
mexErrMsgTxt("Input array must be of type double.");
}
/* Get the number of elements in the input argument */
/* elements=mxGetNumberOfElements(prhs[0]); */
/* Get the data */
A = (double *)mxGetPr(prhs[0]);
B = (double *)mxGetPr(prhs[1]);
scale = mxGetScalar(prhs[2]);
/* Get the dimensions of the matrix input A&B. */
m = mxGetN(prhs[0]);
n = mxGetN(prhs[1]);
dim = mxGetM(prhs[0]);
if (mxGetM(prhs[1])!=dim)
{
mexErrMsgTxt("The two input point sets should have same dimension.");
}
/* Allocate the space for the return argument */
plhs[0] = mxCreateDoubleMatrix(1,1,mxREAL);
plhs[1] = mxCreateDoubleMatrix(dim,m,mxREAL);
result = mxGetPr(plhs[0]);
grad = mxGetPr(plhs[1]);
*result = GaussTransform(A, B, m, n, dim, scale, grad);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -