本文描述了两种方法获取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

MySQLstringtypesimpactstorageandperformanceasfollows:1)CHARisfixed-length,alwaysusingthesamestoragespace,whichcanbefasterbutlessspace-efficient.2)VARCHARisvariable-length,morespace-efficientbutpotentiallyslower.3)TEXTisforlargetext,storedoutsiderows,

MySQLstringtypesincludeVARCHAR,TEXT,CHAR,ENUM,andSET.1)VARCHARisversatileforvariable-lengthstringsuptoaspecifiedlimit.2)TEXTisidealforlargetextstoragewithoutadefinedlength.3)CHARisfixed-length,suitableforconsistentdatalikecodes.4)ENUMenforcesdatainte

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

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

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
