类型或命名空间TM_Type在EmguCV 3.0的Emgu.CV.CvEnum中不存在
本文关键字:Emgu CV CvEnum 不存在 EmguCV 命名空间 TM Type 类型 | 更新日期: 2023-09-27 18:19:53
我在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命名空间"Emgu.CV.CvEnum"中不存在类型或命名空间名称"TM_type"(是否缺少程序集引用?)
您可以使用这个:
using (Image<Gray, float> result = source.MatchTemplate(template, Emgu.CV.CvEnum.TemplateMatchingType.CcoeffNormed))