title: Drawing Bounding-Box using OpenCV in C++ Enviroment
body: <p>Hello peeps I have developed a piece of software that draws contours of the input image, now I wont to take this to the next level and draw Bounding Box around objects of interest i.e. A person. I looked at boundingRect() function but i am struggling to understand it. Maybe there are different functions algorithms draw Bounding Box.....? </p>
  
  <p>Here is the code of my program:</p>
  
  <pre><code>     #include "iostream"
      #include&lt;opencv\cv.h&gt;
      #include&lt;opencv\highgui.h&gt;
      #include&lt;opencv\ml.h&gt;
      #include&lt;opencv\cxcore.h&gt;
      #include &lt;iostream&gt; 
      #include &lt;string&gt; 
      #include &lt;opencv2/core/core.hpp&gt; // Basic OpenCV structures (cv::Mat)
      #include &lt;opencv2/highgui/highgui.hpp&gt; // Video write
  
  using namespace cv;
  using namespace std;
  
  Mat image; Mat image_gray; Mat image_gray2; Mat threshold_output;
  int thresh=100, max_thresh=255;
  
  
  int main(int argc, char** argv) {
  
      //Load Image
      image =imread("C:/Users/Tomazi/Pictures/Opencv/tomazi.bmp");
  
      //Convert Image to gray &amp; blur it
      cvtColor( image, 
          image_gray, 
          CV_BGR2GRAY );
  
      blur( image_gray, 
          image_gray2,
          Size(3,3) );
      //Threshold Gray&amp;Blur Image
      threshold(image_gray2, 
          threshold_output, 
          thresh, 
          max_thresh, 
          THRESH_BINARY);
  
      //2D Container
      vector&lt;vector&lt;Point&gt;&gt; contours;
  
      //Fnd Countours Points, (Imput Image, Storage, Mode1, Mode2, Offset??)
      findContours(threshold_output,
          contours, // a vector of contours
          CV_RETR_EXTERNAL,// retrieve the external contours
          CV_CHAIN_APPROX_NONE,
          Point(0, 0)); // all pixels of each contours    
  
      // Draw black contours on a white image
      Mat result(threshold_output.size(),CV_8U,Scalar(255));
      drawContours(result,contours,
          -1, // draw all contours
          Scalar(0), // in black
          2); // with a thickness of 2
  
  
          //Create Window
      char* DisplayWindow = "Source";
      namedWindow(DisplayWindow, CV_WINDOW_AUTOSIZE);
      imshow(DisplayWindow, result);
  
  
      waitKey(5000);
      return 1;
  }
  </code></pre>
  
  <p>Can anyone suggest an solution...? Perhaps direct me to some sources, tutorials etc. Reading OpenCV documentation and looking at the boundingRect() function i still dont understand. HELP PLEASE :)</p>