Computer Vision: Color Tracking and Motion Detection (Java)

On Saturday Simon picked up Computer Vision again – something he had tried back in February but got stuck. This time around, he had built up better theoretical knowledge and sketched out a rough plan in advance. He has managed to complete the first two tasks from the plan, following Daniel Shiffman’s brilliant Color Tracking and Motion Detection tutorials.


Here he explains how colour tracking in computer vision works:

Simon programmed his camera to track anything red. He was careful not to wear anything red himself and tried to get the computer find the only red object within its vision – a red building block – and mark it with “a blob” (an ellipse):

Then Simon made the computer to not only track the colour and mark it with a blob, but also show all the colour pixels picked up (by changing them to white):

Simon added one more red object into the picture. The blob was now choosing the average point between the two red objects:

Simon changed the blob colour:


Motion detection. This basically means analyzing the pixels of a video to detect motion. This technique is also known as frame differencing. If an object is still, the computer shows it in white, and if an object is moving, it’s shown in black. Simon programmed this using a threshold and a distance squared formula.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s