Video tracking & Live 3D drawing

Hi there! Does anyone know how to track an element in a video?

We are currently doing live video light painting using the feedback effect, but we want to explore new effects, especially by tracking the position and orientation of our physical LED paintbrush. We have achieved a good first result with blob tracking, but it only works on the X and Y axes. Our brush is an LED bar, and we want to track its orientation more precisely, beyond just estimating the vector direction. We also have a TouchDesigner license, which would allow us to delegate the tracking and sending of position data to Notch, if that’s the only viable option. We’re open to any advice or suggestions!

Video of our tests :

Also, we want to know if it’s possible to draw a 3D mesh shape. We are currently using particles with our live video feed, but is it possible to create a nice 3D mesh of our drawing path?

Here is a sample of our raw input video feed:

Thanks!