How to track pixels?

Blitz3D Forums/Blitz3D Programming/How to track pixels?

This is one way.

First you create an image that is downsized, and which uses a reduced palette which is taylored to the colour range that you are looking for. Then test the immediate neighbouring squares to the last fixpoint, to see if the mouth has moved. Always test an array of pixels(x number of pixels * y number of pixels). Average the values of each cluste of pixels and add all of the pixels in the area together. If the resulting value is different from a specific range, then you are not where you need to be.

Simply put, you can have a rather small picture with maybe 16 colours. They trick is to find the right representation of color, but using the r,g,b channels individually can make things easier.

The resolution of the marked out square will be smaller than the resolution of the source image, but it will follow the mouth pretty accurately.

I did it as a project in 2D, where I wanted the computer to play like a human opponent, by observing it's surroundings rather than just 'knowing' what was happening.