title: Opencv: find box within a box
body: <h1><strong>LOGISTICS</strong></h1>
  
  <p>opencv 2.4 and Python 2.7</p>
  
  <p>The image I'm working with: 
  <img src="https://i.stack.imgur.com/IxkTC.png" alt="enter image description here"></p>
  
  <h1><strong>THE PROBLEM</strong></h1>
  
  <p>What I'm interested in is isolating the outline that forms the box around the 9 vertical and horizontal lines. I'm just not sure on how to go about this. I've looked at various tutorials, such as those done on Sudoku puzzles and those simply assume that the largest box is the one that you're looking for (since a sudoku puzzle doesn't have boxes within boxes, minus the actual grid). I've tried using the findContour function and filtering contours by size but with no luck. I end up with inconsistent results that sometimes finds the right contour but other times finds contours that are completely wrong. Can anyone point me in the right direction? Thanks.  </p>
  
  <p>Original Image:
  <img src="https://i.stack.imgur.com/HDeV0.png" alt="enter image description here"></p>