Abstract
This paper presents a cost-effective Human-Computer Interaction (HCI) system that transforms a standard webcam into a virtual mouse. By employing color-coded tapes on a user's fingers and real-time image processing in MATLAB, the system enables cursor movement and clicking actions without specialized hardware. The approach utilizes color detection and centroid calculation to map physical gestures to digital commands, providing a foundation for more natural, gesture-based interfaces.
Introduction
As digital interfaces evolve, the demand for natural interaction methods grows. While touchscreens are common in mobile devices, they remain expensive for many desktop environments. Traditional physical mice, though functional, represent a barrier to intuitive gesture-based control. This research explores a "virtual mouse" solution requiring only a standard laptop webcam.
The primary challenge addressed is the real-time processing of video frames to ensure low-latency cursor movement while accurately distinguishing control pointers from cluttered backgrounds.
Methodology
The system is implemented in MATLAB, leveraging the Image Processing Toolbox and Java integration for OS-level hardware control. The operational pipeline consists of four main stages.
Image Acquisition and Correction
The webcam captures RGB frames. To align user movement with cursor movement, the system performs a "mirror" correction by separating RGB channels, flipping them vertically, and re-concatenating them.
Color Detection and Binary Conversion
To isolate the control pointers, a subtraction-based approach is used. A "color suppressed" channel is subtracted from the grayscale version of the flipped image, highlighting target colors (Red, Green, or Blue). The resulting grayscale image is converted to binary using a 20% threshold.
Centroid Calculation and Cursor Mapping
The system calculates the centroid (geometric center) of the detected white patches in the binary image. The coordinates of the Red pointer's centroid are mapped directly to the screen's X and Y coordinates.
Clicking Logic
Since MATLAB cannot natively access mouse drivers, a Java object interfaces with the operating system. Clicking is handled through color combinations:
- Left Click: Triggered when Red and Green colors are detected simultaneously.
- Right Click: Triggered when Red and Blue colors are detected simultaneously.
Key Insights and Results
A critical insight was the necessity of the image flipping stage to maintain intuitive control. Furthermore, converting frames to grayscale for centroid calculation significantly reduced computational complexity, allowing the system to run on standard consumer hardware.
The proof-of-concept successfully demonstrates real-time tracking and clicking. By using specific color pointers rather than skin-tone detection, the system exhibits improved resistance to background noise. It remains "hardware agnostic," requiring no external sensors like infrared or depth cameras.
Limitations and Future Work
Current limitations include sensitivity to ambient lighting and potential interference from background objects matching the pointer colors. High-resolution cameras can also increase computational load due to higher pixel counts. Future work will focus on adapting this technology for augmented reality, gaming, and assistive technologies for individuals with limited fine motor skills.
Summary updated