color segmenation problems with android camera

221 views
Skip to first unread message

dschaudel

unread,
Apr 18, 2012, 12:22:23 PM4/18/12
to android...@googlegroups.com

I am currently working on a system for traffic sign recognition. This is based on colour segmentation using hsv colour space.

I have ported the existing algorithm to Android. However, I realized that the colour recognition does not work realiably. 

After various tests I was able to detect the problem (!?). Android uses an automatic white balance, auto gain etc.

Is it possible to prevent Android from using the automatic white balance? I have tested functions such as setAutoWhiteBalanceLock() 

which, however, did not provide useful results (black screen). The colours are filtered and segmented quite properly via webcam.

I used the the tutorial from opencv4android called "tutorial-4-mixed".

android:

webcam:



Any suggestions?

Thank you very much in advance.



Rui Marques

unread,
Apr 18, 2012, 12:29:38 PM4/18/12
to
It is a nice question that i am also interested in the answer.

When you say "via webcam" you mean opencv running on a desktop right?

dschaudel

unread,
Apr 18, 2012, 12:30:43 PM4/18/12
to android...@googlegroups.com
Yes, running on a desktop.
Do you think its because of the automatic white balancing etc. or do you think its something else?


On Wednesday, April 18, 2012 6:28:01 PM UTC+2, Rui Marques wrote:
It is a nice question that i am also interested in the answer.

When you say "via webcam" you mean opencv running on a desktop right?

Rui Marques

unread,
Apr 18, 2012, 12:45:10 PM4/18/12
to android...@googlegroups.com
I think it is very possible to be those "auto things".
But it can be also your thresholding algorithm, the phone camera and the webcam are different so the threshold needed might be slightly different.

Instead of setAutoWhiteBalanceLock(), have you tried setWhiteBalance(String value) ?

I think the supported values are these:

I can't see one to just turn off but if you set, for example WHITE_BALANCE_DAYLIGHT, at least the colours would be constant and not changing dynamically.

And don't forget to check first if it is supported by your phone with:

isAutoWhiteBalanceLockSupported()

Also very worth checking out:

setExposureCompensation (int value)


Parameters
value exposure compensation index. The valid value range is from getMinExposureCompensation() (inclusive) to getMaxExposureCompensation() (inclusive). 0 means exposure is not adjusted. Application should call getMinExposureCompensation and getMaxExposureCompensation to know if exposure compensation is supported.

dschaudel

unread,
Apr 18, 2012, 1:20:15 PM4/18/12
to android...@googlegroups.com

WHITE_BALANCE_CLOUDY_DAYLIGHT

WHITE_BALANCE_DAYLIGHT


WHITE_BALANCE_FLUORESCENT

WHITE_BALANCE_INCANDESCENT

WHITE_BALANCE_AUTO


Other setWhiteBalance() options dont work.

I'm going to test the setExposureCompensation ...

But I'm now quite sure that this has sth. to do with those "auto things"!


dschaudel

unread,
Apr 18, 2012, 1:23:55 PM4/18/12
to android...@googlegroups.com

for the sake of completeness

dschaudel

unread,
Apr 18, 2012, 3:58:21 PM4/18/12
to android...@googlegroups.com
used WHITE_BALANCE_INCANDESCENT option and modified the thresholding parameters -> it works!

Reply all
Reply to author
Forward
0 new messages