hello
i write program for
1-detect face
2-detect eye
3-detect for detect face & then detect Right eye & then detect pupil (circle hough)
4-move mouse
Here are the codes:
https://github.com/Ehsan-Shahnazi/EyeWriter/blob/master/22-22.cpp
......
......
.....
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]));
}
....
.....
....
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
Perhaps the problem of how to track pupil or codes to move the mouse or...???
thanks