Detect and Trace the Motion of Colored Objects
In the drawing game that we’ll build in this section, two players will compete to see who can fill the screen of an Android device with the color of a red or blue object first. Without touching the device screen, each player scribbles in the air above it with a blue or red object in an attempt to fill as much space as possible with the object’s color. When more than 50 percent of the screen is filled, the player that filled in the most pixels wins. We’ll use the front-facing camera as the interactive interface for this game. It’s job is to detect the presence of the colors blue or red within its field of vision and capture them each time it records a frame. The game code will increase the score ...
Get Rapid Android Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.