calibration between mouse move & pupil move (eye writer)
hello i write program for detect face & then detect Right eye & then detect pupil (circle hough) Finally move mouse.
The problem I have is that Move the mouse range is low. the range of motion mouse is 20 x 20 pixels. Mouse cursor moves only in a very small area of the desktop.
I need Mouse cursor moves in all area of the desktop.
This code get the coordinates of the center of the circular Hough and then cursor is moved .
......
......
.....
void mousemove(int x_pos, int y_pos)
{
///Strings that will contain the conversions
string xcord; string ycord;
///These are buffers or something? I don't really know... lol.
stringstream sstr; stringstream sstr2;
///Conversion to regular string happens here
sstr<<5*x_pos;
xcord = sstr.str();
sstr2<<5*y_pos;
ycord = sstr2.str();
///Getting the command string
string command = "xdotool mousemove " + xcord + " " + ycord;
///Converting command string to a form that system() accepts.
const char *com = command.c_str();
system(com);
}
int main()
{
CascadeClassifier face_cascade("/home/elinux/opencv-3.1.0/data/haarcascades_cuda/haarcascade_frontalface_alt2.xml");
CascadeClassifier eye_cascade("/home/elinux/opencv-3.1.0/data/haarcascades_cuda
/haarcascade_righteye_2splits.xml");
....
....
...
morphologyEx(framepupil, morph_grad, MORPH_GRADIENT,se,Point(-1,-1),1);
HoughCircles(morph_grad, circles, HOUGH_GRADIENT, 1, 1000, 100,15, 10,20);
if(circles.size()!=0){
(circles[t][0])=(circles[t][0])*((circles[t][0])/10);
(circles[t][1])=(circles[t][1])*((circles[t][1])/10);
mousemove((circles[t][0]),(circles[t][1]));
}
....
.....
....
Here are the all codes: https://github.com/Ehsan-Shahnazi/EyeWriter/blob/master/22-22.cpp
How should calibration between eye positions and cursor positions?? Do you have code samples?
(Perhaps the problem of how to track pupil or codes to move the mouse or...???)
thanks
Please, update your question and make the actual problem more clear. For now I see that
So what do you want? A better performance? Is the registration to poor? Also a eye motion will never be larger than around 40x40 pixels if you simply look at the pupil region. Are you sure you reprojected it correctly to screen coordinates?
Please add the relevant code, that translates the movement of the eye into screen coordinates. You are aware that you will need to do some calibration/mapping between both right?