I'm working with emgu in unity. I'm trying to test CascadeClassifier for face detection.
I want to call DetectMultiScale from the CascadeClassifier class, which is defined as:
///
/// The image where the objects are to be detected from
/// The factor by which the search window is scaled between the subsequent scans, for example, 1.1 means increasing window by 10%
/// Minimum number (minus 1) of neighbor rectangles that makes up an object. All the groups of a smaller number of rectangles than min_neighbors-1 are rejected. If min_neighbors is 0, the function does not any grouping at all and returns all the detected candidate rectangles, which may be useful if the user wants to apply a customized grouping procedure. Use 3 for default.
/// Minimum window size. Use Size.Empty for default, where it is set to the size of samples the classifier has been trained on (~20x20 for face detection)
/// Maxumum window size. Use Size.Empty for default, where the parameter will be ignored.
/// The objects detected, one array per channel
public Rectangle[] DetectMultiScale(IInputArray image, double scaleFactor = 1.1, int minNeighbors = 3, Size minSize = new Size(), Size maxSize = new Size())
{
using (Util.VectorOfRect rectangles = new Util.VectorOfRect())
{
CvCascadeClassifierDetectMultiScale(_ptr, image.InputArrayPtr, rectangles, scaleFactor, minNeighbors, 0, ref minSize, ref maxSize);
return rectangles.ToArray();
}
}
The call in my code is as:
Image picture = new Image("lena.jpg");
Image img_gray = image.Convert();
CascadeClassifier haar = new CascadeClassifier("haarcascade_frontalface_default.xml");
Rectangle[] face = haar.DetectMultiScale( img_gray, 1.1, 10, Size.Empty, Size.Empty);
But I'm getting errors:
> error CS1502: The best overloaded method match for `Emgu.CV.CascadeClassifier.DetectMultiScale(Emgu.CV.IInputArray, double, int, System.Drawing.Size, System.Drawing.Size)' has some invalid arguments> error CS1503: Argument `#4' cannot convert `System.Drawing.Size' expression to type `System.Drawing.Size'
Can anyone help?
↧