/// <summary>
 /// カメラの解像度を変更する
 /// </summary>
 /// <param name="w">横</param>
 /// <param name="h">縦</param>
 void setCameraRes(int w, int h)
 {
     webcamTexture.Pause();
     webcamTexture.requestedWidth  = w;
     webcamTexture.requestedHeight = h;
     webcamTexture.Play();
 }
 /// <summary>
 /// 摄像头暂停
 /// </summary>
 public void CameraPause()
 {
     if (te != null)
     {
         te.Pause();
     }
 }
Esempio n. 3
0
 void OnDisable()
 {
     if (camTexture != null)
     {
         camTexture.Pause();
     }
 }
Esempio n. 4
0
 public void PauseCamera()
 {
     if (texWebcam != null)
     {
         texWebcam.Pause();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 映像の一時停止
 /// </summary>
 public void Pause()
 {
     if (mTexture != null && mTexture.isPlaying)
     {
         mTexture.Pause();
     }
 }
Esempio n. 6
0
 public void PauseWebcam()
 {
     if (webcamTexture != null && webcamTexture.isPlaying)
     {
         webcamTexture.Pause();
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (isQRMode)
        {
            //카메라 이용해서 update시 마다 QR코드 찾는 것 찾으면 바로 종료됨.
            try
            {
                IBarcodeReader barcodeReader = new BarcodeReader();
                // decode the current frame
                var result = barcodeReader.Decode(camTexture.GetPixels32(), camTexture.width, camTexture.height);
                if (result != null)
                {
                    //Debug.Log("DECODED TEXT FROM QR:" + result.Text);
                    camTexture.Pause();
                    isQRMode = false;
                    webCamGameObject.SetActive(false);

                    string[] part = result.Text.Split('/');
                    nodeIP   = part[0];
                    nodePort = Int32.Parse(part[1]);
                    //찾으면 nodeIP란 string에 저장.
                }
            }
            catch (System.Exception ex) { Debug.LogWarning(ex.Message); }
        }
    }
Esempio n. 8
0
    void SaveImage()
    {
        webCamTexture.Pause();
        Texture2D destTexture = new Texture2D(webCamTexture.width, webCamTexture.height, TextureFormat.ARGB32, false);

        Color[] textureData = webCamTexture.GetPixels();

        destTexture.SetPixels(textureData);
        destTexture.Apply();
        byte[] pngData      = destTexture.EncodeToPNG();
        string absolutePath = Application.dataPath + "/";

        //if(File.Exists(Application.persistentDataPath+"/capturedPic2.png"))
        //if(File.Exists("WebcamSnaps" + "photo.png"))
        if (File.Exists(absolutePath + "surveillanceCapture01.png"))
        {
            //File.Delete(Application.persistentDataPath+"/capturedPic2.png");
            //File.Delete("WebcamSnaps" + "photo.png");
            File.Delete(absolutePath + "surveillanceCapture01.png");
        }
        //File.WriteAllBytes(Application.persistentDataPath+"/capturedPic2.png",pngData);
        //File.WriteAllBytes("WebcamSnaps" + "photo.png",pngData);
        File.WriteAllBytes(absolutePath + "surveillanceCapture01.png", pngData);
        //Debug.Log("pic saved to"+Application.persistentDataPath);

        //Debug.Log("WebcamSnaps");
        Debug.Log("File Saved to Desktop/Surveillance/CamCapture/");
    }
Esempio n. 9
0
 /// <summary>
 /// Raises the pause button click event.
 /// </summary>
 public void OnPauseButtonClick()
 {
     if (hasInitDone)
     {
         webCamTexture.Pause();
     }
 }
Esempio n. 10
0
 void OnGUI()
 {
     if (_camTexture && _camTexture.isPlaying)
     {
         GUI.DrawTexture(new Rect(0, 0, 100, 80), _camTexture, ScaleMode.ScaleToFit);
     }
     if (GUILayout.Button("play"))
     {
         if (_camTexture)
         {
             _camTexture.Play();
         }
     }
     if (GUILayout.Button("pause"))
     {
         if (_camTexture)
         {
             _camTexture.Pause();
         }
     }
     if (GUILayout.Button("stop"))
     {
         if (_camTexture)
         {
             _camTexture.Stop();
         }
     }
 }
Esempio n. 11
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(10, 20, 100, 40), "开启摄像头"))
     {
         // 调用摄像头
         StartCoroutine(start());
     }
     if (GUI.Button(new Rect(10, 70, 100, 40), "捕获照片"))
     {
         //捕获照片
         tex.Pause();
         StartCoroutine(getTexture());
     }
     if (GUI.Button(new Rect(10, 120, 100, 40), "再次捕获"))
     {
         //重新开始
         tex.Play();
     }
     if (GUI.Button(new Rect(120, 20, 80, 40), "录像"))
     {
         //录像
         StartCoroutine(SeriousPhotoes());
     }
     if (GUI.Button(new Rect(10, 170, 100, 40), "停止"))
     {
         //停止捕获镜头
         tex.Stop();
         StopAllCoroutines();
     }
     if (tex != null)
     {
         // 捕获截图大小               —距X左屏距离   |   距Y上屏距离
         GUI.DrawTexture(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 190, 280, 200), tex);
     }
 }
 /// <summary>
 /// Pauses the active camera.
 /// </summary>
 public virtual void Pause()
 {
     if (hasInitDone)
     {
         webCamTexture.Pause();
     }
 }
Esempio n. 13
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "Player")
     {
         webCam.Pause();
     }
 }
 /// <summary>
 /// Pause.
 /// </summary>
 public void Pause()
 {
     if (webTex != null)
     {
         webTex.Pause();
     }
 }
 private void StopCamera()
 {
     seperatorCG.DOFade(0, 0.5f);
     webcamTexture.Pause();
     textCG.DOFade(0, 0.5f);
     imageOutput.transform.DOScale(0.5f, 0.5f);
 }
Esempio n. 16
0
    public void VideoImagen(bool grabando)
    {
        Pasos.SePuedePintar = !grabando;

        if (grabando == true)
        {
            Debug.Log("Se llamo");
            if (webcamTexture == null)
            {
                webcamTexture = new WebCamTexture();

                int rotation = webcamTexture.videoRotationAngle;
                rotation += 180;
            }
            webcamTexture.deviceName      = camName;
            webcamTexture.requestedHeight = alto;  //Screen.height;
            webcamTexture.requestedWidth  = ancho; //Screen.width;
            webcamTexture.requestedFPS    = FPS;
            webcamTexture.filterMode      = FilterMode.Trilinear;
            webcamTexture.Play();
            FondoWebCam.texture = webcamTexture;
            FondoWebCam.material.mainTexture = webcamTexture;
        }
        else
        {
            webcamTexture.Pause();
        }
    }
Esempio n. 17
0
 public void Pause()
 {
     if (_webcamTexture != null && _webcamTexture.isPlaying)
     {
         _webcamTexture.Pause();
     }
 }
 /// <summary>
 /// Pause this instance.
 /// </summary>
 public void Pause()
 {
     if (initDone)
     {
         webCamTexture.Pause();
     }
 }
Esempio n. 19
0
 /// <summary>
 /// Raises the pause button event.
 /// </summary>
 public void OnPauseButton()
 {
     if (initDone)
     {
         webCamTexture.Pause();
     }
 }
Esempio n. 20
0
 public void Stop()
 {
     if (webCamTexture != null)
     {
         webCamTexture.Pause();
     }
 }
Esempio n. 21
0
    void Update()
    {
        GameObject.Find("Tempo").GetComponent <Text>().text = tempoTotal.ToString("F0");

        //contagem regressiva
        if (tempoTotal > 0.5 && comecarContagem)
        {
            UiVisivel(true);
            tempoTotal = tempoTotal - Time.deltaTime;
            //comecarContagem = false;
        }
        //Tira a foto e salvar;
        if (tempoTotal <= 0.5f && tirarFoto)
        {
            Application.CaptureScreenshot("Foto" + NumeroFoto + ".png");
            GameObject.Find("Flash").GetComponent <RawImage>().enabled = true;
            webcamTex.Pause();
            UiVisivel(false);
            GameObject.Find("Flash").GetComponent <RawImage>().CrossFadeAlpha(0, 1, false);
            tirarFoto = false;
            instConf  = GameObject.Instantiate(confir) as GameObject;
            instConf.transform.SetParent(GameObject.Find("Canvas").transform);
            instConf.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
            GameObject.Find("Config").GetComponent <Button>().interactable = false;
        }

        if (tempoTotal <= 1f && tirarFoto && animDedo)
        {
            GameObject.Find("dedao").GetComponent <Animator>().SetTrigger("dedaoFoto");
            animDedo = false;
        }
    }
Esempio n. 22
0
    static int Pause(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        WebCamTexture obj = LuaScriptMgr.GetNetObject <WebCamTexture>(L, 1);

        obj.Pause();
        return(0);
    }
        /// <summary>
        /// Initialize the WebCam
        /// </summary>
        private IEnumerator Start()
        {
            SetDefaultSaveDirectory();

            _initializing = true;
            if (!CreateWebCamTexture())
            {
                yield break;
            }

            _webcamTexture.Play();

            yield return(new WaitForSeconds(3));

            _webcamTexture.Pause();
            _initializing = false;
        }
Esempio n. 24
0
 public void Pause()
 {
     if (webCam != null)
     {
         webCam.Pause();
         rImage.gameObject.SetActive(false);
     }
 }
 private void StopWebCam()
 {
     isStreaming = false;
     if (webCam != null)
     {
         webCam.Pause();
     }
 }
    static int Pause(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        WebCamTexture obj = (WebCamTexture)LuaScriptMgr.GetUnityObjectSelf(L, 1, "WebCamTexture");

        obj.Pause();
        return(0);
    }
Esempio n. 27
0
 void OnDisable()
 {
     if (camTexture != null)
     {
         camTexture.Pause();
         doDecoding = false;
     }
 }
Esempio n. 28
0
    void StartSimulation()
    {
        // Freeze the video background
        webCamTexture.Pause();

        // Create the circles' representation in the
        // physics simulation.
        //iterate through the scanned circles and instanitate prefabs into given coordinates
        int numCircles = circles.Count;

        for (int i = 0; i < numCircles; i++)
        {
            Circle     circle          = circles[i];
            GameObject simulatedCircle =
                (GameObject)Instantiate(
                    simulatedCirclePrefab);
            Transform simulatedCircleTransform =
                simulatedCircle.transform;
            simulatedCircleTransform.position =
                circle.worldPosition;
            simulatedCircleTransform.localScale =
                circle.screenDiameter *
                Vector3.one;
            simulatedObjects.Add(simulatedCircle);
        }

        // Create the lines' representation in the
        // physics simulation.
        //iterate through the scanned circles and instanitate prefabs into given coordinates
        int numLines = lines.Count;

        for (int i = 0; i < numLines; i++)
        {
            Line       line          = lines[i];
            GameObject simulatedLine =
                (GameObject)Instantiate(
                    simulatedLinePrefab);
            Transform simulatedLineTransform =
                simulatedLine.transform;
            float angle = -Vector2.Angle(
                Vector2.right, line.screenPoint1 -
                line.screenPoint0);
            Vector3 worldPoint0 = line.worldPoint0;
            Vector3 worldPoint1 = line.worldPoint1;
            simulatedLineTransform.position =
                0.5f * (worldPoint0 + worldPoint1);
            simulatedLineTransform.eulerAngles =
                new Vector3(0f, 0f, angle);
            simulatedLineTransform.localScale =
                new Vector3(
                    Vector3.Distance(
                        worldPoint0,
                        worldPoint1),
                    lineThickness,
                    lineThickness);
            simulatedObjects.Add(simulatedLine);
        }
    }
Esempio n. 29
0
        /// <summary>
        /// Take a snapshot and store image to data path.
        /// </summary>
        public string TakeSnapshotWebcam()
        {
            // No device detected!!
            // cannot take snap shot without the device!!
            if (!mDetectDevice)
            {
                JCS_Debug.LogError("No webcam detected in the current devices");
                return null;
            }

            var gs = JCS_GameSettings.instance;
            var prefix = gs.WEBCAM_FILENAME;
            var ext = gs.WEBCAM_EXTENSION;

            string savePath = SavePath();

            JCS_IO.CreateDirectory(savePath);

            Texture2D snap = new Texture2D(mWebCamTexture.width, mWebCamTexture.height);
            snap.SetPixels(mWebCamTexture.GetPixels());
            snap.Apply();

            // get the last saved webcam image's index
            int last_saved_index = LastImageFileIndex() + 1;

            string fullPath = ImagePathByIndex(last_saved_index);

            File.WriteAllBytes(fullPath, snap.EncodeToPNG());


            if (mSplash)
            {
                JCS_SceneManager sm = JCS_SceneManager.instance;

                if (sm.GetWhiteScreen() == null)
                    JCS_UtilityFunctions.PopJCSWhiteScreen();

                sm.GetWhiteScreen().FadeIn();

                // do the snap shot effect
                mSplashEffectTrigger = true;
            }

            // Stop the camera
            mWebCamTexture.Pause();

            // start the timer wait for resume
            mResumeTrigger = true;

            // play sound.
            {
                var soundm = JCS_SoundManager.instance;
                JCS_SoundPlayer sp = soundm.GetGlobalSoundPlayer();
                sp.PlayOneShot(mTakePhotoSound);
            }

            return fullPath;
        }
Esempio n. 30
0
    private void Hide()
    {
        isShown = false;

        webcamTexture.Pause();
        DOTween.Kill(transform.GetInstanceID());
        CG.DOFade(0, 0.5f).SetId(transform.GetInstanceID());
        exerciseCG.DOFade(1, 0.5f).SetId(transform.GetInstanceID());
    }