HL2-DINO / DINO-Unity

A Unity project for the HoloLens 2 to detect and track infrared markers / tools
https://hl2-dino.github.io/DINO-Unity/
BSD 3-Clause "New" or "Revised" License
15 stars 2 forks source link

Experimental Support for Tracking Tools with Passive Spherical Markers #8

Open hiqb217 opened 2 months ago

hiqb217 commented 2 months ago

After a couple of different issues were raised about this topic, I tried to add some very quick modifications to enable support for spherical passive markers under the experimental branch of DINO-DLL.

To use the new modifications you should follow these instructions:

1) Fetch updates and rebuild DINO-DLL

## clone repo if you don't have it already
# git clone https://github.com/HL2-DINO/DINO-DLL
cd DINO-DLL
git fetch
git pull
git checkout experimental

2) Modify DinoToolsConfig.json

The only change in DINO-Unity required is to modify the .json file used to construct your Unity project. For a tracked-tool inside the tools array of the file, you can now add a new key-value pair to describe the spherical marker radius.

{
    "fileSettings": {"units" : "m"},
    "tools": 
        [
            {
                "name": "Stylus",
                "id": 8,
                "coordinates":
                [
                    ["0","0","0"],
                    ["0","0.07","0"],
                    ["0","0.13701","0"],
                    ["-0.03939","0.09175","0"],
                    ["0.04704","0.09216","0"]
                ],
                "marker_radius_m" : 0.0056
            }
        ]
}

[!IMPORTANT]
This should be the radius of the passive spheres attached to the tool, in metres.

[!TIP] A radius value of 0 should be used for flat markers. If this field is not specified for a tool in the .json file, then the code in DINO-DLL will automatically fill this field to be 0.

Rebuild DINO-Unity as instructed in the README (e.g. see instructions for the unity-21 branch).


These changes were made relatively quickly, so please do review the new code in DINO-DLL yourself.

Effectively, the main change made is that when trying to associate detected marker-blobs with tools, you iteratively try out different marker radii specified in the config.json when trying to compute pose for different tools.

It's certainly considered an experimental and slightly unstable addition, as I haven't been able to robustly test it, and the code logic could be implemented in a more elegant way, so it has not been merged with the main branch just yet. Feedback is welcome!

hiqb217 commented 2 months ago

Would strongly recommend building DINO-DLL yourself, but if you want to quickly test without carrying step 1, I've attached the rebuilt .dll and .winmd produced when building this version of the software: commit link.

HL2DinoPlugin_a8082fe.zip

Walidkilas commented 2 months ago

Thank you for your support! I really appreciate it. I tried using the rebuilt .dll and .winmd files from your zip, but unfortunately, it didn't work. I then attempted to rebuild the solution myself, but encountered a link error related to unity.obj. Do you have any idea what might be causing this specific error? I've been looking into it for hours and can't seem to figure it out.

Walidkilas commented 2 months ago

Never mind, I just figured it out! Thanks for your help!