RSS
 

OpenCV: Converting an image to gray scale

11 Jun

This is an easy way to convert 3 channel image which means color image:

// convert to gray scale
IplImage* img_gray = cvCreateImage( cvSize(img_rgb->width, img_rgb->height), IPL_DEPTH_8U, 1 );
cvCvtColor( img_rgb, img_gray, CV_BGR2GRAY );

The standard color sapce in OpenCV is BGR.

 
2 Comments

Posted in OpenCV

 

Leave a Reply

 

 
  1. KattyBlackyard

    June 15, 2009 at 2:02 pm

    I really like your post. Does it copyright protected?

     
  2. admin

    June 15, 2009 at 6:20 pm

    You can use it freely. There is no copyright and if there is one it will be the most open GPL.