Reputation: 13616
Any Idea how to convert Image
type to Image<Bgr, Byte>
type?
I get the image from PictureBox
Control and I need to convert it to Image<Bgr, Byte>
type.
Image pictureBoxImage = pictureBox.Image;
Image<Bgr, Byte> image = // ...
Upvotes: 2
Views: 18223
Reputation: 3442
For Emgu.CV 4.5 I had to add the Emgu.CV.Bitmap package and use bitmap.ToImage<Bgr, byte>()
:
using (Bitmap bitmap = new Bitmap(pictureBox.Image))
{
Image<Bgr, byte> image = bitmap.ToImage<Bgr, byte>();
}
Upvotes: 1
Reputation: 33
You can also do it like this:
Image<Bgr, Byte> IMG = new Image<Bgr, byte>((Bitmap)pictureBox1.Image);
OR
var IMG = new Image<Bgr, byte>((Bitmap)pictureBox1.Image);
Upvotes: 1
Reputation: 55956
According the documentation:
Creating image from Bitmap
It is also possible to create an
Image<TColor, TDepth>
from a .NetBitmap
object
So, you should be able to do:
var image = new Image<Bgr, Byte>(new Bitmap(pictureBox.Image));
Upvotes: 5