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:
Consequently I have three questions:
Thanks
My answer to question 1 (meaning I didn't require an answer to question 2) was to use Using the OpenCV Tutorial 3 code (Camera Control) (see OpenCV4Android samples) and modify the colour effects methods to allow the setting of white balance:
public List<String> getWhiteBalanceList() {
return mCamera.getParameters().getSupportedWhiteBalance();
}
public boolean isWhiteBalanceSupported() {
return (mCamera.getParameters().getWhiteBalance() != null);
}
public String getWhiteBalance() {
return mCamera.getParameters().getWhiteBalance();
}
public void setWhiteBalance(String whiteBalance) {
Camera.Parameters params = mCamera.getParameters();
params.setWhiteBalance(whiteBalance);
mCamera.setParameters(params);
}
Once I knew that worked I was able to add a call to my main thread to set the correct white balance:
mOpenCvCameraView.setWhiteBalance(Parameters.WHITE_BALANCE_CLOUDY_DAYLIGHT);
In answer to question 3, I used the Java answer in Color Logic Algorithm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With