title: Crop simple bounding box with openCV
body: <p>I have some images with a black background and some text in the corner: </p>
  
  <p><img src="https://i.stack.imgur.com/jo0xV.png" alt="This is what it looks like"></p>
  
  <p>I'm trying to do a rectangular crop to make it look like:  </p>
  
  <p><img src="https://i.stack.imgur.com/K4HHg.png" alt="Goal"></p>
  
  <p>The text on the sides as well as the window dimensions are of varying sizes. My code isn't cropping correctly, what am I doing wrong? </p>
  
  <p>I've tried removing the text in the bottom right corner first and cropping, that doesn't work either. </p>
  
  <pre><code>def crop_cont(img):
       gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
       _,thresh = cv2.threshold(gray,15,255,cv2.THRESH_BINARY)
  
       _, contours, _= cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
       cnt = contours[0]
  
       x,y,w,h = cv2.boundingRect(cnt)
  
       crop = img[y:y+h,x:x+w]
  
  return crop
  </code></pre>