void OnGUI()
 {
     if (GUI.Button (new Rect (10,10,120,30),((mode&(PXCUPipeline.Mode.COLOR_VGA|PXCUPipeline.Mode.FACE_LANDMARK|PXCUPipeline.Mode.FACE_LOCATION))!=0)?"COLOR":"NO COLOR")) {
         mode^=PXCUPipeline.Mode.COLOR_VGA;
         Norm ();
         Application.LoadLevel(0);
     }
     if (GUI.Button (new Rect (10,40,120,30),((mode&(PXCUPipeline.Mode.DEPTH_QVGA|PXCUPipeline.Mode.GESTURE))!=0)?"DEPTH":"NO DEPTH")) {
         mode^=PXCUPipeline.Mode.DEPTH_QVGA;
         Norm ();
         Application.LoadLevel(0);
     }
     if (GUI.Button (new Rect (10,70,120,30),((mode&PXCUPipeline.Mode.GESTURE)!=0)?"GESTURE":"NO GESTURE")) {
         mode^=PXCUPipeline.Mode.GESTURE;
         Norm ();
         Application.LoadLevel(0);
     }
     if (GUI.Button (new Rect (10,100,120,30),((mode&PXCUPipeline.Mode.FACE_LOCATION)!=0)?"FACE":"NO FACE")) {
         mode^=(PXCUPipeline.Mode.FACE_LOCATION|PXCUPipeline.Mode.FACE_LANDMARK);
         Norm ();
         Application.LoadLevel(0);
     }
     if (GUI.Button (new Rect (10,130,120,30),((mode&PXCUPipeline.Mode.VOICE_RECOGNITION)!=0)?"VOICE":"NO VOICE")) {
         mode^=PXCUPipeline.Mode.VOICE_RECOGNITION;
         Norm ();
         Application.LoadLevel(0);
     }
 }
Esempio n. 2
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 120, 30), ((mode & (PXCUPipeline.Mode.COLOR_VGA | PXCUPipeline.Mode.FACE_LANDMARK | PXCUPipeline.Mode.FACE_LOCATION)) != 0)?"COLOR":"NO COLOR"))
        {
            mode ^= PXCUPipeline.Mode.COLOR_VGA;
            Norm();
            Application.LoadLevel(0);
        }
        if (GUI.Button(new Rect(10, 40, 120, 30), ((mode & (PXCUPipeline.Mode.DEPTH_QVGA | PXCUPipeline.Mode.GESTURE)) != 0)?"DEPTH":"NO DEPTH"))
        {
            mode ^= PXCUPipeline.Mode.DEPTH_QVGA;
            Norm();
            Application.LoadLevel(0);
        }
        if (GUI.Button(new Rect(10, 70, 120, 30), ((mode & PXCUPipeline.Mode.GESTURE) != 0)?"GESTURE":"NO GESTURE"))
        {
            mode ^= PXCUPipeline.Mode.GESTURE;
            Norm();
            Application.LoadLevel(0);
        }

        /*if (GUI.Button (new Rect (10,100,120,30),((mode&PXCUPipeline.Mode.FACE_LOCATION)!=0)?"FACE":"NO FACE")) {
         *      mode^=(PXCUPipeline.Mode.FACE_LOCATION|PXCUPipeline.Mode.FACE_LANDMARK);
         *      Norm ();
         *      Application.LoadLevel(0);
         * }
         * if (GUI.Button (new Rect (10,130,120,30),((mode&PXCUPipeline.Mode.VOICE_RECOGNITION)!=0)?"VOICE":"NO VOICE")) {
         *      mode^=PXCUPipeline.Mode.VOICE_RECOGNITION;
         *      Norm ();
         *      Application.LoadLevel(0);
         * }*/
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        PXCUPipeline.Mode mode = Options.mode & (~PXCUPipeline.Mode.VOICE_RECOGNITION);
        if (mode == 0)
        {
            return;
        }

        pp = new PXCUPipeline();
        if (!pp.Init(mode))
        {
            print("Unable to initialize the PXCUPipeline");
            return;
        }

        plane = GameObject.Find("Plane");

        pp.QueryRGBSize(RGBMapSize);
        if (RGBMapSize[0] > 0)
        {
            Debug.Log("rgb map size: width = " + RGBMapSize[0] + ", height = " + RGBMapSize[1]);
            rgbTexture = new Texture2D(RGBMapSize[0], RGBMapSize[1], TextureFormat.ARGB32, false);
            // use the rgb texture as the rendered texture
            plane.renderer.material.mainTexture = rgbTexture;
            pp.QueryDepthMapSize(depthMapSize);
            if (depthMapSize[0] > 0)
            {
                Debug.Log("depth map size: width = " + depthMapSize[0] + ", height = " + depthMapSize[1]);
                depthStorage = new short[depthMapSize[0] * depthMapSize[1]];
            }
            pp.QueryUVMapSize(uvMapSize);
            if (uvMapSize[0] > 0)
            {
                Debug.Log("uv map size: width = " + uvMapSize[0] + ", height = " + uvMapSize[1]);
                uvStorage = new short[uvMapSize[0] * uvMapSize[1] * 2];
            }
        }

        cascade = CvHaarClassifierCascade.FromFile(@"./Assets/haarcascade_frontalface_alt.xml");

        /*capture = Cv.CreateCameraCapture(0); //bentrok dgn pxcupipeline
         * Cv.SetCaptureProperty(capture, CaptureProperty.FrameWidth, CAPTURE_WIDTH);
         * Cv.SetCaptureProperty(capture, CaptureProperty.FrameHeight, CAPTURE_HEIGHT);
         * IplImage frame = Cv.QueryFrame(capture);
         * Debug.Log("width:" + frame.Width + " height:" + frame.Height);*/
        Cv.NamedWindow("FaceDetect");

        CvSVM          svm      = new CvSVM();
        CvTermCriteria criteria = new CvTermCriteria(CriteriaType.Epsilon, 1000, double.Epsilon);
        CvSVMParams    param    = new CvSVMParams(CvSVM.C_SVC, CvSVM.RBF, 10.0, 8.0, 1.0, 10.0, 0.5, 0.1, null, criteria);
    }
