Skip to content

Tool not being tracked #7

@SWAGamaz

Description

@SWAGamaz

Good day!
I need your help and advice. I sort of successfully built a project on OpenCV 4.8.0 for ARM64 and I'm trying to use it in Unity, but my tool is not tracked, the resulting ToolPosition array returns 0000000.

    void Start()
    {
#if ENABLE_WINMD_SUPPORT
        tracking = new HL2ToolTracking();
        tracking.Initialize(SpatialLocator.GetDefault().CreateStationaryFrameOfReferenceAtCurrentLocation().CoordinateSystem);
        tracking.StartTracking();
#endif
    }

    void Update()
    {
#if ENABLE_WINMD_SUPPORT
        string s = "";

        if (tracking != null && tracking.ToolPosition != null)
                foreach (var e in tracking.ToolPosition)
                    s += e + " ";

        text.text = s;
#else
        text.text = "ENABLE_WINMD_SUPPORT is not";
#endif
    }

I was unable to attach infrared LEDs to the glasses in such a way as to get a good reflection from the reflective sphere. I took the opposite approach and mounted LEDs with a diffuser on the tool. From what I can tell by the image, they are very visible.

133360741556973045
WhatsApp Image 2023-07-26 at 12 11 34

It seems to me, perhaps, the problem is in the incorrect identification of the tool's points. I took the coordinates from the model in the Unity coordinate system. Should I use a different coordinate system? And how should I input the coordinates so that, for instance, ToolPosition would return the position of the tool tip?

WhatsApp Image 2023-08-09 at 16 17 18

	// definition of the model points
	cv::Mat pointsModel = (cv::Mat_<float>(4, 3) <<
		0.0f, 0.01023106f, -0.05009925f,
		0.0f, 0.0002310641f, 0.0f,
		0.03f, 0.0002310641f, 0.04990065f,
		-0.0299998f, 0.0002310641f, 0.0849006f);

I really hope for your advice!

P.S.
I'm providing a link to the compiled opencv 4.8.0 for ARM64.
I built only those modules that are required by the project's dependencies. During the compilation, following your instructions, I didn't encounter any errors. However, I'm not sure how to verify that everything is working correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions