By Ashish Derhgawen.
A quick article on setting up a simple, real-time laser gesture recognition application and using it to control Windows Media Player"
The program searches for the brightest pixel in its field of view (which is a laser dot in our case) with luminance above a certain threshold value. Luminance of a pixel can be calculated using its RGB values with a simple formula:
Luminance = (299 * red + 587 * green + 114 * blue) / 1000After it finds the pixel, it analyzes how much that point moved along the x and y axes. Based on these parameters, the program tries to recognize the movement. For example, if the laser dot's movement along the x-axis is much more than its movement along the y-axis, the program will determine that it was more or less a horizontal movement. Then, based on the initial and final position of the laser dot, it will determine if the movement was towards the left or towards the right. It uses a similar technique to detect upward, downward and diagonal movements.