OGeek|极客世界-中国程序员成长平台

标题: ios - WebCamTexture iOS 模糊快照 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 10:21
标题: ios - WebCamTexture iOS 模糊快照

我目前正在使用 WebCamTexture 类来显示实时摄像机源,直到用户拍摄快照,然后我在我的应用程序中使用所述快照作为纹理。

这是我目前正在使用的代码:

private WebCamTexture cameraTexture;
private Texture2D snapshot;
public UITexture webCamTexture;

snapshot = new Texture2D(cameraTexture.width, cameraTexture.height);
snapshot.SetPixels(m_CameraTexture.GetPixels());
snapshot.Apply();
webCamTexture.mainTexture = snapshot;

注意:UITexture 类来自 NGUI,只是为了在场景中显示纹理。

在 Android 设备上,似乎没有问题。但是,当我在 iOS 设备上使用它时(在 iPad2 和 iPad3 上测试),纹理立即变为 设置时模糊。这是焦点问题吗?

我尝试了几件事,主要是在拍摄之前等待帧结束并在获取像素之前调用 cameraTexture.Pause(), 无济于事。

为什么 iOS 纹理会变得模糊?



Best Answer-推荐答案


我遇到了同样的问题,但是在 Texture2D 构造函数中将 mipmaps 设置为 false 似乎可以为我解决这个问题

即:

snapshot = new Texture2D(webcamTexture.width, webcamTexture.height, TextureFormat.ARGB32, false);

不幸的是,我没有解释为什么它会起作用。

关于ios - WebCamTexture iOS 模糊快照,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24129205/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4