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.
How it works? I don't know much about how to run MEX file.
Your right it did just handle grayscale. I threw in a function so it can take the grayscale image and convert it to a black & white.
This isn't RGB to black and white, it's RGB to gray scale.
Cleaned up the code a bit.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.