void Update() { if (webCamTexture.didUpdateThisFrame) { Color[] color = webCamTexture.GetPixels(); if (first == 0) { w = webCamTexture.width; h = webCamTexture.height; GameObject.Find("ResultLabel").GetComponent <Text> ().text = w + " x " + h; texture = new Texture2D(w, h); videoImage.texture = texture; videoImage.material.mainTexture = texture; } ImageProcessor processor = new ImageProcessor(w, h, webCamTexture, texture); Manager manager = GameObject.Find("Manager").GetComponent <Manager> (); int captSize = (int)(90 * (1 - manager.captureMax)) + 10; if (is_recording) { processor.ProcessImage(captSize, manager.minThr, manager.maxThr, manager.filterSize); is_recording = new TimeSpan(DateTime.Now.Ticks - startTime.Ticks).TotalSeconds <= 5; lastPattern = processor.FindLowLevelPattern(captSize, (int)(90 * manager.captureMin) + 10, GameObject.Find("Pattern Name").GetComponent <InputField> ().text); // manager.Types[GameObject.Find ("Type").GetComponent<Dropdown> ().value] if (lastPattern != null) { texturePat = new Texture2D(lastPattern.W, lastPattern.H); patternImage.texture = texturePat; patternImage.material.mainTexture = texturePat; } if (false) //lastPattern is PatternGroup) { { PatternGroup group = (PatternGroup)lastPattern; string s = "Groups: " + group.Count + "; "; for (int i = 0; i < group.Count; i++) { BoundingBox box = group.GetBox(i); s += box.MinX + ", " + box.MinY + ", " + box.MaxX + ", " + box.MaxY + "; "; } Debug.Log(s); } } else { texture.SetPixels(webCamTexture.GetPixels()); processor.DrawCaptureBox(captSize); } texture.Apply(); if (lastPattern != null) { ImageProcessor.DrawPattern(lastPattern, texturePat); texturePat.Apply(); } first++; } }