File Exchange

image thumbnail

Virtual Mouse: Mouse Pointer Control using Color Detection

version (3.01 KB) by Arindam Bose
MouseControl controls the functions of mouse pointer without incorporating the Mouse.


Updated 05 Aug 2013

View License

Program Name : Mouse Pointer Control
Author : Arindam Bose
Version : 5.5
Description : This program controls the functions of mouse pointer by detecting red, green and blue colored caps

redThresh = Threshold for red color detection.
greenThresh = Threshold for green color detection.
blueThresh = Threshold for blue color detection
numFrame = Total number of frames duration.

Use 1(One) RED, 1(One) GREEN and 3(Three) BLUE Caps for different fingers.
MOVE the RED finger everywhere to control the POINTER POSITION,
Show ONE BLUE finger to LEFT CLICK,
Show TWO BLUE finger to RIGHT CLICK,
MOVE the GREEN finger up and down to control the MOUSE SCROLL.

Cite As

Arindam Bose (2020). Virtual Mouse: Mouse Pointer Control using Color Detection (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (15)

Can we perform drag operation using this colors

what are the packages required to use this code

Atul Munda

There is error in this code ..plzz could u upload the right source code

error occurred while running the code

its good but we want ostu thresholding.

camera gets started and gets turn off. when I'm showing red colour and try to move my finger cursor is not moving.what to do?


Do you happen to know how to track the first identified colored object in a video when other objects will appear with the same color without referring to geometry?

I want to recognize RGB colors from a figure and do a mouse movement to the position of these colors, can you guide me to change the code from live recording to figure recognition??


green threshold is not working and unable to identify

i want the source code for this project.

kalp sharma

error occured when i run this code (nFrame < numFrame);

Please watch this video before applying the code:

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: mouse pointer control by light source