title: Analyze an image in specific area and determine if it's red using Opencv Python
body: <p>I'm using Opencv python in raspberry pi, to analize a heatmap, i'm looking for color red, which represents the highest temperature,  i need to detect if in an specific area exist red color, in case it does i can use this information to activate a condition, i'm using a heatmap like this:
  <a href="https://i.stack.imgur.com/qy9zr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qy9zr.png" alt="enter image description here"></a></p>
  
  <p>for the red color detection i'm using this code: </p>
  
  <pre><code>import cv2
  import numpy as np
  
  while(1):
  
      # Take each frame
  
      frame = cv2.imread('heatmap.png')
  
      # Convert BGR to HSV
      hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
  
      # define range of blue color in HSV
      lower_red = np.array([-20, 100, 100])
      upper_red = np.array([13, 255, 255])
  
      # Threshold the HSV image to get only blue colors
      mask = cv2.inRange(hsv, lower_red, upper_red)
  
  
      # Bitwise-AND mask and original image
      res = cv2.bitwise_and(frame,frame, mask= mask)
  
      cv2.imshow('heatmap',frame)
      cv2.imshow('mask',mask)
      cv2.imshow('res',res)
      k = cv2.waitKey(5) &amp; 0xFF
      if k == 27:
          break
  
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>the code above give me al the pixels in red, but i need to determine if the heatmap contour is red, i mean the image contour or border would be a red color not permited area, does anyone how i can do that?</p>