Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by ptp!

How Could I Use Ez Face Detection In My Vs Application

Hello everyone especially @ptp,

I need to know how to use the ez face detection method in my vs app

i try this code but it didn't work

ValuePair vp = (ValuePair)cbVideoDevices.SelectedItem;
camera.StartCamera(vp, pictureBox1, 640, 480);


all I need is to use ez face detection as emgu face detection doesn't work with ez camera , even i try to implement it on my jd camera it throw an exception that it can't implicit emgu quary frame to ez camera . get current bitmap

also i try this code

ValuePair videocamera = (ValuePair)cbVideoDevices.SelectedItem;
camera.StartCamera(videocamera, pictureBox1, 640, 480);


//Bitmap bmpImage = this.camera.GetCurrentBitmap;
//if (this.camera.GetCurrentBitmap == null)
// MessageBox.Show("Error");

//wait 10 seconds for the first camera frame
Image ImageFrame = null;
EventWaitHandle startEvent;
startEvent = new EventWaitHandle(false, EventResetMode.AutoReset);

// Bitmap bmapImageOutput = this.camera.GetCurrentBitmap;
// pictureBox1.Image = bmapImageOutput;
//ImageFrame = new Image(this.camera.GetCurrentBitmap);

if (ImageFrame != null)

Image grayImage = ImageFrame.Convert();
var faces = grayImage.DetectHaarCascade(facedetection, 1.4, 4,
new Size(20, 20))[0];
foreach (var face in faces)
//draw the face detected in the 0th (gray) ch
ImageFrame.Draw(face.rect, new Bgr(Color.Blue), 3);
Bitmap c = ImageFrame.ToBitmap();
Bitmap bmp = new Bitmap(face.rect.Width, face.rect.Height);
g = Graphics.FromImage(bmp);
g.DrawImage(c, 0, 0, face.rect, GraphicsUnit.Pixel);
MessageBox.Show("Showing Image in PicBox2");

MessageBox.Show("FD Code didn't RUN");
pictureBox1.Image = ImageFrame.ToBitmap();

please use the code format tags before and after your c# fragment code, it makes a huge difference when reading code.

The EZB SDK method:



is very similar to the :


ObjectLocation objectLocation = _camera.CameraCustomColorDetection.GetObjectLocationByColor(

How to start:

1) you will need to get familiar how it works inside ARC. There is at least one tutorial:

but there's more information/help inside ARC (i.e. Blue Question mark in controls)

2) EZ-B SDK example c# code has a project:
Tutorial 11 - Color Vision Tracking

which uses the CameraCustomColorDetection.GetObjectLocationByColor

I think if you master the above two points (ColorDetection) you can do other camera Detection methods.

I just open visual studio and is really very simple to detect a Face.


private void CameraOnOnNewFrame()
this.pictureBox1.Invoke(new EventHandler(delegate { this.pictureBox1.Image = this.camera.GetCurrentBitmap; }));
Interlocked.Increment(ref this.fpsCounter);

if (this.fpsCounter == 1)
var objectLocation = this.camera.CameraFaceDetection.GetFaceDetection();
if (objectLocation.IsObjectFound)
WriteDebug(string.Format("Face detected at H:{0} V:{1}", objectLocation.HorizontalLocation, objectLocation.VerticalLocation));


the code runs every 1 st video frame per second.
Your consistent guidance helps me to increase my potential in work . You show the path of brighter world , which makes me able grasp my aims .
Thankful to dear Boss ^_^

Thanks for kind words, but do not forget:


Give a Man a Fish, and You Feed Him for a Day. Teach a Man To Fish, and You Feed Him for a Lifetime

you are using a EZ-Robot software, it's very important to get familiar with the "user" tool, before embracing the SDK, some functionalities are easy to see working in the ARC side, there are a lot of tutorials, and posts where you can learn more.
The camera.GetCurrentBitmap() is only available within the CameraOnOnNewFrame() event. Because until CameraOnOnNewFrame() is raised, there are no images to "get".
thanks @DJ Sures alot for ur replay

@ptp would u contact me on my email or send me ur email
I've made it using haar cascade & i want to share it with u & to get ur feedback of it
would u give me that chance please .
my email (shaimaabes@yahoo.com)