title: Detect color in the middle of image (OpenCV, Python)
body: <p>I have these 3 images (consider "image" the whole square not only the figure inside - this is just for demonstration purposes):</p>
  
  <p><a href="https://i.stack.imgur.com/IZRi4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IZRi4.png" alt="im1"></a> <a href="https://i.stack.imgur.com/ZiDrz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZiDrz.png" alt="im2"></a> <a href="https://i.stack.imgur.com/UjWA4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UjWA4.png" alt="im3"></a></p>
  
  <p>What I want to do is detect the colour in the middle (center) of each one. So, having an area (square or circle) in the center and with OpenCV detect which is the colour.
  Something like a color picker...</p>
  
  <p>The purpose is to have 3 values, 3 for each image (BGR).</p>
  
  <p>Example:</p>
  
  <p><a href="https://i.stack.imgur.com/6pFO4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6pFO4.jpg" alt="im4"></a></p>
  
  <p>What is the colour in the ROI ?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Using this code I can find the middle of an image and apply a mask.</p>
  
  <pre><code>import cv2
  import numpy as np
  
  img = cv2.imread("im2.png")
  
  height, width, depth = img.shape
  circle_img = np.zeros((height, width), np.uint8)
  
  mask = cv2.circle(circle_img, (int(width / 2), int(height / 2)), 20, 1, thickness=-1)
  masked_img = cv2.bitwise_and(img, img, mask=circle_img)
  
  cv2.imshow("masked", masked_img)
  cv2.waitKey(0)
  </code></pre>
  
  <p>Now it remains to find BGR of the masked area (visible one...)</p>