想问下怎么用unity开发kinect拍照片,因为要拍照片,必须要先调用摄像头,但是由于Kinect自带的摄像头分辨率比较低,拍出来的照片很不理想,所以想换一个高清一点的摄像头,要怎么写呢?
下面是我不用kinect,单独调用外部摄像头的方法:
- public string deviceName;
- WebCamTexture tex;
- // Use this for initialization
- IEnumerator Start()
- {
- //获取授权
- yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
- if (Application.HasUserAuthorization(UserAuthorization.WebCam))
- {
- WebCamDevice[] devices = WebCamTexture.devices;
- print(devices.Length);
- deviceName = devices[0].name;
- tex = new WebCamTexture(deviceName, 1400, 900, 12);
- renderer.material.mainTexture = tex;
- tex.Play();
- }
- else
- {
- }
- }
用了上面那个调用外部摄像头的代码后,kinect的摄像头就不好用了;一直报“Could not start graph
UnityEngine.WebCamTexture:Play()
<Start>c__Iterator2:MoveNext() (at Assets/ZigFu/Scripts/Viewers/ZigToVM.cs:20)
Could not pause pControl
UnityEngine.WebCamTexture:Play()
<Start>c__Iterator2:MoveNext() (at Assets/ZigFu/Scripts/Viewers/ZigToVM.cs:20)
”错误,不知道是什么原因,哪位大神知道?