title: OpenCV cvDrawContours vs drawContours
body: <p>I am new to using OpenCV on Visual Studio, and I have recently reinstalled my VS2012 to get it to work using OpenCV 2.4.2.</p>
  
  <p>I am trying to calculate the area of region specified by mouse-clicking the vertices and pushing them to CvSeq*, to use with contourArea() function. </p>
  
  <p>I am currently trying to parse in an empty CvSeq* as the last parameter of my custom mouse callback function so that I can add the CvPoint formed of x and y coordinates. However, whenever I try to access the CvSeq* contour afterwards, I get an error. So in the following snippet of the code:</p>
  
  <pre><code>void CallBackFunc(int event, int x, int y, int flags, void* userdata)
  {
  
      CvSeq* contour = (CvSeq*)userdata;
      CvPoint cur;
       if  ( event == EVENT_LBUTTONDOWN )
       {
            cout &lt;&lt; "Left button of the mouse is clicked - position (" &lt;&lt; x &lt;&lt; ", " &lt;&lt; y &lt;&lt; ") saved as point" &lt;&lt; endl;
            // save x,y as a contour point
            cur = cvPoint(x,y);
            cvSeqPush(contour, &amp;cur);
  ...
  </code></pre>
  
  <p>I get the correct cout messages, but get an error like this when trying to draw contour using that CvSeq* :
  Unhandled exception at at 0x75E3812F in opencvtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x001FF990.</p>
  
  <p>What is the problem here? Would I be better off trying to use Vector> instead of CvSeq? </p>