I am doing a project where I have to develop an application in which the mouse cursor moves according to the co-ordinates provided to it.These co-ordinates are generated from the position of user's pupil.I am able to get the co-ordinates of the pupil using opencv.Now,I have the following questions:
1.)How do I programme the mouse cursor,so that it moves according to the co-ordinates I give it.Specifically,I am looking for libraries and functions that will do it.After looking online I found out that people use graphics.h library with turbo C.I am doing my project in visual studio 2010,so please let me know of any method that goes with it.
2.)Secondly,how can I use this so-called mouse I have created with C++ and opencv to function as the primary mouse in windows?Do I have to do assembly level programming or device driver writing or is there any other suitable method?
For Q1. I would highly appreciate if you could give me some sample code.
Thanks.
............................
This is what I have done so far
..............................
I am having problems with running code.I have integrated WinBGIm v6.0 from http://winbgim.codecutter.org/
(I am using VS2010 ultimate on Windows 7). If I run the sample code everything goes fine.However, when I tried to run this mouse example given in the documentation several errors occurred.
Please help me correct the errors, I have no idea what they mean.
/* mouse example */
/*Filename:mint.cpp*/
#include "winbgim.h"
void main(void)
{
const int LIMIT = 10; // Number of clicks to stop program.
int maxx, maxy; // Maximum x and y pixel coordinates
int count = 0; // Number of mouse clicks
int divisor; // Divisor for the length of a triangle side
// Put the machine into graphics mode and get the maximum
coordinates:
initwindow(450, 300);
maxx = getmaxx( );
maxy = getmaxy( );
// Draw a white circle with red inside and a radius of 50 pixels:
setfillstyle(SOLID_FILL, RED);
setcolor(WHITE);
fillellipse(maxx/2, maxy/2, 50, 50);
// Print a message and wait for a red pixel to be double clicked:
settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
outtextxy(20, 20, "Left click " << LIMIT << " times to end.");
setcolor(BLUE);
divisor = 2;
while (count < LIMIT)
{
triangle(maxx/divisor, maxy/divisor);
delay(500);
divisor++;
if (ismouseclick(WM_LBUTTONDOWN))
{
(clearmouseclick(WM_LBUTTONDOWN));
count++;
}
}
// Switch back to text mode:
closegraph( );
}
...................................................
The compiler errors are:
c:\program files\microsoft visual studio 10.0\vc\include\winbgim.h(302): error C2086: 'int right' : redefinition
1>c:\program files\microsoft visual studio 10.0\vc\include\winbgim.h(302) : see declaration of 'right'
1>c:\users\administrator\desktop\winbgm\driver\mint.cpp(20): error C2296: '<<' : illegal, left operand has type 'const char [12]'
1>c:\users\administrator\desktop\winbgm\driver\mint.cpp(25): error C3861: 'triangle': identifier not found
Build FAILED.