如何在Kudan AR(Unity3D)中获取相机的WebcamTexture

时间:2017-03-10 01:41:37

标签: unity3d colors augmented-reality kudan

我目前正在开发AR应用程序,我需要从相机中获取对象的颜色。我需要获得相机的网络摄像头,但我不知道如何因为Kudan AR拥有它自己的相机。你知道怎么做吗?非常感谢!

1 个答案:

答案 0 :(得分:0)

你需要创建一个网络摄像头纹理并播放它,然后你可以创建一个texture2D和网络名称纹理的getpixels来获得你的颜色。

 WebCamTexture cam;

// Open the Camera on the desired device / pc cam 
    cam = new WebCamTexture();
    cam.Play();
   currentTexture =new Texture2D(cam.width, cam.height, TextureFormat.RGB24, false);

获取网络摄像头像素,您可以执行类似

的操作
       cam.GetPixels();