title: Cannot execute approxPolyDP()
body: <pre><code>#include "opencv2/highgui/highgui.hpp"
  #include "opencv2/imgproc/imgproc.hpp"
  #include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  using namespace cv;
  using namespace std;
  
  int main()
  {
      Mat image=cvLoadImage("C:/Users/Administrator/Desktop/Desert.jpg",1);
      Mat imagegray, output, imageresult;;
  
      int thresh=150;
  
      cvtColor(image, imagegray,CV_BGR2GRAY);
  
      vector&lt;vector&lt;Point&gt;&gt;contours;
      vector&lt;Vec4i&gt;hierarchy;
  
      Canny(imagegray, imageresult,thresh, thresh*2);
  
      findContours(imageresult,contours,hierarchy,CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE,cvPoint(0,0));
  
      Mat drawing=Mat::zeros(imagegray.size(),CV_8UC3);
      approxPolyDP(contours,imageresult,100,true);
  
      namedWindow("Display",1);
      imshow("Display",imageresult);
      waitKey(0);
      return(0);
  }
  </code></pre>
  
  <p>In the code given above the </p>
  
  <blockquote>
    <p>approxPolyDP()</p>
  </blockquote>
  
  <p>function is not working. On running it with breakpoints the program does not execute after this function. What is wrong with the code given here?</p>