public ARResult Recognize(FARInterface.FARResult[][][][] FingersStatus, int currStep, int[][][] Prev, int nGOF, int nFARPlugin) { // xet ngon tay trai nhat (ngon cai) vi thay thuong detect good ^^ // thuat toan la xet trong n frame gan nhat // neu "do doi" cua frame n-1 va frame 0 du lon thi` xac dinh dang xay ra hanh dong move // vector di chuyen dc xac dinh bang cac estimate duong thang fit nhat voi tap point ARResult rsl = new ARResult(); rsl.Name = "NULL"; double deltax = 0; double deltay = 0; for (int i = 0; i < nGOF; i++) { if (FingersStatus[currStep][i].Length < MIN_DETECTED_FINGER_NUM) continue; for (int j = 0; j < nFARPlugin; j++) { // neu key finger di chuyen if (checkMovement(FingersStatus, currStep, Prev, i, j, ref deltax, ref deltay)) { rsl.Name = GetName(); rsl.Params = new object[2]; rsl.Params[0] = (int)deltax; rsl.Params[1] = (int)deltay; } } } return rsl; }
public ARResult Recognize(FARInterface.FARResult[][][][] FingersStatus, int currStep, int[][][] Prev, int nGOF, int nFARPlugin) { ARResult rsl = new ARResult(); rsl.Name = "NULL"; // xet tung GOF // xet second left most for (int i = 0; i < nGOF; i++) { if (FingersStatus[currStep][i].Length < MIN_DETECTED_FINGER_NUM) continue; for (int j = 0; j < nFARPlugin; j++) { if (FingersStatus[currStep][i][KEY_FINGER][j].Name == "CLICK FINGER") { rsl.Name = GetName(); rsl.Params = FingersStatus[currStep][i][KEY_FINGER][j].Params; return rsl; } } } return rsl; }
public ARResult Recognize(FARResult[][][][] FingersStatus, int currStep, int[][][] Prev, int nGOF, int nFARPlugin) { ARResult rsl = new ARResult(); rsl.Name = "NULL"; for (int i = 0; i < nGOF; i++) { if (FingersStatus[currStep][i].Length < MIN_DETECTED_FINGER_NUM) continue; for (int j = 0; j < nFARPlugin; j++) { if (FingersStatus[currStep][i][KEY_FINGER][j].Name == "MOVE FINGER") { double x = Double.Parse(FingersStatus[currStep][i][KEY_FINGER][j].Params[0].ToString()); double y = Double.Parse(FingersStatus[currStep][i][KEY_FINGER][j].Params[1].ToString()); DEVMODE vDevMode = new DEVMODE(); EnumDisplaySettings(null, -1, ref vDevMode); double swidth = vDevMode.dmPelsWidth; double sheight = vDevMode.dmPelsHeight; double newx, newy; newx = x/320*swidth; newy = y/240*sheight; rsl.Name = GetName(); rsl.Params = new object[2]; rsl.Params[0] = (int)newx; rsl.Params[1] = (int)newy; } } } return rsl; }
/// <summary> /// Recognize intended action /// </summary> public ARResult[] Recognize() { ARResult[] rsl = new ARResult[N_AR_Plugin]; // duyet danh sach tung plugins int cnt = 0; foreach (IActionRecognizer Plugin in AR_Plugins) { rsl[cnt] = Plugin.Recognize(_arrFingersAction, CurrentIdx, _Prev, _arrGOF[CurrentIdx].Length, _N_FAR_Plugin); //if (rsl[cnt].Name == "SURFACE ZOOM ACTION") //{ //} cnt++; } return rsl; }
public ARResult Recognize(FARResult[][][][] FingersStatus, int currStep, int[][][] Prev, int nGOF, int nFARPlugin) { ARResult rsl = new ARResult(); rsl.Name = "NULL"; if (nGOF != 2) return rsl; double deltax1 = 0; double deltay1 = 0; double deltax2 = 0; double deltay2 = 0; double[] p2D1x = new double[100]; double[] p2D1y = new double[100]; double[] p2D2x = new double[100]; double[] p2D2y = new double[100]; double dist; //FingersStatus[currStep][group][j][loai finger action] for (int i = 0; i < nFARPlugin; i++) { if (FingersStatus[currStep][0].Length == 1 && FingersStatus[currStep][1].Length == 1) { bool b1 = checkMovement(FingersStatus, currStep, Prev, 0, i, ref deltax1, ref deltay1, ref p2D1x, ref p2D1y); bool b2 = checkMovement(FingersStatus, currStep, Prev, 1, i, ref deltax2, ref deltay2, ref p2D2x, ref p2D2y); if (b1 && !b2) { double vx1, vy1; double vx2, vy2; vx1 = p2D1x[0] - p2D2x[0]; vy1 = p2D1y[0] - p2D2y[0]; vx2 = p2D1x[MIN_FRAME - 1] - p2D2x[0]; vy2 = p2D1y[MIN_FRAME - 1] - p2D2y[0]; double g = goc(vx1, vy1, vx2, vy2); rsl.Name = GetName(); rsl.Params = new object[1]; rsl.Params[0] = g; return rsl; } else if (b2 && !b1) { double vx1, vy1; double vx2, vy2; vx1 = p2D2x[0] - p2D1x[0]; vy1 = p2D2y[0] - p2D1y[0]; vx2 = p2D2x[MIN_FRAME - 1] - p2D1x[0]; vy2 = p2D2y[MIN_FRAME - 1] - p2D1y[0]; double g = goc(vx1, vy1, vx2, vy2); rsl.Name = GetName(); rsl.Params = new object[1]; rsl.Params[0] = g; return rsl; } } } return rsl; }
public ARResult Recognize(FARResult[][][][] FingersStatus, int currStep, int[][][] Prev, int nGOF, int nFARPlugin) { ARResult rsl = new ARResult(); rsl.Name = "NULL"; //if (nGOF != 1) //return rsl; int cnt = 0; for (int i = 0; i < nGOF; i++) { for (int k = 0; k < (FingersStatus[currStep][i].Length); k++) { for (int j = 0; j < nFARPlugin; j++) { if (FingersStatus[currStep][i][k][j].Name == "MOVE FINGER") { cnt++; } } } } if (cnt > 0) { rsl.Name = GetName(); rsl.Params = new object[2*cnt +1]; rsl.Params[0] = cnt; cnt = 0; for (int i = 0; i < nGOF; i++) { for (int k = 0; k < (FingersStatus[currStep][i].Length); k++) { for (int j = 0; j < nFARPlugin; j++) { if (FingersStatus[currStep][i][k][j].Name == "MOVE FINGER") { cnt++; rsl.Params[cnt] = FingersStatus[currStep][i][k][j].Params[0]; cnt++; rsl.Params[cnt] = FingersStatus[currStep][i][k][j].Params[1]; } } } } return rsl; } //for (int i = 0; i < nGOF; i++) //{ // if (FingersStatus[currStep][i].Length < MIN_DETECTED_FINGER_NUM) // continue; // for (int j = 0; j < nFARPlugin; j++) // { // if (FingersStatus[currStep][i][KEY_FINGER][j].Name == "MOVE FINGER") // { // rsl.Name = GetName(); // rsl.Params = new object[2]; // rsl.Params[0] = FingersStatus[currStep][i][KEY_FINGER][j].Params[0]; // rsl.Params[1] = FingersStatus[currStep][i][KEY_FINGER][j].Params[1]; // return rsl; // } // } //} return rsl; }