mex
| Table of Contents |
matlab vs opencv
| IplImage | cvMat or cvMatND | mxArray | |
| Allocate | IplImage* 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); |
| nRow | int img->height | int mat->rows | mwSize mxGetM(mx) |
| nCol | int img->width | int mat->cols | mwSize mxGetN(mx) |
| Depth | int img->depth | int CV_MAT_DEPTH(mat->type) | mxClassID mxGetClassID(mx) |
| nChannel | int img->nChannels | int CV_MAT_CN(mat->type) | None (Use N-D array, nRow x nCol x nDim) |
| nDim | None | int ndmat->dims | mwSize mxGetNumberofDimensions(mx) |
| dims[] | None | int* ndmat->dim | mwSize* mxGetDimensions(mx) |
Depth
| IplImage | cvMat or cvMatND | mxArray | |
| unsigned char | IPL_DEPTH_8U | CV_8UC(1or3) | mxUINT8_CLASS |
| char | IPL_DEPTH_8S | CV_8SC(1or3) | mxINT8_CLASS |
| unsigned int | IPL_DEPTH_16U | CV_16UC(1or3) | mxUINT16_CLASS |
| int | PL_DEPTH_16S | CV_16SC(1or3) | mxINT16_CLASS |
| unsigned long | mxUINT32_CLASS | ||
| long | IPL_DEPTH_32S | CV_32SC(1or3) | mxINT32_CLASS |
| float | IPL_DEPTH_32F | CV_32FC(1or3) | mxSINGLE_CLASS |
| double | IPL_DEPTH_64F | CV_64FC(1or3) | mxDOUBLE_CLASS |
Matlab compiler
mcc -B csharedlib:libpca cvPca.m cvPcaDist.m cvPcaProj.m cvPcaInvProj.m cvPcaDiffs.m -v
