Author Topic: Motion metrics only from IR  (Read 5488 times)

Offline milki

  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
on: April 04, 2009, 07:43:09 PM
I'm trying to use the wiimote to look at a moving surface with IR sources floating along the surface. Has anyone been able to figure out how to determine the velocity of each IR point?
This is difficult because the wiimote may not be able to distinguish between which IR sources are which, IR sources may only be in the field of vision for a short period of time, getting accurate time with a position for a point is dependent on the event handling code, and the code needs to calibrate the scale depending on where the wiimote is located.
The general goal of this is to determine the overall velocity of the entire surface, which will most likely involve divergence calculations of the values we get from the individual points.



Offline benpaddlejones

  • Support Admin
  • *
  • Posts: 1178
  • Karma: +49/-0
    • View Profile
    • Inter.Connect.Ed
Reply #1 on: April 05, 2009, 12:02:04 AM
milki
You will need a parrallel calibration between the 2D surface and the IR-Camera. Then it is simply maths to calculate velocity:
V= x/T
    V= Velocity
    x = displacement
               x pixels moved on the ir-camera = x distance on the surface
    T = Time
               time = 'IR stop detected' - 'IR start detected'

benpaddlejones :)


See my full profile and links on my Google Profile: http://www.google.com/profiles/benpaddlejones


Offline milki

  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Reply #2 on: April 05, 2009, 12:52:16 AM
While that may work for a discrete point that is decently stable, this will not work for the dynamics of the setup.

Points will be flickering in and out of view as they either cross the view or are superceded by another tracked point. Also, I'm getting possibly tens to hundreds of point values from the wii. Keeping track of all of them and getting a decent value that is probably averaged is difficult.



Offline Raptor007

  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Reply #3 on: April 07, 2009, 03:38:04 PM
Thanks for an interesting problem to pass the time at work  :)

So assuming:
    -- There are more than 4 points of moving IR lights on your surface.
    -- Your surface remains in the same place relative to the wiimote, while the IR lights on the surface move.
    -- You know the size of the surface

You could find the scale by setting an array to be filled with the max and min values of the X and Y coord of the wiimotes IR location. After some runtime of the wiimote picking up random IR dots, the max and min values could be turned into to (x,y) points with which a square could be made and then compared to the size of the surface.

____For the tracking problem, I am trying something on another project that might help you._____

This is what I am trying to do.

Record a (x,y) coord of an IR point into an array. If another coord point is detected in square radius size (5-10 pixels) (within a set time, 100ms) set a flag that this is a tracked IR point.

Knowing two points you find a "guessed point" (simple delta X/Y) of where the third point will appear. If then within a set time (100 ms) and set square radius ( 5 - 10 pixels) another point appears add it to the array.

For your project you would then accumulate many arrays of points. Once an array hits a certain minimum size, take the distance traveled over the time since the array was made and you have a velocity. Take a moving average of all these velocities from all the arrays and you have your speed.














Offline milki

  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Reply #4 on: April 08, 2009, 03:45:51 AM
Hm.

The assumptions are slightly off. The surface as you know it does remain in the same place for development purposes at least. In production, it can actually move closer or farther away from the wii which adds more fun to the problem. And the moving IR lights represent the movement of the surface. Think of water and floating bobs.

Scaling will actually be more difficult than proposed because I expect I won't be able to know the exact distance to the surface without another tool besides the wii. But if we ignore that, the size of the surface will fill the entire view of the wii because it is considerably larger than the viewport. With a known distance, I believe we can calculate the size of the view.

For tracking, I believe instead of determine which points are which, we should be able to use the wii's internal tracking and still get the same accumulation of arrays. If I ignore the arrays that are under a minimum size like you said, I will probably get less noise in the system. Since I don't expect the velocity of the general surface to change dramatically, this method seems to be an approach that would work.
A particular problem I have with the wiimotelib however is that it is event based (at least in fingertracking which is all I've looked at so far). Thus, I cannot actually control when I get data from the wiimote.



Offline Raptor007

  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Reply #5 on: April 08, 2009, 01:33:00 PM
Oh, I see. I misread part of it.

For scaling, I would think you would have to know either the distance to the surface or a constant spacing between the IR dots (or some way to get back to those two variables). Even an average distance between the IR points could possibly work.


For tracking it comes down to how the Wiimote handles more than 4 points of IR light, which I don't really know.

   -- The wiimote runs at 100Hz (so if tracking IR dots thats 100 events per second right?)
   -- I think that the wiimote picks the 4 "brightest" IR points to track, then sends that data out

So my guess would be the wiimote calculates the 4 "brightest" points each cycle, so 100 times a second (that is a rather large guess).

For your application the brightness of the lights would change constantly, so each second the wiimote may send (x,y) point info for maybe 20 "true" IR points but of coarse would send the (x,y) points as locations of one of its 4 "points."

So i figured recording all the data sent by the wiimote, you could process it to get the movement of the true IR points, not the jumbled data that the wiimote may send.

This is all based on some guessing though, so it may be wrong.

There is another post on wiimoteproject about using the Hz of the LEDs to track more than 4 points, but it seemed to be ineffective.

I only have one IR point working now, but when my reflective tape arrives, I can make more and might test out the effect of many points.