gpt4 book ai didi

c# - EmguCV 3.0 中的 Emgu.CV.CvEnum 中不存在类型或命名空间 TM_TYPE

转载 作者:太空宇宙 更新时间:2023-11-03 10:21:13 28 4
gpt4 key购买 nike

我在 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))

关于c# - EmguCV 3.0 中的 Emgu.CV.CvEnum 中不存在类型或命名空间 TM_TYPE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33442169/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com