title: Get value from detect colour python opencv
body: <p>For my project, I want to control an RC car to avoid red obstacles using a webcam camera running <code>Raspberry Pi</code>.</p>
  
  <p>I can control my RC car, but I don't know much about <code>openCV</code>. I can also detect selected colours using the webcam, but I do not know how to get the colour value from the image to my RC car.</p>
  
  <p>The issue that I am having is that my car does not know that a blue object is in front of the camera.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import cv2
  import numpy as np 
  cap = cv2.videoCapture(0)
  while(1):
  # take each frame
  _,frame=cap.read()
  
  #convert BGR to HSV
  hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
  
  #define range of blue color in HSV
  lower_blue = np.array([160,50,50],dtype=np.uint8)
  uper_blue np.array([179,255,255],dtype=np.uint8)
  
  #Threshold the HSV image to get only blue colors
  mask = cv2.inRange(hsv,lower_blue,upper_blue)
  
  cv2.imshow('mask',mask)
  k=cv2.waitKey(5) &amp;0xFF
  if k == 27 :
     break
  cv2.destroyAllwindows() 
  </code></pre>