Track a lighted ping pong ball on a stick with OpenCV utilizing the known size to determine depth.
Re-create the position information as a rendered 3D model and display it to the user in real-time.
Changing the color of the ball changes the painted color in the model.
Multiple balls could be tracked to allow creating objects such as lines or planes.
Position within the virtual world could be used to select additional features/modes/commands.
The resolution of the depth information you can get just from object size is going to drop off really quickly as you move away from the camera.
When you are relatively close to the camera, the ball will occupy a lot of pixels and the depth of the object within the frame is high resolution.
As you move away from the camera however, the number of pixels the ball is occupying in your captured image rapidly decreases.
As that happens, the possible position of the ball along a line in space drawn from the camera to the center of the ball, gets larger and larger. Eventually a single pixel error in calculating the ball size will translate to a massive positioning error along that line!
We use a larger ball.
This moves the useable range of the sensing out further at the expense of near
A larger wand is more cumbersome.
We use a camera with a narrower FOV.
This decreases the usable width and height of the performance area, but then extends the length.
The camera will need to be further away from the performance area to start with.
We use a camera with a really high resolution.
The speed of OpenCV is inversely proportional to the number of pixels you are feeding it. Bigger images are a lot slower to process.
Using the very low latency integrated CSI-2 camera interface of the PI or Jetson Nano, we end up maxing out at 8MP or about 1080P@30fps of RAW image data. To do much better than this we would need to use a USB-C camera and the cost skyrockets.
We use stereo imaging and determine the depth via triangulation.
We immediately lose half of the capture rate.
We lose the ability to track multiple objects without more work as we can't triangulate each object without being able to differentiate them.
Flashing each ball works, but then your capture rate goes down really fast as only one ball per color can be lit per captured frame and then the flashing must to be coordinated.
Using different colored balls works, but then you lose the ability to paint in the color you are seeing as the ball.
For now I think the solution I am going with is to use a narrower FOV CSI-2 camera that can do 1080P@30fps and feed it to a Jetson Nano.
Daren Schwenke11:14 AM Dropping an idea here. Light up and track a ping pong ball on a stick with a stationary camera using OpenCV using size as your depth cue. Re-create as a 3D model, displaying it with rotation around the center of it. Allow changing the color of the ball, duplicate in the model.
deʃhipu11:44 AM works best when you move towards the object at a known speed
deʃhipu11:45 AM you basically see how fast it grows -- objects that are close grow faster than object that are far
anfractuosity11:46 AM could you simply use the diameter of the ping pong ball in pixels, from a single camera, and convert that to depth, which i thought is what @Daren Schwenke meant, or are there reasons that doesn't work well compared to 2 cameras
deʃhipu11:47 AM it's easier than stereo, because instead of finding the same object on two different photos taken at slightly different angles, you just need to find the same object at two different sizes
deʃhipu11:47 AM @anfractuosity that requires pretty large resolution, though, or very consistent lighting
anfractuosity11:48 AM and knowing the size of the ping pong ball in reality too maybe?
deʃhipu11:48 AM ping pong balls have standardized size
Daren Schwenke1:07 PM The problem is with any camera held by the user, it has to be oriented towards some reference to work. That limits the size of what you can create versus a ball on a stick pretty quickly. Also with putting multiple sources or points, then you have to deal with orientation feedback or the distance between your points is no longer your relative distance to the object.
Daren Schwenke1:07 PM A bigger ball would work and give you more accuracy at a greater distance.