问题遇到的现象和发生背景
想要学习图像识别方面的知识,在利用C#编写查找轮廓时,代码编写没有直接报错,但运行该findcontours函数时就直接报错
问题相关代码,请勿粘贴截图
Mat mat = Classimageconver.imageconver();
Mat mat1 = Mat.Zeros(mat.Size(), mat.Type());
Cv2.Threshold(mat, mat1, 50, 150, ThresholdTypes.Binary);
Mat mat2 = Mat.Zeros(mat.Size(), mat.Type());
Cv2.FindContours(mat1, out Point[][] points1, out HierarchyIndex[] hierarchyIndices,
RetrievalModes.Tree, ContourApproximationModes.ApproxSimple, new Point(0, 0));
Scalar scalar = new Scalar(0, 0, 255);
Cv2.DrawContours(mat, points1, -1, scalar, 1);
imageconvertbitmap.Imageconvertbitmap(mat);
运行结果及报错内容

我的解答思路和尝试过的方法
通过排查发现,只要运行该函数方法,就会直接报错。但编写代码没有报错,怀疑是定义的两个输出函数points和hierarchyindices有问题,但不知道该怎么入手。
我想要达到的结果
因为是刚接触编程和图像识别方面的,所以只要能运行该函数,展现出图像的轮廓即可