Drawing a rectangle around all contours in OpenCV Python
<p>i have a code which identifies contours after applying filters on video frames. Now in my case i get 3 contours and i show them by drawing rectangles around them, what i want to do is drawing a rectangle around all these 3 contour rectangles. like it will be a larger rectangle, containing 3 detected rectangles. 
Here's my simple code of detecting and drawing rectangles around contours.  </p>

<pre><code>im2, contours, hierarchy = cv2.findContours(canny_img,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)

try: hierarchy = hierarchy[0]
except: hierarchy = []

# computes the bounding box for the contour, and draws it on the frame,
for contour, hier in zip(contours, hierarchy):
    (x,y,w,h) = cv2.boundingRect(contour)
    if w &gt; 80 and h &gt; 80:
            cv2.rectangle(frame, (x,y), (x+w,y+h), (255, 0, 0), 2)

cv2.imshow('Motion Detector',frame)
</code></pre>