2017-06-16 12 views
0

私はOpenCVを使用する必要がある学校プロジェクトを行っています。Visual StudioでOpen CV v3.1でエラーが発生するC#

OpenCVが提供する関数 "findcontours"を使用しようとしています。 しかし私が関数を呼び出すと、系統的にエラーが発生し、プログラムは終了します。 私に助言やエラーメッセージを教えてください。

私はあなたにエラーを下すコードの部分を書きました。 私のコードで何か他のものを見る必要があるかどうか私に尋ねてください。

/// <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; 
    } 

そして、ここで私はあなたに私がイメージを作成し、変更する私のコードの一部を置きます。この同じイメージが私の機能で使用されます。

/// <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(); 
    } 

ご協力いただきありがとうございます。十分なものがない場合は、私に質問してください。

アレクサンダーWohlfahrt

答えて

0

この問題が見つかりました。 VectorOfVectorOf PointFについては正義でした。 findcontours、PointFは検索しませんが、ポイントです。 したがって、VectorOfVectorOf (Not VectorOfVectorOf 点F

を使用してください
関連する問題