header photo

Helpful Project Tips & Answers


Question: "Which version of EmguCV should I download/use? "
------------------------------------------------------------------------------------------------------------------------------------------
Answer:   You should use any latest version that is compatible with your system.
If you use a 32-bit operating system, please select a  'x86' version.
NOTE: Those who use 64-bit Operating system, please select a  'x64' version -they're for you!
select your desired version here, or use the i one i do:
libemgucv-windows-x86-2.2.1.1150.exe - Download it from here
64-bit Windows users Download this version in 64 bit Here


Question:
"
In which folder should the unmanaged dlls be put?"
------------------------------------------------------------------------------------------------------------------------------------------
Answer:   unmanaged dlls go EXACTLY where your application's .exe file is. Usually  its the DEBUG folder in you project's BIN folder. as we have in our CameraCapture project.
but in the BIN folder,some of you might also have a RELEASE folder along with DEBUG   folder.
in this case, copy-paste the unmanaged code(the opencv_YYY220.dlls) to your Release folder as well!

note: '
YYY' in opencv_YYY220.dlls refers to any arbitrary required dlls. it is not a name of any particular dll file!

Question: How to Display an EmguCV image in Windows Form Picture Box?
------------------------------------------------------------------------------------------------------------------------------------------
If EmguImage is an EmguCV type image, then you can convert it Windows type Image and then show it in a picture box as follows:

 //Show the image in Windows Form PictureBox called "pictureBox1"
pictureBox1.Image = EmguImage.ToBitmap();
 


Question: How to SAVE the captured EmguCV image into specific directory or folder? (Asked by Richard) 
------------------------------------------------------------------------------------------------------------------------------------------
You can simply save an EmguCV type image to anywhere like this:
Let's say, you wish to Save an EmguCV image (take 'EmguImage' as an example) to your desired location, say, you want to save it at 'E:\ ' and wish to call it 'MyPic'.
Decide on the type of image you want it to be, and save it like so:

EmguImage.Save(@"E:\MyPic.jpg");

NOTE:  do NOT forget to give your image an extension! i like to save it as '.jpg' (saves space). you could try '.bmp'.
and do NOT forget the @ sign before your path string. it allows back slashes in a string, so helpful when giving a path in string.

Question: "Is Viola-Jones Classification/Detection for 'any object' detection? be it a face, eye, car, ball etc etc?!
------------------------------------------------------------------------------------------------------------------------------------------
Answer: Indeed! Viola-Jones' Haar Classifier is a generic detector, whose classification depends on the trained data stored in the XML it uses. so whatever object was used to train this XML, the classifier will detect that object in the image.e.g, if XML holds the trained data for human faces, then Viola-Jones Haar Classifier becomes "face detector". but if XML had data stored about a car, then the classifier works as "Car detector".


Question:
Do I have to first train an XML file for face or object detection myself?!

------------------------------------------------------------------------------------------------------------------------------------------

Answer:  For face detection, NO! Not at ALL! Please do NOT be mistaken. You do NOT have to train an XML file for face detection yourself!! Thanks to the Viola & Jones and other people who had taken on this strenuous job, they have already trained XMLs with thousands of face samples. So those XML files are bound to give good results, up to 100% as I’ve seen. All you need is to use these available trained XML files.  

However if it’s an object other than a ‘face’ that you’re trying to detect, say, a car, THEN yes! You may need to train an XML file ONLY IF you do not find any such XML over the internet. Download these XMLs & see if there's the one you were looking for. You can Download Here the various XML files I had found for frontal face detection in OpenCV setup and EmguCV setup folders.

Question: How to LOAD an image from a directory/Folder and Convert it EmguCV type Image?
------------------------------------------------------------------------------------------------------------------------------------------
For that, first load your image to a Windows Forms Image say, 'InputImg'.
Next convert this InputImg to EmguCV type image 'EmguImage': 

//Read an image from hard disk at location e.g ‘E:\IMAGES\’
Image InputImg = Image.FromFile(@"E:\IMAGES\MyPic.jpg");   //1-
Image<Bgr,byte> EmguImage = new Image<Bgr,byte>(new Bitmap(InputImg)); //2-

And then insert the face detection code after  you have set this image source.
NOTE: the @ sign in the image path above code makes path valid without having to write double slashes in path. Remove @ sign and see the error.
------------------------------------------------------------------------------------------------------------------------------------------