Quantcast
Channel: Questions in topic: "webcam"
Viewing all articles
Browse latest Browse all 256

When I run getPixel32 () in WebcamTexture, only black pixels are returned.

$
0
0
When you do getPixel32 () from WebcamTexture, the value of [0] must be RGBA (0,0,0,255). Build on Windows x64. (Editor Result Same) Below is a test source code. -------------------------- Using System.Collections; Using System.Collections.Generic; Using UnityEngine; Public class Sample: MonoBehaviour {     [SerializeField]     Private Color32 [] _color32;     [SerializeField]     Private WebCamTexture _webcamTexture;     Void Start ()     {         WebCamDevice [] _webCamDevices = WebCamTexture.devices;         _webcamTexture = new WebCamTexture (_webCamDevices [0] .name);         _webcamTexture.Play ();     }     Void Update ()     {         _color32 = _webcamTexture.GetPixels32 ();         Debug.Log (_color32 [0]);     } } ------------------------------------------------ When you run this simple code, RGBA (0, 0, 0, 255) is always output as the result. The webcam is not black because it normally takes a lot of shots. And if _color32 is displayed on the sprite using setPixel32 (), the image on the webcam will display correctly. How do I get the right Color32 [] value? The reason I want to get this value is because I want to pass this Color32 [] value to my plug-in and process it.

Viewing all articles
Browse latest Browse all 256

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>