使用的是 unity 2018.2.18f1 设备小米6
问题:摄像头捕获出来的图像显示到图片上被旋转了90度
解决方案:旋转承载图片(RawImage_Camera) rotation( z = -90)
注意:我在截取图像的时候高宽是正常设置的 因为图像被旋转在设置图片(RawImage_Camera)时将宽高对调了的
代码:
public string deviceName;
private WebCamTexture WCTexture = null;
//标准 为 1242*2688
float f = Screen.height / 2688f;
//申请打开摄像头权限
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if (Application.HasUserAuthorization(UserAuthorization.WebCam)) {
WebCamDevice[] devices = WebCamTexture.devices;
//var deviceName = "";
if (devices.Length > 0) {
deviceName = devices[0].name;
}
WCTexture = new WebCamTexture(deviceName, (int)(Scre