title: How can I best detect different LED colours using an Android phone's camera and OpenCV?
body: <p>I am trying to identify and differentiate the colours of LEDs against a black background using OpenCV on an Android phone, but am currently struggling. My investigations to date point to two separate issues:</p>
  
  <ol>
  <li>Using OpenCV, the camera appears to default to automatic white balance which makes it difficult to differentiate between certain colours. Using the native Android camera the best images appear to be produced with a white balance set to "Cloudy".</li>
  <li>OpenCV provides images in the RGB colour space, yet RGB does not match the human-perceived distance between colours meaning a Euclidean RGB distance metric is not an optimum solution (see <a href="https://stackoverflow.com/questions/9018016/how-to-compare-two-colors">How to compare two colors</a>).</li>
  </ol>
  
  <p>Consequently I have three questions:</p>
  
  <ol>
  <li>Is there a way in Android Java or OpenCV to set the camera's white balance so that it influences the resultant image returned by OpenCV?</li>
  <li>If not, is there an algorithm available (preferably in Java) to modify the white balance of the OpenCV image?</li>
  <li>Is there an algorithm available (again, preferably in Java) to convert RGB colours to an alternative colour space that would better match the human-perceived distance between colours?</li>
  </ol>
  
  <p>Thanks</p>