Inheritance: IDisposable
コード例 #1
0
    void Start()
    {
        if ((Options.mode & PXCUPipeline.Mode.VOICE_RECOGNITION) == 0)
        {
            options.SetMessage("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.");
            return;
        }

        pp = new PXCUPipeline();
        if (!pp.Init(PXCUPipeline.Mode.VOICE_RECOGNITION))
        {
            options.SetMessage("Failed to initialize PXCUPipeline for voice recognition");
            return;
        }

        /* It's critical to set the volume for recognition because the camera is very sensitive */
        float[] volume = new float[1] {
            0.2f
        };
        pp.SetDeviceProperty(PXCMCapture.Device.Property.PROPERTY_AUDIO_MIX_LEVEL, volume);

        stop   = false;
        line   = null;
        thread = new Thread(ThreadRoutine);
        thread.Start();
    }
コード例 #2
0
    void Start()
    {
        pp = new PXCUPipeline();

        int[] size = new int[2] {
            320, 240
        };
        if (pp.Init(PXCUPipeline.Mode.GESTURE))
        {
            pp.QueryLabelMapSize(size);
            print("LabelMap: width=" + size[0] + ", height=" + size[1]);
            labelmap = new byte[size[0] * size[1]];
        }
        else
        {
            options.SetMessage("Failed to detect the Creative* camera. Please plugin the camera and click restart.");
        }
        handImage = new Texture2D(size[0], size[1], TextureFormat.ARGB32, false);
        ZeroImage(handImage);
        handData    = new PXCMGesture.GeoNode[2][];
        handData[0] = new PXCMGesture.GeoNode[6];
        handData[1] = new PXCMGesture.GeoNode[6];

        mouse_nodes = new PXCMGesture.GeoNode[1][] { new PXCMGesture.GeoNode[12] };
    }
コード例 #3
0
 void OnDisable()
 {
     if (pp == null)
     {
         return;
     }
     pp.Dispose();
     pp = null;
 }
コード例 #4
0
 void Start()
 {
     pp=new PXCUPipeline();
     pp.Init(mode);
     int width, height;
     pp.QueryLabelMapSize(out width, out height);
     texture=new Texture2D(width,height,TextureFormat.ARGB32,false);
     renderer.material.mainTexture = texture;
 }
コード例 #5
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);
    }
コード例 #6
0
    void OnDisable()
    {
        if (thread != null)
        {
            stop = true;
            Thread.Sleep(5);
            thread.Join();
            thread = null;
        }

        if (pp != null)
        {
            pp.Dispose();
            pp = null;
        }
    }
コード例 #7
0
ファイル: Runner.cs プロジェクト: niklabh/perceptual-breakout
    void Start()
    {
        pp=new PXCUPipeline();
        //shm=GetComponent<ShadowHandMod>();
        int width, height;
        if (!pp.Init(mode)) {
        print("Unable to initialize the PXCUPipeline");
        cameraFound=false;
        return;
        }
        cameraFound=true;

        if (pp.QueryLabelMapSize(out width, out height))
        print("LabelMap: width=" + width + ", height=" + height);

        if (width>0) {
        m_Texture = new Texture2D (width, height, TextureFormat.ARGB32,false);
        renderer.material.mainTexture = m_Texture;

        labelmap=new byte[width*height];

        //shm.ZeroImage(m_Texture);
        }
    }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     pp = new PXCUPipeline();
 }
コード例 #9
0
ファイル: PerCGesture.cs プロジェクト: RandomNPC/Mathius_DOE
    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;
    }
コード例 #10
0
ファイル: PerCGesture.cs プロジェクト: RandomNPC/Mathius_DOE
 void OnDisable()
 {
     //shut this motha down.
     if(myPipe == null)return;
     myPipe.Dispose();
     myPipe = null;
 }
コード例 #11
0
ファイル: PerCGesture.cs プロジェクト: RandomNPC/Mathius_DOE
    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;
    }
コード例 #12
0
ファイル: PerCVoice.cs プロジェクト: RandomNPC/Mathius_DOE
    void Start()
    {
        PV = gameObject.GetComponent<PerCVoice>();

        myPipe = new PXCUPipeline();

        commandsSet = myPipe.SetVoiceCommands(commands);
        if(!commandsSet)Debug.Log("Failed to set Commands! :'(");
        if(!myPipe.Init(myMode) || !commandsSet){
            Debug.LogError("Failed To initialize PipeLine OH NOES!");
            initiated = false;
            return;
        }
        else {initiated = true; myPipe.SetDeviceProperty(audio_mix_prop,volume);}//must choose a volume that handles the environment, sensitive mic

        //default the bool arrays to false.
        numbers = new bool[10];
        options = new bool[commands.Length-10];
        for(int i = 0; i<numbers.Length;i++)numbers[i] = false;
        for(int j = 0; j<options.Length;j++)options[j] = false;

        keepLooping = true;//tell the thread not to stop
        dictated	= null;

        myThread = new Thread(ThreadFunc);//make thread handle
        myThread.Start();				  //let 'er rip!
    }
コード例 #13
0
ファイル: PerCVoice.cs プロジェクト: RandomNPC/Mathius_DOE
    void OnDisable()
    {
        //shut down the thread
        if(myThread!=null){
            keepLooping = false;
            Thread.Sleep(5);
            myThread.Join();
            myThread = null;
        }

        //shut down the pipeline
        if(myPipe != null){
            myPipe.Dispose();
            myPipe = null;
        }
    }
コード例 #14
0
    void Start()
    {
        /* VoiceRecognition is in a separate thread. See VoiceThread.cs. */
        PXCUPipeline.Mode mode = PXCUPipeline.Mode.GESTURE;// Options.mode & (~PXCUPipeline.Mode.VOICE_RECOGNITION);
        if (mode == 0) return;
        pp=new PXCUPipeline();
        if (!pp.Init(mode))
        {
            print("Unable to initialize the PXCUPipeline");
            return;
        }
        rotSpeed = 0;

        RepositionCamera();

        playerTurn = "Player1";
        playeBallTypeAssignedPlayer1 = "NA";
        playeBallTypeAssignedPlayer2 = "NA";
        winQuats = "";
        menuEnable = false;
        isPlayerPlayed = false;
        turnCount = 0;
        playerPlayedStopper = false;
        Screen.showCursor = false;
    }
コード例 #15
0
 void OnDisable()
 {
     if (pp==null) return;
     pp.Dispose();
     pp=null;
 }