0

Me and my project group are making an Paintball-like Android app. When you shoot someone it checks the following things:

  1. Is the opponent's color in the cross-hair (center of screen)? (either fluor yellow or fluor orange vests)
  2. Is their an opponent player in that direction (use of device compass)?
  3. Is their an opponent in range in that direction (use of GPS)?

The problem at the moment is with the first check. We plan to use the HUE and/or HSV codes, including the lightness and saturation by using the Color.colorToHSV method in Android. We encounter some problems though when it is too dark (weather), and want some feedback over which method is the most efficient to get the best possible results for our colored vests.

With some tests we use the following range at the moment with the Color.colorToHSV method:

float[] currentHsv = new float[3];
Color.colorToHSV(Utils.findColor(myImageBitmap), currentHsv);

float hue = currentHsv[0];
float saturation = currentHsv[1];
float brightness = currentHsv[2];

// Fluor Yellow
if((hue >= 58 && hue <=128) && brightness > 0.40 && saturation <= 1.0){ // some code here }

// Fluor orange
else if((hue >= 4 && hue <=57) && brightness > 0.45 && saturation >= 0.62){ // some code here }

Does anyone know a more efficient way of doing this, which works in almost any kind of weather type, dark or light, inside or outside, below dark bridges or overhanging buildings, dark/light colored clothings underneed it, etc.

Kevin Cruijssen
  • 9,153
  • 9
  • 61
  • 135
  • Why are you using so similar vests? Can't you change them so players have an unambiguously different team symbol, say + or circle in reflective tape? – Pete Kirkham Mar 20 '13 at 13:25
  • A good start might to be to analyze some images taken under bad conditions. That is, what sort of color data are you getting for the vests, and is there any (relatively) consistent difference between the yellow and the orange vests in those images? – Michael Mar 20 '13 at 13:31
  • @Michael We did that, we took pictures in a lot of different conditions, but the HUE for yellow around 36 - 81 (and 180 under a dark building) and orange around 2,2 - 41 (and 359 under a dark building..) CONCLUSION: The HUE-range is way to high. And Pete, the difference between Fluor Yellow and Fluor Orange is already pretty big.. Also, a symbol won't work on a vest when facing the opponent sideways, or when the vest is (even slightly) twisted. – Kevin Cruijssen Mar 20 '13 at 13:55
  • How about calibrating the colors before a game starts based on the current lighting conditions? – Nachi Mar 20 '13 at 14:13
  • We indeed thought about that too. That at the beginning of the game we use a dropdown for the current weather conditions. Only problem is that you can still stand under a dark bridge; And in addition, the game is for around 2 hours, and here in The Netherlands the weather can change a lot in 2 hours time.. ;) – Kevin Cruijssen Mar 20 '13 at 14:28

0 Answers0