EmguCV 3.0 中的 Emgu.CV.CvEnum 中不存在类型或命名空间 TM_TYPE
Type or namespace TM_TYPE does not exists in Emgu.CV.CvEnum in EmguCV 3.0
我在 EmguCV 中遇到错误,有没有人知道这里的问题是我的代码:
Image<Bgr, byte> source = new Image<Bgr, byte>(@"D:\work\htdocs\coc\public\Barracks\b6.bmp"); // Image B
Image<Bgr, byte> template = new Image<Bgr, byte>(@"D:\work\htdocs\coc\public\Barracks\Cropped\b6-1.bmp"); // Image A
Image<Bgr, byte> imageToShow = source.Copy();
using (Image<Gray, float> result = source.MatchTemplate(template, Emgu.CV.CvEnum.TM_TYPE.CV_TM_CCOEFF_NORMED))
{
double[] minValues, maxValues;
Point[] minLocations, maxLocations;
result.MinMax(out minValues, out maxValues, out minLocations, out maxLocations);
// You can try different values of the threshold. I guess somewhere between 0.75 and 0.95 would be good.
if (maxValues[0] > 0.9)
{
// This is a match. Do something with it, for example draw a rectangle around it.
Rectangle match = new Rectangle(maxLocations[0], template.Size);
imageToShow.Draw(match, new Bgr(Color.Red), 3);
}
}
// Show imageToShow in an ImageBox (here assumed to be called imageBox1)
imageBox1.Image = imageToShow;
我遇到的问题是:
严重性代码描述项目文件行
错误 CS0234 类型或命名空间名称 'TM_TYPE' 在命名空间 'Emgu.CV.CvEnum' 中不存在(是否缺少程序集引用?)
你可以使用这个:
using (Image<Gray, float> result = source.MatchTemplate(template, Emgu.CV.CvEnum.TemplateMatchingType.CcoeffNormed))
我在 EmguCV 中遇到错误,有没有人知道这里的问题是我的代码:
Image<Bgr, byte> source = new Image<Bgr, byte>(@"D:\work\htdocs\coc\public\Barracks\b6.bmp"); // Image B
Image<Bgr, byte> template = new Image<Bgr, byte>(@"D:\work\htdocs\coc\public\Barracks\Cropped\b6-1.bmp"); // Image A
Image<Bgr, byte> imageToShow = source.Copy();
using (Image<Gray, float> result = source.MatchTemplate(template, Emgu.CV.CvEnum.TM_TYPE.CV_TM_CCOEFF_NORMED))
{
double[] minValues, maxValues;
Point[] minLocations, maxLocations;
result.MinMax(out minValues, out maxValues, out minLocations, out maxLocations);
// You can try different values of the threshold. I guess somewhere between 0.75 and 0.95 would be good.
if (maxValues[0] > 0.9)
{
// This is a match. Do something with it, for example draw a rectangle around it.
Rectangle match = new Rectangle(maxLocations[0], template.Size);
imageToShow.Draw(match, new Bgr(Color.Red), 3);
}
}
// Show imageToShow in an ImageBox (here assumed to be called imageBox1)
imageBox1.Image = imageToShow;
我遇到的问题是:
严重性代码描述项目文件行 错误 CS0234 类型或命名空间名称 'TM_TYPE' 在命名空间 'Emgu.CV.CvEnum' 中不存在(是否缺少程序集引用?)
你可以使用这个:
using (Image<Gray, float> result = source.MatchTemplate(template, Emgu.CV.CvEnum.TemplateMatchingType.CcoeffNormed))