/// <summary> /// The main update loop of the project. Each frames pixels get sent to the /// segmentation manager. /// </summary> private void Update() { // If the webcam image is unchanged, display image from the WebCamTexture. if (!onChanged) { output.texture = cameraTexture.GetWebCamTexture(); return; } var webCamTexture = cameraTexture.GetWebCamTexture(); // Creating new texture2D for editing privileges. var texture2D = new Texture2D(webCamTexture.width, webCamTexture.height); // Make Modifications. texture2D.SetPixels(segmentationManager.SegmentColors(webCamTexture, threshold, displayOptions)); // Apply modificaitons. texture2D.Apply(); // Output modified texture to the RawImage. output.texture = texture2D; // Model the hand to screen. handModel.ModelHand(segmentationManager.GetSkinObject(), segmentationManager.GetHullPoints(), cameraTexture.GetScale()); }
/// <summary> /// Sort of like a constuctor, works like a 'main'. /// </summary> private void Start() { onChanged = false; cameraTexture = new CameraTexture(xResolution, yResolution); colorSpace.SetScale(cameraTexture.GetScale()); }