Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ExtraveTemplateMatching进程返回空_C#_Image_Aforge - Fatal编程技术网

C# ExtraveTemplateMatching进程返回空

C# ExtraveTemplateMatching进程返回空,c#,image,aforge,C#,Image,Aforge,这是我的代码: static void Main(string[] args) { ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0); // Compare two images System.Drawing.Bitmap image1 = new System.Drawing.Bitmap("2.jpg");

这是我的代码:

static void Main(string[] args)
        {
            ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0);

            // Compare two images
            System.Drawing.Bitmap image1 = new System.Drawing.Bitmap("2.jpg");
            System.Drawing.Bitmap image2 = new System.Drawing.Bitmap("2.jpg");
            TemplateMatch[] matchings = tm.ProcessImage(image1, image2);
            MessageBox.Show(matchings[0].Similarity.ToString());
            // Check similarity level
            if (matchings[0].Similarity > 0.95)
            {

            }
        }
附件:


最终的解决方案是重写ExtreatveTemplateMatching类以更改值类型,因为pic分辨率太大,int32值不够

请务必阅读。@johnepraimtugado您能在这个问题上给我帮助吗?感谢索引超出范围异常是因为
匹配
不包含任何元素。您可能希望在
TemplateMatch[]matchings=tm.ProcessImage(image1,image2)中找到原因。我强烈建议您学习如何设置断点并调试应用程序。你可能会感到惊讶,有时一个简单的编码错误会导致你的应用程序失败。@johnepraimtugado你是对的,根本原因是匹配是空的,我在寻找原因,我尝试过其他图片,没关系,不总是失败。现在我正在检查一个巨大的源代码,没有得到任何有用的信息。你应该在帖子中指出,
ExtraveTemplateMatching
不是你的。在SO中提问时,将所有相关信息张贴在此处。知道答案的人可能因为缺乏信息而忽略了这个问题。