mctuna mctuna - 4 months ago 26
C# Question

Converting from gray to double not possible

I am trying to implement an edge detection method. Since it is impossible to copy here all lines I have copied just related codes. When I compile, I get this error:

Unable to cast object of type 'Emgu.CV.Structure.Gray' to type 'System.IConvertible'.

I have already searched it but I couldn't find something useful.
Is there any way to convert MyImage from Gray to Double?

Thanks in advance

Image<Gray,Byte> MyImage = null;
public Gray input_i(int x, int y, int z)
Gray input;
input = MyImage[x,y];
return input;

result[I] += hueckel_func.HueckelDisk(point_x, point_y, I) * Convert.ToDouble(input_i(point_a, point_b, I));


Just get the Intensity property, it's already a double:

result[I] += hueckel_func.HueckelDisk(point_x, point_y, I) * input_i(point_a, point_b, I).Intensity;