gpt4 book ai didi

unity-game-engine - 是否有用于在运行时创建图像目标的 AR SDK?

转载 作者:行者123 更新时间:2023-12-02 11:14:37 26 4
gpt4 key购买 nike

对于演示应用程序,我需要一个可靠的 AR SDK,它允许在运行时创建图像目标。

SDK 必须在移动设备上运行,并且目标不应由某些云服务器或在开发过程中创建。在这种情况下,用户将拍摄自己的标记(例如杂志封面),并对其进行裁剪和变形以用作标记(必须将 3D 对象随机分配给这些标记)。 vuforia 和 ARToolkit 都不允许这种情况。其他一些可能的 SDK

支持:Kudan , EasyARMAXST .

如果这根本不可能,是否有 AR SDK 允许多次使用完全相同的图像目标(或任何类型的标记)来渲染相同的 3D 对象?同样,vuforia 和 ARToolkit 不支持此功能。

最佳答案

Kudan 似乎不支持统一功能我认为原生 SDK 支持它。

Unlike the native SDKs, the Unity Plugin can't just get a raw image file from the assets and load it into the tracker. This is a feature we will be adding to the plugin in the future.

来源:- https://kudan.readme.io/docs/markers-1

EasyAR 另一方面支持从 .png 或 .jpg 一次创建一个图像或通过 .json 创建 imageTarget 以批量添加多个图像它在 EasyAR_SDK_2.2.0_Basic_Samples_Unity here 中的示例项目中提供。

注意:- 要运行示例项目,您需要

1 - 在他们的网站上注册 https://www.easyar.com/

2 - 创建 SDK 许可证 key from here .

3 - 按照此 Guide放置 key 并在统一上运行。

4 - 您的目标已在“HelloARTarget”项目中实现

这是从 .pjg 图像加载 AR 体验的示例项目脚本

using UnityEngine;
using System.Linq;
using EasyAR;

namespace Sample
{
public class HelloARTarget : MonoBehaviour
{
private const string title = "Please enter KEY first!";
private const string boxtitle = "===PLEASE ENTER YOUR KEY HERE===";
private const string keyMessage = ""
+ "Steps to create the key for this sample:\n"
+ " 1. login www.easyar.com\n"
+ " 2. create app with\n"
+ " Name: HelloARTarget (Unity)\n"
+ " Bundle ID: cn.easyar.samples.unity.helloartarget\n"
+ " 3. find the created item in the list and show key\n"
+ " 4. replace all text in TextArea with your key";

private void Awake()
{
if (FindObjectOfType<EasyARBehaviour>().Key.Contains(boxtitle))
{
#if UNITY_EDITOR
UnityEditor.EditorUtility.DisplayDialog(title, keyMessage, "OK");
#endif
Debug.LogError(title + " " + keyMessage);
}
}

void CreateTarget(string targetName, out SampleImageTargetBehaviour targetBehaviour)
{
GameObject Target = new GameObject(targetName);
Target.transform.localPosition = Vector3.zero;
targetBehaviour = Target.AddComponent<SampleImageTargetBehaviour>();
}
void Start()
{
SampleImageTargetBehaviour targetBehaviour;
ImageTrackerBehaviour tracker = FindObjectOfType<ImageTrackerBehaviour>();

// dynamically load from image (*.jpg, *.png)
CreateTarget("argame01", out targetBehaviour);
targetBehaviour.Bind(tracker);
targetBehaviour.SetupWithImage("sightplus/argame01.jpg", StorageType.Assets, "argame01", new Vector2());
GameObject duck02_1 = Instantiate(Resources.Load("duck02")) as GameObject;
duck02_1.transform.parent = targetBehaviour.gameObject.transform;

// dynamically load from json file
CreateTarget("argame00", out targetBehaviour);
targetBehaviour.Bind(tracker);
targetBehaviour.SetupWithJsonFile("targets.json", StorageType.Assets, "argame");
GameObject duck02_2 = Instantiate(Resources.Load("duck02")) as GameObject;
duck02_2.transform.parent = targetBehaviour.gameObject.transform;

// dynamically load from json string
string jsonString = @"
{
""images"" :
[
{
""image"" : ""sightplus/argame02.jpg"",
""name"" : ""argame02""
}
]
}
";
CreateTarget("argame02", out targetBehaviour);
targetBehaviour.Bind(tracker);
targetBehaviour.SetupWithJsonString(jsonString, StorageType.Assets, "argame02");
GameObject duck02_3 = Instantiate(Resources.Load("duck02")) as GameObject;
duck02_3.transform.parent = targetBehaviour.gameObject.transform;

// dynamically load all targets from json file
var targetList = ImageTargetBaseBehaviour.LoadListFromJsonFile("targets2.json", StorageType.Assets);
foreach (var target in targetList.Where(t => t.IsValid).OfType<ImageTarget>())
{
CreateTarget("argame03", out targetBehaviour);
targetBehaviour.Bind(tracker);
targetBehaviour.SetupWithTarget(target);
GameObject duck03 = Instantiate(Resources.Load("duck03")) as GameObject;
duck03.transform.parent = targetBehaviour.gameObject.transform;
}

targetBehaviour = null;
}




}
}

编辑

虽然从 .png 制作 ImageTarget 很容易,但我想知道如何检查图像是否包含足够的特征以便在 EasyAR 中检测到?

Google AR Core 支持此功能,但支持的设备数量有限

https://developers.google.com/ar/develop/java/augmented-images/guide

编辑2

看起来像Vuforia 支持在运行时创建图像目标。还可以将图像作为纹理拖放到编辑器中,而无需从门户生成数据集。尽管您仍然需要来自门户的 API key 。

关于unity-game-engine - 是否有用于在运行时创建图像目标的 AR SDK?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42584568/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com