Vuforia Unity Camera Image Access
本文描述了两种方法获取QCAR相机在unity的图像。 The Image class 有两个选项获取摄像机图像从unity(没有增加)。一个是使用 Image 的类。这就像本地的版本。首先,使用 CameraDevice 注册所需的图像式。SetFrameFormat方法: CameraDevice.Instance.SetFrameFo
本文描述了两种方法获取QCAR相机在unity的图像。
The Image class
有两个选项获取摄像机图像从unity(没有增加)。一个是使用Image的类。这就像本地的版本。首先,使用CameraDevice注册所需的图像格式。SetFrameFormat方法:CameraDevice.Instance.SetFrameFormat(Image.PIXEL_FORMAT.RGB888, true);
在QCARBehaviour运行Start方法调用此方法(使用Unity脚本排序特征,或在一次更新回调)。
然后,您可以使用CameraDevice.GetCameraImage方法检索图像。您可以从ITrackerEventHandler.OnTrackablesUpdated回调来确保你获取最新的相机的图像匹配当前帧。经常检查以确保相机的图像是无效的,因为它可以登记注册后的图像变得可用图像格式需要几帧。
这是完整的脚本:
using UnityEngine; using System.Collections; public class CameraImageAccess : MonoBehaviour, ITrackerEventHandler { private Image.PIXEL_FORMAT m_PixelFormat = Image.PIXEL_FORMAT.RGB888; private bool m_RegisteredFormat = false; private bool m_LogInfo = true; void Start() { QCARBehaviour qcarBehaviour = (QCARBehaviour) FindObjectOfType(typeof(QCARBehaviour)); if (qcarBehaviour) { qcarBehaviour.RegisterTrackerEventHandler(this); } } public void OnTrackablesUpdated() { if (!m_RegisteredFormat) { CameraDevice.Instance.SetFrameFormat(m_PixelFormat, true); m_RegisteredFormat = true; } if (m_LogInfo) { CameraDevice cam = CameraDevice.Instance; Image image = cam.GetCameraImage(m_PixelFormat); if (image == null) { Debug.Log(m_PixelFormat + " image is not available yet"); } else { string s = m_PixelFormat + " image: \n"; s += " size: " + image.Width + "x" + image.Height + "\n"; s += " bufferSize: " + image.BufferWidth + "x" + image.BufferHeight + "\n"; s += " stride: " + image.Stride; Debug.Log(s); m_LogInfo = false; } } } }
Background Texture Access
Image类提供了相机的像素作为一个字节数组。这对一些图像处理任务是有用的,但有时最好获得作为一个OpenGL纹理图像。您可以使用BackgroundTextureAccess示例演示的方法。在这里,而不是让Vuforia渲染摄像机图像每一帧,你注册一个Texture2D对象充满相机像素每一帧。见Readme。txt附带的示例(在资产文件夹)两种方式渲染相机图像使用这种方法。
参考资料
https://developer.vuforia.com/resources/dev-guide/unity-camera-image-access

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

It seems that DJI is already selling its next drone in certain markets, despite not having unveiled it yet in any capacity. To recap, there has been evidence that Best Buy had started stocking the DJI Neo in certain brick-and-mortar stores. However,

LeicareleasedtheLeicaLuxcameraappfortheAppleiPhoneafewdaysago.However,theappwasnotdevelopedbyLeica,butbyFjorden.ThecompanyhasbeenknownprimarilyforitscameragripsfortheiPhoneandwasacquiredbyLeicainDecember2023.Fo

The Fujifilm X-M5 has shown itself in a handful of rumours that suggested that the compact APS-C camera would launch as an affordable alternative to the X100VI sometime in late 2024. Now, a new rumour out of Fujirumours reveals Fujifilm's film simula

The Osmo Action 5 Pro is seemingly fast approaching. While DJI still remains publicly quiet about the device, leakers like @Quadro_News continue to reveal various details online. To recap, the leaker shared several previously unseen promotional image

The Sony ZV-E10 II has been leaked before as coming in the first half of 2024, and while the initial launch was seemingly set for sometime in May, it was apparently delayed. A new leak shared by prolific leaker Andrea Pizzini, supposedly originating

Nikon recently launched the Z6 III to an impressively positive reception, although it has left some fans wondering what happened to the Z7 III — the Z6 II and Z7 II (curr. $2,296.95 on Amazon) launched alongside one-another, after all. A tentative li

DJI has now released the Neo (curr. $199 on Amazon), which is only its second consumer drone release. While the company is expected to introduce the Air 3S this year as well, it also has a new action camera waiting in the wings. For context, GoPro ha
