Announce

PukiWiki contents have been moved into SONOTS Plugin (20070703)

matlab-mex

Table of Contents

matlab vs opencv

IplImagecvMat or cvMatNDmxArray
AllocateIplImage* cvCreateImage( cvSize(nCol, nRow), type, nChannel)cvMat* cvCreateMat(nRow, nCol, CV_MAKETYPE(Depth,nChannel))
cvMatND* cvCreateMatND(nDim, dims, type)
mxArray* mxCreateDoubleMatrix(nRow, nCol, mxREAL);
mxArray* mxCreateNumericArray(nDim, dims, type, mwREAL);
nRowint img->heightint mat->rowsmwSize mxGetM(mx)
nColint img->widthint mat->colsmwSize mxGetN(mx)
Depthint img->depthint CV_MAT_DEPTH(mat->type)mxClassID mxGetClassID(mx)
nChannelint img->nChannelsint CV_MAT_CN(mat->type)None (Use N-D array, nRow x nCol x nDim)
nDimNoneint ndmat->dimsmwSize mxGetNumberofDimensions(mx)
dims[]Noneint* ndmat->dimmwSize* mxGetDimensions(mx)

Depth

IplImagecvMat or cvMatNDmxArray
unsigned charIPL_DEPTH_8UCV_8UC(1or3)mxUINT8_CLASS
charIPL_DEPTH_8SCV_8SC(1or3)mxINT8_CLASS
unsigned intIPL_DEPTH_16UCV_16UC(1or3)mxUINT16_CLASS
intPL_DEPTH_16SCV_16SC(1or3)mxINT16_CLASS
unsigned longmxUINT32_CLASS
longIPL_DEPTH_32SCV_32SC(1or3)mxINT32_CLASS
floatIPL_DEPTH_32FCV_32FC(1or3)mxSINGLE_CLASS
doubleIPL_DEPTH_64FCV_64FC(1or3)mxDOUBLE_CLASS

Matlab compiler

mcc -B csharedlib:libpca cvPca.m cvPcaDist.m cvPcaProj.m cvPcaInvProj.m cvPcaDiffs.m -v

References