title: How to draw a rectangle around the contours?
body: <p>I am just starting out with opencv and I am trying to make a program that puts squares around a picture of rocks on some sand. The documentation for the function <a href="http://docs.opencv.org/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=findcontours#findcontours" rel="nofollow">here</a> includes an example of how to use it.</p>
  
  <pre><code>findContours( src, contours, hierarchy,
    CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE );
  </code></pre>
  
  <p>The prototype of findContours is </p>
  
  <pre><code>void findContours(InputOutputArray image, OutputArrayOfArrays contours, OutputArray hierarchy, int mode, int method, Point offset=Point()) ;
  </code></pre>
  
  <p>I have two questions. <br>
  1. The third argument in the example <code>hierarchy</code> is a <code>vector&lt;Vec4i&gt;</code> does not match the type findContours expects. Why is that? <br>
  2. How does one use the data stored in <code>contours</code> to find where the contours are to create a bounding box?</p>