Esempio n. 4
0
 void Norm()
 {
     if ((mode & PXCUPipeline.Mode.FACE_LANDMARK) != 0)
     {
         mode |= PXCUPipeline.Mode.FACE_LOCATION;
     }
     if ((mode & PXCUPipeline.Mode.FACE_LOCATION) != 0)
     {
         mode |= PXCUPipeline.Mode.COLOR_VGA;
     }
     if ((mode & PXCUPipeline.Mode.GESTURE) != 0)
     {
         mode |= PXCUPipeline.Mode.DEPTH_QVGA;
     }
 }
    void OnGUI()
    {
        if (GUI.Button(new Rect(10, 10, 120, 30), useMouse ? "USE MOUSE" : "USE GESTURE"))
        {
            useMouse = !useMouse;
        }
        if (GUI.Button(new Rect(10, 40, 120, 30), "RESTART"))
        {
            Application.LoadLevel(0);
        }
        if (GUI.Button(new Rect(10, 70, 120, 30), pause ? "RESUME" : "PASUE"))
        {
            pause = !pause;
            if (pause)
            {
                Time.timeScale = 0;
            }
            else
            {
                Time.timeScale = 1;
            }
        }
        if (GUI.Button(new Rect(10, 100, 120, 30), ((mode & PXCUPipeline.Mode.VOICE_RECOGNITION) != 0) ? "VOICE" : "NO VOICE"))
        {
            mode ^= PXCUPipeline.Mode.VOICE_RECOGNITION;
            Application.LoadLevel(1);
        }

        GUI.Label(new Rect(10, 130, 350, 420),
                  msg != null?msg:"Instructions: Show one of your hands to the camera, " +
                  "and use \"closure + openness of Thumb Finger and Index Finger\" to create the KnifeRay to cut the fruits.\n\n" +
                  "GoldApple gives you 20 points, while other fruit gives 1 point.\n" +
                  "Accoring to the different angles of you KnifeRay, there are three Splashs." +
                  "Every object has a different color of splash.\n\n" +
                  "Challenge: Cutting the Fruit and Hamster with Gesture is a bit difficult.\n\n" +
                  "Tips: Don't cut the Hamster, it will cause you lose 1 life.");
    }
 void Norm()
 {
     if ((mode&PXCUPipeline.Mode.FACE_LANDMARK)!=0) mode|=PXCUPipeline.Mode.FACE_LOCATION;
     if ((mode&PXCUPipeline.Mode.FACE_LOCATION)!=0) mode|=PXCUPipeline.Mode.COLOR_VGA;
     if ((mode&PXCUPipeline.Mode.GESTURE)!=0) mode|=PXCUPipeline.Mode.DEPTH_QVGA;
 }
Esempio n. 7
0
    void Start()
    {
        xy = new float[2]{157.0f,121.0f};
        PG = gameObject.GetComponent<PerCGesture>();
        //in start i am just going to initialize the pipeline and get the resolution of the camera
        //to get the resolution, use the getRez function.

        myPipe = new PXCUPipeline();
        trackedLimb = PXCMGesture.GeoNode.Label.LABEL_BODY_HAND_PRIMARY;// Primary is first tracked hand
        myMode = PXCUPipeline.Mode.GESTURE|PXCUPipeline.Mode.COLOR_VGA  ; //the mode i want to use

        if(!myPipe.Init(myMode)){
            Debug.Log("The pipeline failed to initialize bras :'(\n");
            initiated=false;
            return;
        }
        else initiated = true;

        resFound = myPipe.QueryRGBSize(resolution);
        centeredX = true;
        centeredY = true;
    }
Esempio n. 8
0
    public void restart()
    {
        //shut this motha down.
        if(myPipe != null){
            myPipe.Dispose();
            myPipe = null;
        }

        myPipe = new PXCUPipeline();
        trackedLimb = PXCMGesture.GeoNode.Label.LABEL_BODY_HAND_PRIMARY;// Primary is first tracked hand
        myMode = PXCUPipeline.Mode.GESTURE|PXCUPipeline.Mode.COLOR_VGA  ; //the mode i want to use

        if(!myPipe.Init(myMode)){
            Debug.Log("The pipeline failed to initialize bras :'(\n");
            initiated=false;
            return;
        }
        else initiated = true;
    }