Tag: arcore

从Unity ARCore保存相机图像

这与此文章相关, 从Unity ARCore将AcquireCameraImageBytes()保存为存储为图像 我尝试了@JordanRobinson提到的步骤我有类似的问题只看到一个灰色方块。 我不断重新阅读他的更新,我不清楚第2步(创建纹理阅读器)如何与第3步相关联。我添加了更新函数来调用Frame.CameraImage.AcquireCameraImageBytes。 我想错过了什么。 我觉得我很亲密,因为它保存了一个图像(只是一个灰色的图像:-)任何你能提供的帮助将不胜感激 这是我的代码 private Texture2D m_TextureRender; private TextureReader m_CachedTextureReader; void Start () { m_CachedTextureReader = GetComponent(); m_CachedTextureReader.OnImageAvailableCallback += OnImageAvailable; QuitOnConnectionErrors (); } void Update () { Screen.sleepTimeout = SleepTimeout.NeverSleep; using (var image = Frame.CameraImage.AcquireCameraImageBytes()) { if (!image.IsAvailable) { return; } OnImageAvailable(TextureReaderApi.ImageFormatType.ImageFormatColor, image.Width, image.Height, image.Y, 0); } } private void OnImageAvailable(TextureReaderApi.ImageFormatType […]

ARCore for Unity保存相机图像

使用ARCore for Unity,尝试将Frame.CameraImage.AcquireCameraImageBytes()保存为图像并扫描图像以查找QR码。 但转换后的图像不是实际比例,而是重复,因此无法正确扣除QR码。 这是我的代码 void Update() { using (var image = Frame.CameraImage.AcquireCameraImageBytes()) { if (image.IsAvailable) { byte[] m_EdgeImage = null; Color32[] pixels = null; IParser Parser = new ZXingParser(); if (_texture == null || m_EdgeImage == null || _texture.width != image.Width || _texture.height != image.Height) { _texture = new Texture2D(image.Width, image.Height, TextureFormat.RGBA32, false, false); […]

将Unity ARCore中的AcquireCameraImageBytes()保存为存储为图像

使用Unity和新的1.1版本的ARCore,API公开了一些获取相机信息的新方法。 但是,我找不到任何好的示例,例如将其作为文件保存为本地存储作为jpg。 ARCore示例有一个很好的例子,可以检索相机数据,然后在此处执行操作: https : //github.com/google-ar/arcore-unity-sdk/blob/master/Assets/GoogleARCore/Examples/ComputerVision/ Scripts / ComputerVisionController.cs#L212以及一些检索该类中相机数据的示例,但没有任何保存该数据的示例。 我见过这个: 如何使用Unity ARCore SDK拍摄并保存图片/截图? 它使用较旧的API获取数据的方式,并没有真正详细说明保存。 我理想的是通过Unity将数据从API中的Frame.CameraImage.AcquireCameraImageBytes()转换为磁盘上的存储jpg。 更新 我已经开始工作了主要是在ARCore github页面上挖掘这个问题: https : //github.com/google-ar/arcore-unity-sdk/issues/72#issuecomment-355134812并修改下面的Sonny的答案,所以一个人被接受是公平的。 如果其他人试图这样做,我必须执行以下步骤: 在图像可用时,向Start方法添加一个回调以运行OnImageAvailable方法: public void Start() { TextureReaderComponent.OnImageAvailableCallback += OnImageAvailable; } 将TextureReader(来自随SDK提供的计算机视觉示例)添加到您的相机和脚本中 您的OnImageAvailable应该看起来像这样: /// /// Handles a new CPU image. /// /// The format of the image. /// Width of the image, in pixels. /// […]