找回密码
 立即注册
查看: 5112|回复: 88

[脚本] Unity调用手机摄像头进行摄像,并显示

[复制链接]
发表于 2013-4-25 13:47 | 显示全部楼层 |阅读模式

核心知识:
WebCamTexture(网络摄像头材质)
关键方法:
WebCamTexture.Play()播放;WebCamTexture.Pause()暂停;WebCamTexture.Stop()停止;
例1:

  1. public  WebCamTexture   webCamTexture;

  2. public   Material     webCamMaterial;

  3. IEnumerator   webCam(){

  4. yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);

  5.     if (Application.HasUserAuthorization(UserAuthorization.WebCam))  

  6.     {  

  7.         WebCamDevice[] devices = WebCamTexture.devices;  

  8.         deviceName = devices[0].name;  

  9.      

  10.     tex= new WebCamTexture(deviceName, 400, 300, 12);  

  11.     webCamShow.mainTexture=tex;

  12.         tex.Play();

  13.     }  

  14. }

复制代码
发表于 2016-10-20 08:54 | 显示全部楼层
学习~~学习~~学习~~
发表于 2016-10-20 11:54 | 显示全部楼层

感谢楼主的无私分享!
发表于 2017-3-14 10:57 | 显示全部楼层
顶顶多好
发表于 2017-3-14 10:56 | 显示全部楼层
真心顶
发表于 2017-3-14 10:52 | 显示全部楼层
说的非常好
发表于 2017-3-14 10:34 | 显示全部楼层
很好哦
发表于 2017-3-14 10:04 | 显示全部楼层
不错不错
发表于 2017-3-31 21:12 | 显示全部楼层
很不错
发表于 2017-3-31 21:24 | 显示全部楼层
楼主是超人
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-29 23:20 , Processed in 0.105598 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表