First time here? Check out the FAQ!
answered 2013-01-09 08:23:49 -0600
You do not have to write your own conversion function as you can convert an image with the built-in cvtColor function.
cvtColor
So for converting an RGB image to grayscale you can call cvtColor(src, dst, CV_RGB2GRAY).
cvtColor(src, dst, CV_RGB2GRAY)