我在看Android的新ARCore库。它有一种检测水平表面的方法,但没有检测垂直表面或墙壁的方法。
我实际上是想让示例应用程序检测墙,但我遇到了很多问题。
在ARCore中有没有一种本机或非本机检测垂直表面的方法?
发布于 2017-10-12 16:11:17
更新
最新版本的ARCore now also has
public static final Config.PlaneFindingMode HORIZONTAL
// Detection of only horizontal planes is enabled.
public static final Config.PlaneFindingMode HORIZONTAL_AND_VERTICAL
// Detection of both horizontal and vertical planes is enabled.旧答案
public static final Config.PlaneFindingMode DISABLED
// Plane detection is disabled.
public static final Config.PlaneFindingMode HORIZONTAL
// Detection of only horizontal planes is enabled.一种非原生方法是sketched here:访问点云数据并自己计算水平平面。但要让它真正工作,你必须实现集群(区分多个平面,而不是计算一个全局平面)和适当的异常值拒绝(可能使用RANSAC)。
就我个人而言,我认为(希望)下一次ARCore更新将包括垂直平面,因为我看不到不支持这一点的数学原因。
发布于 2019-04-23 21:16:59
获取hellosceneform样本并将其转换为检测垂直和水平平面:
https://github.com/google-ar/sceneform-android-sdk/tree/master/samples/hellosceneform
创建一个新的片段子类化ArFragment并覆盖getSessionConfiguration方法:
public class CustomArFrag extends ArFragment {
@Override
protected Config getSessionConfiguration(Session session) {
Config config = super.getSessionConfiguration(session);
config.setPlaneFindingMode(Config.PlaneFindingMode.HORIZONTAL_AND_VERTICAL);
return config;
}
}更改activity_ux.xml布局以指向它:
<fragment
android:name="com.google.ar.sceneform.samples.hellosceneform.CustomArFrag"
.../>请注意,垂直表面并不总是被检测到。它似乎不喜欢白色的大墙。它设法探测到了我冰箱的正面,我把一个机器人像磁铁一样贴在上面!
发布于 2019-04-17 23:54:15
ARCore 1.2为AR开发人员带来了三个新特性:Vertical Plane Detection、Cloud Anchors和Augmented Images。
列表中的第一个特性向Config.PlaneFindingMode添加了两个额外的枚举值
public static final Config.PlaneFindingMode HORIZONTAL_AND_VERTICAL
public static final Config.PlaneFindingMode VERTICAL让我们看看使用Kotlin会是什么样子:
class CustomArFragment: ArFragment () {
override fun getSessionConfiguration(session: Session?): Config {
val configuration = super.getSessionConfiguration(session)
configuration.planeFindingMode = Config.PlaneFindingMode.VERTICAL
return configuration
}
}https://stackoverflow.com/questions/46675370
复制相似问题