External Links:
[1] http://www.ee.columbia.edu/~marios/matlab/matlab_tricks.html
[2] http://www-pord.ucsd.edu/~matlab/
[3] http://www.cs.ubc.ca/~murphyk/Software/matlab_tips.html
[4] http://www.ecogito.net/matlab/
Amazon
Sunday, December 9, 2007
MATLAB tips and tricks
Posted by
innersmile
at
2:11 PM
0
comments
Labels: MATLAB
Saturday, December 8, 2007
MATLAB Mex File for Const Time Median Filtering
Step1:
Download the C code from http://nomis80.org/ctmf.html
Step2:
Write the Mex function below, for example, with
name ctmf_mex.c
Step3:
In Matlab, run "mex ctmf_mex.c ctmf.c -output ctmf"
#include "ctmf.h"
/*
void ctmf(
const unsigned char* const src, unsigned char* const dst,
const int width, const int height,
const int src_step, const int dst_step,
const int r, const int cn, const long unsigned int memsize
);
*/
#include "mex.h"
#include "matrix.h"
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
unsigned char *I0, *I;
int height, width, r;
mwSize dims[2];
/* Check for proper number of arguments */
if (nrhs != 2) {
mexErrMsgTxt("Two input arguments required.");
} else if (nlhs > 1) {
mexErrMsgTxt("Too many output arguments.");
}
I0 = (unsigned char*)mxGetPr(prhs[0]);
/* Check the dimensions of Y. Y can be 4 X 1 or 1 X 4. */
height = mxGetM(prhs[0]);
width = mxGetN(prhs[0]);
r = (int)mxGetScalar(prhs[1]);
if (!mxIsClass(prhs[0],"uint8")) {
mexErrMsgTxt("I0 has be a matrix of type uint8.");
}
dims[0] = height;
dims[1] = width;
/* Create a matrix for the return argument */
plhs[0] = mxCreateNumericArray(2, dims, mxUINT8_CLASS, 0);
I = (unsigned char*)mxGetPr(plhs[0]);
ctmf(I0, I, height, width,
height, height,
r, 1, 512*1024
);
}
Posted by
innersmile
at
10:35 PM
0
comments
Labels: image processing, MATLAB, programming
magic commands in iPython
from IPython.iplib import InteractiveShell
#magic function about
def magic_about(self,parameter_s=''):
"""Equivalent to ... """
print "hello world"
InteractiveShell.magic_about = magic_about
del magic_about
http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/ipython.html
http://ipython.scipy.org/moin/IpythonExtensionApi
Posted by
innersmile
at
11:04 AM
0
comments