derenlei / Unity_Detection2AR

Localize 2D image object detection in 3D Scene with Yolo in Unity Barracuda and ARFoundation.
https://derenlei.medium.com/object-detection-with-localization-using-unity-barracuda-and-arfoundation-794b4eff02f8
MIT License
218 stars 61 forks source link

Android: Anchor is always offset quite far from detected object #7

Closed ROBYER1 closed 3 years ago

ROBYER1 commented 3 years ago

I know you mentioned you would look into fixing this already, just recording it here

On Android with ARCore (using Sony Xperia XZ3 for my tests), the anchors placed on detection are always at least 30cm out from the detected object when the anchor is placed. This behaviour is consistent on android in my tests with different dishes. Screenshot_20201202-231240 Screenshot_20201202-170552

derenlei commented 3 years ago

Hi,

I have pushed a simple fix here 59547cdafb1a7ab3c3985f5db11f0c08d27b963e.

Roughly scan the surrounding area before placing the anchor will help improve localization. In addition to that, iOS usually performs better than android.

Hope it helps.

ROBYER1 commented 3 years ago

Hi Deren

Those are good tips, your latest fix push didn't do it but I found the Anchor script was only looking for planes, the reason the markers weren't spot on was because it was raycasting only to planes, not feature points https://github.com/derenlei/Unity_Detection2AR/pull/8