/// <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()); }