首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ARCore检测墙

ARCore检测墙
EN

Stack Overflow用户
提问于 2017-10-11 04:23:59
回答 3查看 6K关注 0票数 3

我在看Android的新ARCore库。它有一种检测水平表面的方法,但没有检测垂直表面或墙壁的方法。

我实际上是想让示例应用程序检测墙,但我遇到了很多问题。

在ARCore中有没有一种本机或非本机检测垂直表面的方法?

EN

回答 3

Stack Overflow用户

发布于 2017-10-12 16:11:17

更新

最新版本的ARCore now also has

代码语言:javascript
复制
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.

旧答案

目前有no native way

代码语言:javascript
复制
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更新将包括垂直平面,因为我看不到不支持这一点的数学原因。

票数 8
EN

Stack Overflow用户

发布于 2019-04-23 21:16:59

获取hellosceneform样本并将其转换为检测垂直和水平平面:

https://github.com/google-ar/sceneform-android-sdk/tree/master/samples/hellosceneform

创建一个新的片段子类化ArFragment并覆盖getSessionConfiguration方法:

代码语言:javascript
复制
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布局以指向它:

代码语言:javascript
复制
  <fragment 
    android:name="com.google.ar.sceneform.samples.hellosceneform.CustomArFrag"
  .../>

请注意,垂直表面并不总是被检测到。它似乎不喜欢白色的大墙。它设法探测到了我冰箱的正面,我把一个机器人像磁铁一样贴在上面!

票数 3
EN

Stack Overflow用户

发布于 2019-04-17 23:54:15

ARCore 1.2为AR开发人员带来了三个新特性:Vertical Plane DetectionCloud AnchorsAugmented Images

列表中的第一个特性向Config.PlaneFindingMode添加了两个额外的枚举值

代码语言:javascript
复制
public static final Config.PlaneFindingMode HORIZONTAL_AND_VERTICAL

public static final Config.PlaneFindingMode VERTICAL

让我们看看使用Kotlin会是什么样子:

代码语言:javascript
复制
class CustomArFragment: ArFragment () {

    override fun getSessionConfiguration(session: Session?): Config {
        val configuration = super.getSessionConfiguration(session)
        configuration.planeFindingMode = Config.PlaneFindingMode.VERTICAL 
        return configuration
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46675370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档