简体   繁体   English

在Unity中从Vuforia获取相机镜框

[英]Get camera frame from Vuforia in Unity

I want to create a simple AR application using unity3d, vuforia package and opencv. 我想使用unity3d,vuforia软件包和opencv创建一个简单的AR应用程序。 Normally in unity AR app, selected 2d target is found and virtual 3d object is projected. 通常,在统一AR应用程序中,找到选定的2d目标并投影虚拟3d对象。

I want to change these scenario. 我想改变这些情况。

  1. Open AR camera 打开AR相机
  2. Get frame from camera 从相机获取帧
  3. Process the frame using opencv functions(maybe opencvsharp) 使用opencv函数处理框架(可能是opencvsharp)
  4. Find marker and project virtual object 查找标记并投影虚拟对象

To do this task, I did below steps : 为此,我做了以下步骤:

  1. create a new project in unity unity创建一个新项目
  2. import vuforia package 导入vuforia package
  3. delete main camera 删除main camera
  4. add AR camera 添加AR相机

The AR camera has 3 c# files, I open and look them. AR相机有3个c#文件,我打开并查看它们。 But I don't see any code open camera and get frame. 但是我看不到任何代码可以打开相机并获得框架。 The screenshot is below : 屏幕截图如下:

在此处输入图片说明

EDIT 编辑

Accepted answer helps load user defined marker. 接受的答案有助于加载用户定义的标记。

This is the basic workflow of Vuforia using Unity. 这是使用Unity的Vuforia的基本工作流程。

Start from License Manager 许可证管理器开始

  • On the License Manager page go to Add License Key 在“ License Manager页面上,转到“ Add License Key

  • bPut in your details and if you don't plan to use a paid version in the Select Plan option click None b输入您的详细信息,如果您不打算在“ Select Plan选项中使用付费版本,请单击“ None

Now go to Target Manager 现在转到目标管理器

  • First Add a Database (if you don't have one already) and give it a Name , add License Key and click Create 首先Add a Database (如果还没有Add a Database话),并给它Name ,添加License Key ,然后单击Create

  • Now inside your Database click Add Target and again put in all the details and upload your image. 现在,在数据库中单击“ Add Target然后再次放入所有详细信息并上传图像。

  • Now Download Database and make sure you've set it's usage to Unity Editor 现在Download Database ,并确保已将其用法设置为Unity Editor

Now within Unity 现在在Unity中

  • Add your ARCamera 添加您的ARCamera

  • Import the Database you downlaoded into Unity through Assets - Import Package - Custom Package 通过Assets - Import Package - Custom Package将您下层的数据库导入Unity

  • Now in your Inspector Panel of ARCamera, you'll see Data Set Load Behaviour has your unity package name. 现在,在ARCamera的Inspector面板中,您将看到Data Set Load Behaviour具有您的统一软件包名称。 Check it, and check Active as well 选中它,然后选中“ Active

  • Now in Assets , Go to Qualcomm - Prefabs - ImageTarget and drag Image Target onto the scene. 现在在Assets ,转到Qualcomm - Prefabs - ImageTarget并将Image Target拖到场景上。

  • In the ImageTarget Inspector you'll find ImageTarget behaviour and you can set the values to your Image. ImageTarget Inspector您将找到ImageTarget行为,并且可以将值设置为Image。

From here on, what you do is completely up to you. 从这里开始,您的工作完全取决于您自己。 You can add a Model or animate over is as you would on normal Unity applicatoins. 您可以像在普通Unity应用程序中那样添加模型或设置动画。

User Defined Targets can be found at: https://developer.vuforia.com/library/articles/Solution/Unity-Load-DataSet-from-SD-Card 用户定义的目标可在以下位置找到: https : //developer.vuforia.com/library/articles/Solution/Unity-Load-DataSet-from-SD-Card

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM