Starts the camera.
void Start() { mCamera = new WebCamTexture (); mCamera.Play (); gameObject.GetComponent<Renderer> ().material.mainTexture = mCamera; if(!mCamera.isPlaying) mCamera.Play (); }
/// <summary> /// /// </summary> void Start() { webcamTexture = new WebCamTexture(); matWeb.mainTexture = webcamTexture; webcamTexture.Play(); }
// Use this for initialization void Start() { var devices = WebCamTexture.devices; if ( devices.Length == 0 ) { Debug.LogError( "Webカメラが検出できませんでした。" ); return; } // WebCamテクスチャを作成する var webcamTexture = new WebCamTexture( Width, Height, FPS ); renderer.material.mainTexture = webcamTexture; webcamTexture.Play(); // ミラーリング if ( Mirror ) { transform.localScale = new Vector3( -transform.localScale.x, transform.localScale.y, transform.localScale.z ); } // 縦にする if ( RightUp ) { var euler = transform.localRotation.eulerAngles; transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z + 90 ); } else if ( LeftUp ) { var euler = transform.localRotation.eulerAngles; transform.localRotation = Quaternion.Euler( euler.x, euler.y, euler.z - 90 ); } }
// Use this for initialization void Start() { // Ensure orientation and scaling of the image. var scale = 2.2f; Quaternion rotation = Quaternion.Euler(0, 0, 0); Matrix4x4 rotationMatrix = Matrix4x4.TRS(Vector3.zero, rotation, new Vector3(scale , scale , scale)); gameObject.GetComponent<Renderer>().material.SetMatrix("_Rotation", rotationMatrix); int t = 0; bool front_facing = false; WebCamDevice[] devices = WebCamTexture.devices; // Gets the back facing camera if there is one on the device while(front_facing && t < devices.Length){ deviceName = devices[t].name; front_facing = devices[t].isFrontFacing; t++; } webcamTexture = new WebCamTexture(deviceName); // performs the vertical axis flip if (!front_facing) { transform.Rotate(new Vector3(0,0,180)); } // performs the horizontal axis flip that is the issue regardless transform.localScale = new Vector3(-1 * transform.localScale.x, transform.localScale.y, transform.localScale.z); GetComponent<Renderer>().material.mainTexture = webcamTexture; webcamTexture.Play(); }
void LoadConfigs(){ webcamTexture = new WebCamTexture (480, 320, 30); myURL = Config.masterURL; fileName = Config.currentChild; totalMemories = Config.currentChildDayMemoriesCount; Debug.Log ("Total memories: " + totalMemories); myURL += "?webfilename=" + fileName + "&webusername="******"&webpassword="******""; descriptionUILabel.value = ""; photoUITexture.mainTexture = null; #if UNITY_EDITOR webcamTexture = new WebCamTexture (); photoUITexture.mainTexture = webcamTexture; webcamTexture.Play (); #endif #if UNITY_IOS PromptForPhoto (); #endif }
public void SetWebCamTexture(int w, int h, int f) { width = w; height = h; fps = f; if(Application.isPlaying){ if( null != webcam ) { webcam.Stop(); Destroy(webcam); } webcam = new WebCamTexture(w, h, f); if(targetMaterial == null) { targetMaterial = renderer.material; } if(texturePropertyName == null || texturePropertyName.Length == 0) { targetMaterial.mainTexture = webcam; } else { targetMaterial.SetTexture(texturePropertyName, webcam); } webcam.Play(); } }
void Start() { if(PlayerPrefs.GetInt("Win",2)==1) { Winner.sprite=Bear; } else { Winner.sprite=Lion; } webCamTexture = new WebCamTexture("Camera 1"); //webCamTexture = new WebCamTexture(); Texture2D photo = new Texture2D(webCamTexture.width, webCamTexture.height); m_RendererPhoto.material.mainTexture = webCamTexture; //StartVideo webCamTexture.Play(); //Set Mode m_PhotoMode = true; m_RendererPhoto.gameObject.SetActive(m_PhotoMode); m_RendererRendu.gameObject.SetActive(!m_PhotoMode); }
// Use this for initialization void Start() { WebCamDevice[] devices = WebCamTexture.devices; // display all cameras for (var i = 0; i < devices.Length; i++) { Debug.Log (devices [i].name); } imageObj = GameObject.Find("RawImage").gameObject as GameObject; string deviceName = devices [0].name; foreach (var device in WebCamTexture.devices) { if (device.isFrontFacing) { deviceName = device.name; } } webcamTexture = new WebCamTexture(deviceName, Width, Height, FPS); if (webcamTexture == null) { Debug.Log (webcamTexture); } webcamTexture.Play(); imageObj.GetComponent<RawImage>().texture = webcamTexture; }
public static void Init(string deviceName, int requestedWidth, int requestedHeight, int requestedFps, BitDepth targetBitDepth) { WebCamTexture = new WebCamTexture(deviceName, requestedWidth, requestedHeight, requestedFps); WebCamTexture.Play(); if (!WebCamTextureProxy.instance) new GameObject("_webcamtextureproxy") { hideFlags = HideFlags.HideAndDontSave }.AddComponent<WebCamTextureProxy>().SetTargetTexture(WebCamTexture).SetTargetDepth(targetBitDepth).StartCapture(); }
// Use this for initialization void Start() { var wc = new WebCamTexture (640, 400); wc.Play (); Shader.SetGlobalTexture (propEmit, wc); Shader.SetGlobalTexture (propKage, wc); }
void Update() { // Control luminance treshold if (Input.GetKey(KeyCode.RightArrow)) { treshold = Mathf.Clamp(treshold + 0.001f, 0f, 1f); } else if (Input.GetKey(KeyCode.LeftArrow)) { treshold = Mathf.Clamp(treshold - 0.001f, 0f, 1f); } // Control fade out ratio if (Input.GetKey(KeyCode.DownArrow)) { fadeOutRatio = Mathf.Clamp(fadeOutRatio - 0.001f, 0f, 1f); } else if (Input.GetKey(KeyCode.UpArrow)) { fadeOutRatio = Mathf.Clamp(fadeOutRatio + 0.001f, 0f, 1f); } // Switch camera if (Input.GetKeyDown(KeyCode.C)) { if (WebCamTexture.devices.Length > 1) { currentWebcam = (currentWebcam + 1) % WebCamTexture.devices.Length; textureWebcam.Stop(); textureWebcam = new WebCamTexture(WebCamTexture.devices[currentWebcam].name); Shader.SetGlobalTexture("_TextureWebcam", textureWebcam); textureWebcam.Play(); } } if (Input.anyKey) { UpdateUniforms(); } }
// Use this for initialization void Start() { WebCamDevice[] devices = WebCamTexture.devices; int cameraCount = devices.Length; if (cameraCount == 0) { Image<Bgr, Byte> img = new Image<Bgr, byte>(640, 240); CvInvoke.PutText(img, String.Format("{0} camera found", devices.Length), new System.Drawing.Point(10, 60), Emgu.CV.CvEnum.FontFace.HersheyDuplex, 1.0, new MCvScalar(0, 255, 0)); Texture2D texture = TextureConvert.ImageToTexture2D(img, FlipType.Vertical); this.GetComponent<GUITexture>().texture = texture; this.GetComponent<GUITexture>().pixelInset = new Rect(-img.Width/2, -img.Height/2, img.Width, img.Height); } else { webcamTexture = new WebCamTexture(devices[0].name); baseRotation = transform.rotation; webcamTexture.Play(); //data = new Color32[webcamTexture.width * webcamTexture.height]; CvInvoke.CheckLibraryLoaded(); } }
static public int Play(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l); self.Play(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
// Use this for initialization void Start() { WebCamTexture webcamTexture = new WebCamTexture(); Renderer renderer = GetComponent<Renderer>(); renderer.material.mainTexture = webcamTexture; webcamTexture.Play(); }
// Use this for initialization void Start() { webcam = new WebCamTexture(); GetComponent<Renderer>().material.mainTexture = webcam; webcam.Play(); //webcam.videoVerticallyMirrored }
void Awake() { WebCamTexture webcam=new WebCamTexture(); imagen.texture = webcam; imagen.material.mainTexture=webcam; webcam.Play(); }
// Use this for initialization void Start() { // load image from camera back = new WebCamTexture (); renderer.material.mainTexture = back; back.Play (); }
void Start() { WebCamTexture webcamTexture = new WebCamTexture(); rawimage.texture = webcamTexture; rawimage.material.mainTexture = webcamTexture; webcamTexture.Play(); }
private string _SavePath = ""; //Change the path here! #endregion Fields #region Methods // Use this for initialization void Start() { WebCamDevice[] devices = WebCamTexture.devices; deviceName = devices[0].name; wct = new WebCamTexture(deviceName, 400, 300, 12); GetComponent<Renderer>().material.mainTexture = wct; wct.Play(); }
void WebCameraTextureSetting() { WebCamDevice[] devices = WebCamTexture.devices; webcamTexture = new WebCamTexture(devices[0].name, width, height, FPS); rawimage.texture = webcamTexture; rawimage.material.mainTexture = webcamTexture; webcamTexture.Play(); }
// Initialization void Start() { // Resolution of input should be 3600 x 600 or something with the same ratio //WebCamDevice[] devices = WebCamTexture.devices; webcamTexture = new WebCamTexture (webcamName); webcamTexture.Play (); GetComponent<Renderer> ().material.mainTexture = webcamTexture; }
void Start() { CameraTexture = new WebCamTexture("Remote Front Camera"); CameraTexture.Stop(); CameraTexture.Play(); Display.texture = CameraTexture; Display.material.mainTexture = CameraTexture; }
//public Quaternion basesRotation; // Use this for initialization void Start() { webcamTexture = new WebCamTexture (); GetComponent<Renderer>().material.mainTexture = webcamTexture; webcamTexture.requestedWidth = 1280; webcamTexture.requestedHeight = 720; webcamTexture.Play (); }
// Use this for initialization void Start() { WebCamTexture wt = new WebCamTexture(); r = this.GetComponent<Renderer>(); r.material.mainTexture = wt; wt.Play(); }
// Use this for initialization void Start() { webcam = new WebCamTexture("Microsoft LifeCam Rear");//"Microsoft LifeCam HD-6000");// "Microsoft LifeCam Front"); Renderer rend = GetComponent<Renderer>(); rend.material.mainTexture = webcam; try { webcam.Play(); } catch (Exception e) { webcam.Play(); } }
public override void OnEnter() { webCamTexture = new WebCamTexture(); webCamTexture.deviceName = webcamName.Value; webcamMaterial.Value.SetTexture("_MainTex", webCamTexture); webCamTexture.Play(); Finish(); }
// Starts the default camera and assigns the texture to the current renderer void Start() { webCamDevice = new WebCamDevice(); webcamTexture = new WebCamTexture(webCamDevice.name,800,600,1); renderer.material.mainTexture = webcamTexture; webcamTexture.Play(); }
// Use this for initialization void Start () { WebCamTexture webcamTexture = new WebCamTexture(); webcamTexture.Play(); MyWebcam.GetComponent<UITexture>().mainTexture = webcamTexture; }
void Awake() { m_webcamTexture = new WebCamTexture(); var rawImage = GetComponent<RawImage>(); rawImage.texture = m_webcamTexture; rawImage.material.mainTexture = m_webcamTexture; m_webcamTexture.Play(); }
public void StartStream(int width, int height, int fps) { if (texture != null) return; texture = new WebCamTexture(internalName, width, height, fps); texture.Play(); Debug.Log("Starting WebCam: " + name + " ("+ texture.width + ", " + texture.height + ")"); }
void Start() { webCam = new WebCamTexture(4096, 4096); material = GetComponent<Renderer>().material; material.mainTexture = webCam; webCam.Play(); }
static public int Play(IntPtr l) { try { UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l); self.Play(); return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int Play(IntPtr l) { try { UnityEngine.WebCamTexture self = (UnityEngine.WebCamTexture)checkSelf(l); self.Play(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }