How to convert Image <Gray, Byte> to Image <Gray, float>?
I'm trying to put one image from another, something like this:
Image<Gray, float> result, secondImage; Image<Gray, byte> firstImage; result = firstImage - secondImage;
But it gives an error
Operator '-' cannot be applied to operands of type 'Emgu.CV.Image<Emgu.CV.Structure.Gray,byte>' and 'Emgu.CV.Image<Emgu.CV.Structure.Gray,float>'
Maybe I need to convert firstImage to type Image<Gray, float>
. But I do not know how to do this.
+4
1 answer
Quote documentation :
Color and depth conversion
Converting an image between different colors and depths is simple. For example, if you have Image img1 and you want to convert it to a Single grayscale image, all you have to do is
Image<Gray, Single> img2 = img1.Convert<Gray, Single>();
So in your case you can use
result = firstImage.Convert<Gray, float>() - secondImage;
+7