Child pages
  • z_*OBSOLETE* XROMM Video Tutorials
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Current »


Marker Tracking i.e. Digitizing

Below is a video tutorial which covers the process of digitizing a set of markers using the MATLAB program.

If you are having trouble viewing the video, here is the link to directly to the video on youtube. You can also try switching internet browsers (safari generally works well), or installing FlashPlayer.

A transcript of the video is also below.

 Click here to view a transcript of the video.

This video will cover how to track your X-ray markers. This process, which is often called digitizing, produces xyz coordinates for each of your markers as they move over time. I’ll be using an example shark data set. If you would like to follow along, all of the files are available at XMA for you to download. Go All Studies, and search for Tutorial Data. Click on this, and then select Trial01. Click on each of the files in the XMovie category, and download them by clicking Original File. This could take a few minutes, because the files will be large.

If you have not completed the undistortion and calibration steps for this data set, select Processed Data, and then download the Grid After Cam1 and cam2 UNDSTFORM files, as well as the MergedProjectionMatrixDLT file.

I am going to start by opening MATLAB. If you don’t have matlab or the XrayProject package, you need to download and install those first. I’m going to type DLTdv3Brown into the command line and press enter. This opens the control window we’ll be using to digitize. Most of the buttons are greyed out right now because we haven’t loaded our data yet. 

Click Initialize, and then pick how many videos you have. My data set has two, as will most XROMM data sets, so I’m going to select “2” and then press OK.  A window will pop up asking you to select the Camera1 UNDSTFORM file. This file will tell the program how to undistort the xy coordinates for each camera. I have all of my files saved in this one folder, but if you are having trouble finding the file, an easy way is to search for .mat.

Select the file and press Open. Do the same thing for the Camera2 UNDTFORM file. Now the program has asked me for movie file one, so I’m going to select the cam1 avi file, and I’ll do the same for the cam2 avi file.

The program will ask if I want to use DLT. The answer is almost always Yes. The DLT file contains information about how the cameras were positioned when the X-rays were recorded, so MATLAB needs it to calculate 3D coordinates from the 2D X-ray videos. It’s best to choose the file where your cube was oriented similar to how you want your final Maya scene to be oriented.

I’m going to chose Frame1, because that is the coordinate system I want for my eventual Maya animation. With this cube orientation, Z will be up, X will be in the rostral direction of my animal, and Y will be in the mediolateral direction.

Now my digitizer is set up. I’m going to drag on the corner of this window to increase the size of the X-ray videos and make the markers easier to see. 

You can see how many frames are in your video by looking here. You should go through the video to pick the segment to want to digitize. Normally this segment would be whatever action you want to digitize, plus 10 or 15 frames of buffer at either end. In this case, I’ll be digitizing from frame 148 to the end.

Before doing anything else, I want to save my data. Click Save Data, and enter the prefix you want to use for the files. I’ll name mine Trial01_BambooShark_

I’m going to quickly cover a few shortcuts that will make digitizing much easier. If I select the viewer window, and then hover the mouse over anywhere in either viewer, pressing the = and - keys will make the video zoom in and out, centered around the cursor. Pressing r will return the video to a full view.  If I press f, the video will move one frame forwards, and if I press b it will move one frame backwards. Holding shift + f or b will make the movie jump 50 frames forwards or backwards. You can find a longer list of shortcuts on the XROMM wiki. 

I’m going to start by making a list of all of the names of my 8 markers, and numbering each one. Then I’m going to identify as many of the markers as I can in both viewers. The program can help a little with this. If you click on a marker in one view, a blue line should appear in the other view. The program believes that the marker should be somewhere on this line. 

Now that I have a rough idea of which markers are which, and I’m going to start tracking my first marker. There are several ways to do this, so I’m going to show you a few of the most useful methods. The first method is automatic tracking forwards. You can see here it says the current point is one. It also tells me that I’m on frame 148, which is where I’m going to start. I’m going to switch the auto track mode to automatic, and then click on this point, which is point one. You can see the frame number changed to 149, but then it stopped. I’m going to increase the auto track search area size to 15, and the threshold to 5. This will make it easier for the automatic tracking to work. I’ve clicked on the point again, and you can see the program is now automatically tracking the marker, without me having to do anything.

Now that it has reached the end, I’m going to show you reverse auto tracking on point 1 in the other view. This time I’ll choose reverse automatic as the auto track mode and then click on point one in the viewer. Now I’m going to start tracking another point by clicking here to Add a point. You can see it now says my current point is 2.

Remember to always save your data. If you want to just replace it, you can simply save it with the same name, and it will save over your previous file. Otherwise you can save a new version by typing in a different name.

I’m going to track the next three points using a method called multi. This will allow me to track points 2, 3, and 4 all at the same time. I have point two selected, so I’m going to click point 2 in the viewer. Then I’m going to add a point, and click on point 3 in the viewer. I’ll do the same for point 4. Now that I’ve selected all of the points, I’m going to hold shift, and middle click with my mouse to start the tracking. This method is generally best to use when the points seem like they’ll be easy to track and it’s less like that the tracking will stop.

I’m now going to track point 5. I’m going to use automatic tracking again, but this point might be a little challenging, because it’s very close to point 6. The tracking worked for a little while, but the points are now very close together, and it’s starting to have trouble. It started tracking again, but I’m actually going to press x to stop the tracking, because you can see that the program is tracking in the middle of the two points, rather than in the center of point 5. This is because the program can no longer tell that they’re two separate points. I’m going to uncheck find marker centroid, so the program doesn’t correct my click to be in the middle of the two points, and then I’ll manually track the point. I’ll do this by clicking in the center of the point, and then pressing f to advance to the next frame. The points have now moved farther apart, so I’m going to automatically track the remaining frames.

I’ve now finished tracking all of my markers, but I’m going to go back and tweak a few things. I ended up tracking point 6 automatically, which was easier, but means that some of the points are probably a little bit off. You can see in this frame that the program was tracking somewhere in the middle of points 5 and 6, rather than at the center of point 6. To fix this, I’m going to hover my mouse over the view I want to correct and press m. you can see in this zoomed view, that the red crosshairs have moved down. Use i, m, j, and k, to move the points up, down, left, and right. Now if I press f, the video will move forward one frame and I can keep correcting the tracking.

So I’ve finished tracking my points, and I’m going to save my data one more time.

If you want to check the error of your data or filter your data, there are instructions for how to do that on the XROMM wiki. There are also more detailed explanations of some of what I covered in the video, including the other auto tracking modes.

Thanks for watching, hope that was helpful.

  • No labels