header photo

How To Read an Image and convert to EmguCV Type?

Here's how to read an image file from your hard drive and use it as EmguCV type color image in your code?

Image<bgr, byte> EmguImage = new Image<bgr, byte>(new Bitmap(@"E:\IMAGES\BirthdayCard.jpg")); 

Description:  We declared a new variable of type EmguCV color image. We called this variable 'EmguImage'. we initialized it(assigned value to it) to an image named ‘BirthdayCard’ with .jpg extension – remember to ALWAYS add extension of file!

This BirthdayCard.jpg is stored at location ‘E:\IMAGES\’ so the complete path of image becomes:


We added the ‘@’ sign before the path to allow single back-slash (\) to be read as a single back -slash as in a path. If you remove ‘@’ sign, then make sure you add one more back-slash to each existing one, like this: "E:\\IMAGES\\BirthdayCard.jpg"

Go Back

usefull tip,thanks for share

I did not know about the @ symbol. Thanks for the tip.