I'm implementing a virtual world for an autonomous machine. The machine has to be able to detect the center coordinates of different colored ellipses in the screen. The image is given to the machine in an width x height array, with ints for the colors (for example white = 0, red = 8, blue = 9 etc).
Also if the ellipses are behind eachother you do not have to calculate the excact middle point. I was thinking of some sort of sweepline algorithm? Which will keep the first time it sees a color and when it exits it gets the average between those two? and then do it horizontally and vertically. Then you have the middle coordinates. Would this be efficient? Any other ideas? Thanks in advance