Home Database Mysql Tutorial Vuforia Unity Camera Image Access

Vuforia Unity Camera Image Access

Jun 07, 2016 pm 03:43 PM
camera image unity

本文描述了两种方法获取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);
Copy after login

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;
            }
        }
    }
}
Copy after login

Background Texture Access

Image类提供了相机的像素作为一个字节数组。这对一些图像处理任务是有用的,但有时最好获得作为一个OpenGL纹理图像。您可以使用BackgroundTextureAccess示例演示的方法。在这里,而不是让Vuforia渲染摄像机图像每一帧,你注册一个Texture2D对象充满相机像素每一帧。见Readme。txt附带的示例(在资产文件夹)两种方式渲染相机图像使用这种方法。


参考资料

https://developer.vuforia.com/resources/dev-guide/unity-camera-image-access

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Sep 07, 2024 am 09:34 AM

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

DJI Neo unboxing footage shows rumoured hardware and mentions much lower than expected launch pricing DJI Neo unboxing footage shows rumoured hardware and mentions much lower than expected launch pricing Aug 29, 2024 pm 12:38 PM

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,

Apple iPhone 16 Pro as Leica smartphone: Leica subsidiary confirms camera grip with official Leica app Apple iPhone 16 Pro as Leica smartphone: Leica subsidiary confirms camera grip with official Leica app Jun 13, 2024 pm 08:52 PM

LeicareleasedtheLeicaLuxcameraappfortheAppleiPhoneafewdaysago.However,theappwasnotdevelopedbyLeica,butbyFjorden.ThecompanyhasbeenknownprimarilyforitscameragripsfortheiPhoneandwasacquiredbyLeicainDecember2023.Fo

Fujifilm X-M5 to arrive with controversial X-T50 film simulation dial as leaker lets slip X-E5 confirmation Fujifilm X-M5 to arrive with controversial X-T50 film simulation dial as leaker lets slip X-E5 confirmation Aug 29, 2024 pm 02:40 PM

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

Leaker discloses higher than expected launch pricing for new DJI Osmo Action 5 Pro action camera Leaker discloses higher than expected launch pricing for new DJI Osmo Action 5 Pro action camera Sep 08, 2024 am 09:30 AM

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

Sony ZV-E10 II leak: 26 MP compact vlogger camera gets new release date and 2 companion lenses Sony ZV-E10 II leak: 26 MP compact vlogger camera gets new release date and 2 companion lenses Jun 29, 2024 pm 03:53 PM

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

Sketchy Nikon Z7 III leak points to 90 MP full-frame sensor, 8-stop IBIS, 4K 120 fps, 8K 60 fps video Sketchy Nikon Z7 III leak points to 90 MP full-frame sensor, 8-stop IBIS, 4K 120 fps, 8K 60 fps video Jun 22, 2024 pm 06:31 PM

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 Osmo Action 5 Pro: Leaker reveals 40 MP camera upgrade for GoPro Hero 13 Black rival with competitive launch pricing DJI Osmo Action 5 Pro: Leaker reveals 40 MP camera upgrade for GoPro Hero 13 Black rival with competitive launch pricing Sep 07, 2024 am 06:42 AM

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

See all articles