[英]Detecting vertical planes in ARCore
我想知道是否有人使用ARCore SDK實時識別了設備之前的垂直平面。
通過使用線方程定義牆,我獲得了不錯的結果:
z = Multiplier * x + Constant (For every y)
用“對於每個y”的注釋,我的意思是我忽略y軸(如在房間的2d映射中從上方看牆壁),以便計算定義牆壁的線。
乘數是兩點之間的旋轉:
let angleDeg = Float((360 - angle + 360) % 360) * Float.pi / 180.0;
全部計算為:
let angle: Int = Int((atan2(pointA.z - pointB.z, pointA.x - pointB.x) * 180) / Float.pi) % 360
yRotation = Float((360 - angle + 360) % 360) * Float.pi / 180.0
if pointA.x == pointB.x {
multiplier = Float.infinity
} else {
multiplier = (pointA.z - pointB.z) / (pointA.x - pointB.x)
}
constant = pointA.z - multiplier * pointA.x
}
現在,我在用戶四處走動並采樣許多點雲點時觸發該計算。
結果很好,但不如ARCore的水平面檢測准確。
您可以在官方的Google AR Core github回購https://github.com/google-ar/arcore-unity-sdk/issues/31上參考此問題。 如問題中所述,此功能已在ARCore SDK for unity(v1.2.0) SDK鏈接中發布。 希望這可以幫助 :)
現在是ARCore的一部分,發布於1.2.0版,適用於Android
自ARCore 1.2發布以來,我們可以使用Config.PlaneFindingMode
枚舉的四個值。
代碼如下所示:
public static final Config.PlaneFindingMode DISABLED
// Plane detection is disabled.
public static final Config.PlaneFindingMode HORIZONTAL
// Detection of only horizontal planes is enabled.
public static final Config.PlaneFindingMode VERTICAL
// Detection of only vertical planes is enabled.
public static final Config.PlaneFindingMode HORIZONTAL_AND_VERTICAL
// Detection of both horizontal and vertical planes is enabled.
希望這可以幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.