I'm using the Emgu CV 2.4.0.1717 and whenever I declare the Mat class it does not exist. I am trying to create an application using c# that can capture an image. This is for my Facial Recognition project.
I was trying to declare a Mat object but it does not exist. I've tried using other versions of Emgu CV and it worked. However, the HaarCascade does not exist. It stated that I should use CascadeClassifier instead but there's still an error. Here is my code:
public partial class Camera : Form
{
private VideoCapture cap;
private HaarCascade haar;
private void Camera_Load(object sender, EventArgs e)
{
// passing 0 gets zeroth webcam
cap = new VideoCapture(0);
// adjust path to find your xml
haar = new HaarCascade(
"haarcascade_frontalface_default.xml");
}
private void timer1_Tick(object sender, EventArgs e)
{
using (Image<Bgr, byte> nextFrame = cap.QueryFrame())
{
if (nextFrame != null)
{
Image<Gray, byte> grayframe = nextFrame.Convert<Gray, byte>();
var faces =
grayframe.DetectHaarCascade(
haar, 1.4, 4,
HAAR_DETECTION_TYPE.DO_CANNY_PRUNING,
new Size(nextFrame.Width / 8, nextFrame.Height / 8)
)[0];
foreach (var face in faces)
{
nextFrame.Draw(face.rect, new Bgr(0, double.MaxValue, 0), 3);
}
imgCamUser.Image = nextFrame.ToBitmap();
}
}
}
}