public Color32[] GetPixels32 (Color32[] colors= null);

파라미터

colorsOptional array to receive pixel data.

설명

Returns the pixels data in raw format.

This can be faster then calling GetPixels, as pixel data does not have to be converted to color structs, so you may want to use it if you need to do continuous processing on the video feed. You can optionally pass in an array of Color32s to use in colors to avoid allocating new memory each frame, which is faster when you are continuously reading data from the camera. The array needs to be initialized to a length matching width * height of the texture. If you don't pass an array, GetPixels32 will allocate one for you and return it.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public WebCamTexture webcamTexture; public Color32[] data; void Start() { webcamTexture = new WebCamTexture(); webcamTexture.Play(); data = new Color32[webcamTexture.width * webcamTexture.height]; } void Update() { webcamTexture.GetPixels32(data); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961