Chapter 02

WebCamTextureToMatExampleを読み解く

A
A
2021.12.26に更新


読む前にこれを読んでおくべき

UnityでのWebカメラの使い方
WebCamTexture, WebCamDeviceの使い方が載っている

https://note.com/npaka/n/nbaa0e466b0de

WebCamDeviceの取得

var devices = WebCamTexture.devices;
webCamDevice = devices[requestedDeviceIndex];

WebCamDevice

https://docs.unity3d.com/ScriptReference/WebCamDevice.html

Description

A structure describing the webcam device.

Properties

WebCamDevice.depthCameraName

https://docs.unity3d.com/ScriptReference/WebCamDevice-depthCameraName.html

Description

This string is null for webcam devices that do not support depth data. For webcams with depth data support (those of kind WebCamKind.ColorAndDepth) this string is not empty. Currently, only dual back and true depth cameras on latest iOS devices support depth data.

WebCamKind.ColorAndDepth

https://docs.unity3d.com/ScriptReference/WebCamKind.ColorAndDepth.html

Description

Camera which supports synchronized color and depth data (currently these are only dual back and true depth cameras on latest iOS devices).

WebCamTexture.isDepth

https://docs.unity3d.com/ScriptReference/WebCamTexture-isDepth.html

Description

This property is true if the texture is based on depth data.

WebCamTextureの取得

webCamTexture = new WebCamTexture(webCamDevice.name, requestedWidth, requestedHeight, requestedFPS);