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
223 stars 61 forks source link

Fixed anchor placement when there are no planes in the scene #8

Closed ROBYER1 closed 3 years ago

ROBYER1 commented 3 years ago

This is my first ever public PR using Github so go easy on me Deren! Spent a while investigating this today and realised that the Anchor Creator wasn't raycasting to feature points which was causing problems if there wasn't a plane in the area near the object.

This push didn't fix the android issue with the location of the Anchor labels but this push does! https://github.com/derenlei/Unity_Detection2AR/commit/59547cdafb1a7ab3c3985f5db11f0c08d27b963e

-AnchorCreator.cs now raycasts to feature points and planes, in the case the user is holding the detected object or if it is nowhere near any planes -Added some optional debug lines in the AnchoCreator.cs script for identifying when and when the script didn't raycast -Added optional Debug Point Cloud Prefab, can be turned on in the AR Session gameobject in Detect scene

derenlei commented 3 years ago

Thanks @ROBYER1 ! The Debug Point Cloud Prefab is very useful.