This code converts an RGB image to a black and white image in C with MEX. I this together for a school project and I couldn't find any good examples of MEX with image processing. One note the code is currently hard coded to handle only UINT8, however it should be trivial to convert that data type. Enjoy.
MATLAB 7.1.0 (R14SP3)
I built this under Windows with VC 2003 & R14SP3, but there is nothing platform or compiler specific about it.