I have a program which takes a picture and it then determines the RGB values of a portion of pixels I am interested in. I take the average RGB of the regions and put those in an array. What I want to do is go through that array and say based on its RGB value that it is for example "Orange". I want to do this without constraining the RGB values like this. if(r > 10 && g < 200 && b < 200) color is green. The reason being that lighting in the image can change a lot. So it could fall out of range if I give it hard constraints. I am trying to think of how to do it so that it is dynamic and works with no matter the lighting in the photo.
This isn't really a code problem I am trying to think of ways of how I can solve this. Can't seem to think of other ways of doing it without using constraints as I mentioned above which is why I came here.
Here is an example of a color array. (There are 24 colors in it)
Color Array: [java.awt.Color[r=6,g=115,b=77], java.awt.Color[r=6,g=115,b=77], java.awt.Color[r=6,g=115,b=77], java.awt.Color[r=6,g=115,b=77], java.awt.Color[r=248,g=184,b=40], java.awt.Color[r=241,g=26,b=27], java.awt.Color[r=0,g=38,b=183], java.awt.Color[r=0,g=38,b=183], java.awt.Color[r=178,g=168,b=204], java.awt.Color[r=198,g=148,b=22], java.awt.Color[r=185,g=140,b=6], java.awt.Color[r=0,g=38,b=183], java.awt.Color[r=241,g=26,b=27], java.awt.Color[r=236,g=212,b=255], java.awt.Color[r=237,g=70,b=20], java.awt.Color[r=237,g=70,b=20], java.awt.Color[r=237,g=70,b=20], java.awt.Color[r=237,g=70,b=20], java.awt.Color[r=0,g=38,b=183], java.awt.Color[r=236,g=212,b=255], java.awt.Color[r=241,g=26,b=27], java.awt.Color[r=255,g=189,b=71], java.awt.Color[r=241,g=26,b=27], java.awt.Color[r=236,g=212,b=255]] So the first 4 indexes in the array would map to ["Green","Green","Green","Green"]