C# Visual Studio C中打开CV v3.1时出错#

C# Visual Studio C中打开CV v3.1时出错#,c#,visual-studio-2015,opencv3.1,C#,Visual Studio 2015,Opencv3.1,我正在做一个学校项目,我需要使用OpenCV 我尝试使用OpenCV提供的函数“FindOnTours”。 但是当我调用这个函数时,我系统地得到一个错误,程序就结束了。 没有给我任何建议或错误信息 我把代码中出错的部分放在下面。 问我是否需要在我的代码中看到其他内容 /// <summary> /// Detect the contour of the image. /// </summary> /// <param name="im

我正在做一个学校项目,我需要使用OpenCV

我尝试使用OpenCV提供的函数“FindOnTours”。 但是当我调用这个函数时,我系统地得到一个错误,程序就结束了。 没有给我任何建议或错误信息

我把代码中出错的部分放在下面。 问我是否需要在我的代码中看到其他内容

    /// <summary>
    /// Detect the contour of the image.
    /// </summary>
    /// <param name="imgCannyEdges_loc">Image made with Canny.</param>
    /// <returns>VectorOfVectorOfPointF</returns>
    public VectorOfVectorOfPointF detectContourInImage(Image<Gray, byte> imgCannyEdges_loc)
    {
        VectorOfVectorOfPointF vvpfListOfPoints = new VectorOfVectorOfPointF();

        CvInvoke.FindContours(imgCannyEdges_loc, vvpfListOfPoints, null, RetrType.List, ChainApproxMethod.ChainApproxNone);

        return vvpfListOfPoints;
    }
//
///检测图像的轮廓。
/// 
///用精明的方法制作的图像。
///点的向量
点检测池图像矢量的公共矢量(图像imgCannyEdges_loc)
{
VectorOfVectorOfPointF vvpListofPoints=新的VectorOfVectorOfPointF();
CvInvoke.FindContours(imgCannyEdges_loc,vvpfListOfPoints,null,RetrType.List,ChainApproxMethod.ChainApproxNone);
返回vvpfListOfPoints;
}
在这里,我把代码中创建和更改图像的部分放在这里。这个图像将用于我的函数中,我刚才给你们的

    /// <summary>
    /// Analysis with contour and with OpenCV.
    /// </summary>
    /// <param name="btmImage_loc">The bitmap of the image that the user wants to analys</param>
    /// <param name="dblThreshold_loc">The threshold defined by the user.</param>
    /// <param name="bReverse_loc">If the image needs to be reversed (black and white).</param>
    /// <param name="bPreview_loc">If we are asking for a preview or not.</param>
    /// <param name="iAnalysisPrecision_loc">The precision of the analysis.</param>
    /// <returns>The image, resized, and with the different change.</returns>
    public Image<Gray, Byte> thresholdingOpenCV(Bitmap btmImage_loc, double dblThreshold_loc,
        bool bReverse_loc, bool bPreview_loc, int iAnalysisPrecision_loc)
    {
        Image<Bgr, Byte> imgResized_loc;
        if (bPreview_loc == true)
        {
            imgResized_loc = new Image<Bgr, byte>(btmImage_loc).Resize(297, 210, Inter.Linear, true);
        }
        else
        {
            imgResized_loc = new Image<Bgr, byte>(btmImage_loc).Resize(297 * iAnalysisPrecision_loc,
                210 * iAnalysisPrecision_loc, Inter.Linear, true);
        }

        Image<Gray, Byte> imgCannyEdges_loc =
            (imgResized_loc.Convert<Gray, Byte>()).Canny(Math.Pow(dblThreshold_loc, 1.3), Math.Pow(dblThreshold_loc, 1.3));

        imgCannyEdges_loc.SmoothGaussian(3);
        if (bReverse_loc)
            return imgCannyEdges_loc;
        else
            return imgCannyEdges_loc.Not();
    }
//
///使用轮廓和OpenCV进行分析。
/// 
///用户要分析的图像的位图
///用户定义的阈值。
///如果图像需要反转(黑白)。
///我们是否要求预览。
///分析的精度。
///图像已调整大小,并具有不同的更改。
公共图像阈值PenCV(位图btmImage_loc,双dblThreshold_loc,
bool bReverse_loc,bool bPreview_loc,国际分析精度_loc)
{
图像不清晰;
如果(bPreview_loc==真)
{
imgResized_loc=新图像(btmImage_loc)。调整大小(297210,内部线性,真);
}
其他的
{
imgResized_loc=新图像(btmImage_loc)。调整大小(297*i分析精度_loc,
210*i分析精度,线性间,真实);
}
图像imgCannyEdges_loc=
(imgResized_loc.Convert()).Canny(Math.Pow(dblThreshold_loc,1.3),Math.Pow(dblThreshold_loc,1.3));
imgCannyEdges_loc.SmoothGaussian(3);
如果(bReverse_loc)
返回imgCannyEdges_loc;
其他的
返回imgCannyEdges_loc.Not();
}
提前感谢您的帮助,如果有不清楚的地方,请别忘了问我问题

亚历山大·沃尔法特

我发现了这个问题。 这只是关于点F的向量。 查找构造函数时,不搜索点F,而是搜索点。 因此,请使用点的向量(而不是点F的向量)