-
Unity3D调用摄像头显示当前拍摄画面
- using UnityEngine;
- using System.Collections;
-
- public class CameraTest : MonoBehaviour
- {
- public WebCamTexture cameraTexture;
- public string cameraName="";
- private bool isPlay = false;
-
- void Start()
- {
- StartCoroutine(Test());
- }
-
-
- void Update()
- {
-
- }
-
- IEnumerator Test()
- {
- yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
- if (Application.HasUserAuthorization(UserAuthorization.WebCam))
- {
- WebCamDevice[] devices = WebCamTexture.devices;
- cameraName = devices[0].name;
- cameraTexture = new WebCamTexture(cameraName, 400, 300, 15);
- cameraTexture.Play();
- isPlay = true;
- }
- }
-
- void OnGUI()
- {
- if (isPlay)
- {
- GUI.DrawTexture(new Rect(0, 0, 400, 300), cameraTexture, ScaleMode.ScaleToFit);
- }
- }
- }
-
相关阅读:
video全屏视频背景适配不同分辨率
深入理解object.defineproperty()方法
抓取之近似网页过滤
基情四射的两个css样式
Hadoop 2.4.1 登录认证配置小结
Window中调试HBase问题小结
改了改博客界面
Hbase0.98.4/Hadoop2.4.1整合小结【原创】
Hadoop 2.4.1 Map/Reduce小结【原创】
hadoop的dfs工具类一个【原创】
-
原文地址:https://www.cnblogs.com/yfceshi/p/6856723.html
Copyright © 2020-2023
润新知