views:

287

answers:

1

Hi. I am new to EmguCV. I want to convert an rgb image into gray scale. For the conversion I have used the code

Image<Gray,byte> grayImage = ColordImage.Convert<Gray, byte>();

Now when i compile this code in C# it gives no error,but when i run it then after a few seconds it gives me the exception at this line of code that this type of conversion is not supported by OpenCV. Now can any one help me solve this problem.

Regards Amal

+2  A: 

It may depend on the type of colour that ColordImage is.

For instance, this works:

Capture cap = new Capture(1);
Image <Bgr,Byte> ColordImage = cap.QueryFrame();
Image <Gray,Byte> grayImage = ColordImage.Convert<Gray, Byte>();
imageBox1.Image = grayImage;

If you could supply more of your code, it might become more obvious what's going on.

Tom Wright