I'm using a webcam to find the closest color of red, green or blue in an area of the capture image. The code will be used to check the color of a solid rectangle that will either be red, green or blue. If the color is red, then the value then be converted to a string as "red", etc. I will be doing this for four pixel areas, so I am looking for a way to do this without a ton of 'if' statements.
I have played around with the get() and red(),green(),blue() functions but am having trouble finding an efficient way to do this.
For my networking project I am creating a new 'physical layer' in which two computers use their camera to read eachother's screen and create a back and forth text communication.
I will essentially be taking an input string and converting it to a series of different colors based on the different characters of the word or sentence. I am trying to figure out a way to map each ascii character to a color that will be easily distinguishable by a webcam at about 8 feet away.
I'm looking to see if anyone has a creative way to map the RGB values of a color to an ascii character. I have tried using examplecolor.r() to ascii where the red value determines the ascii character, but the variations of red (or blue/green) detected over a webcam varies too much depending on lighting, etc for it to be consistent.
This is my first time using processing and I am still getting used to it but I'm trying to learn as much as I can. For my project I will be using OpenCV to read another computer monitor and analyze the pixel values from four quadrants of the display.
I am trying to create an array of colors that will be displayed in sequence by the four rectangular sections. For example, the first color (let's say blue) will fill the top right section, then the bottom right quadrant will change to blue as the next color in the array (red) replaces it in the top right sector. This sequence will repeat until blue has rotated into the upper right sector and is then discarded. This will continue until all colors in the array have been displayed and rotated throughout the quadrants, eventually reaching the end of the color array and displaying a blank screen.
I have been reading many examples and tutorials but I cannot seem to figure out this specific problem, any help would be greatly appreciated!