When I run getPixel32 () in WebcamTexture, only black pixels are returned.
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.
Your answer
Follow this Question
Related Questions
WebCamTexture to circular sprite 1 Answer
Converting Texture2D into a video 1 Answer
Priview The Screenshot for User 0 Answers
WebCamTextures square 0 Answers
Stream webcam via Multiplayer networking or websocket 2 Answers