title: Python: How to cut out an area with specific color from image (OpenCV, Numpy)
body: <p>so I've been trying to code a Python script, which takes an image as input and then cuts out a rectangle with a specific background color. However, what causes a problem for my coding skills, is that the rectangle is not on a fixed position in every image (the position will be random). </p>
  
  <p>I do not really understand how to manage the numpy functions. I also read something about OpenCV, but I'm totally new to it. So far I just cropped the images through the ".crop" function, but then I would have to use fixed values.</p>
  
  <p>This is how the input image could look and now I would like to detect the position of the yellow rectangle and then crop the image to its size.</p>
  
  <p>Help is appreciated, thanks in advance.</p>
  
  <p><a href="https://i.stack.imgur.com/ay6Ip.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ay6Ip.png" alt="An example of how the picture could look (initial example)"></a></p>
  
  <h2><a href="https://i.stack.imgur.com/gYbTJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gYbTJ.png" alt="Updated image, how it really looks"></a></h2>
  
  <p>Edit: @MarkSetchell's way works pretty good, but found a issue for a different test picture. The problem with the other picture is that there are 2 small pixels with the same color at the top and the bottom of the picture, which cause errors or a bad crop.</p>