Fast Track User Manual

Fast Track User Manual

  • Docs
  • Blog
  • Help

›Recent Posts

Recent Posts

  • Data analysis with Python
  • Introducing feature based registration
  • Introducing ECC registration

Data analysis with Python

June 21, 2019

Benjamin GalloisFast Track creator

Benjamin Gallois

Tracking data analysis with Python

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Import the data
data = pd.read_csv("tracking.txt", sep='\t')
data
xHead yHead tHead xTail yTail tTail xBody yBody tBody curvature ... headMinorAxisLength headExcentricity tailMajorAxisLength tailMinorAxisLength tailExcentricity bodyMajorAxisLength bodyMinorAxisLength bodyExcentricity imageNumber id
0 515.733 181.263 3.086240 577.710 191.101 2.801250 545.303 185.957 2.961370 2.856190e-04 ... 11.7597 0.937833 46.3947 9.54795 0.978594 74.3017 12.2626 0.986287 0 0
1 723.060 167.722 3.204620 789.967 163.884 3.232200 755.204 165.879 3.205630 6.985190e-06 ... 13.8909 0.928450 50.3148 10.80170 0.976684 80.1641 12.5170 0.987735 0 1
2 506.872 178.392 2.991110 570.443 188.991 2.945870 537.073 183.428 2.972330 6.621030e-05 ... 11.7005 0.940189 47.2875 8.63518 0.983185 76.3063 10.3726 0.990718 1 0
3 721.137 168.071 3.196860 787.819 164.195 3.233310 753.288 166.202 3.205520 2.174710e-05 ... 13.9579 0.927092 49.7841 10.92570 0.975621 79.8045 12.6034 0.987451 1 1
4 497.370 176.719 3.037370 561.544 188.657 2.922960 527.723 182.365 2.959540 9.497620e-05 ... 11.4143 0.946052 47.3322 8.87084 0.982280 77.1759 10.4940 0.990712 2 0
5 719.335 168.806 3.200110 787.030 165.102 3.232640 751.426 167.050 3.203170 1.624720e-05 ... 13.9775 0.930459 50.3214 10.79590 0.976716 80.9190 12.5916 0.987819 2 1
6 488.199 175.859 3.166540 552.167 186.385 2.792210 518.752 180.887 2.964410 3.276060e-04 ... 11.2888 0.947760 47.3813 8.83048 0.982480 76.5832 12.5715 0.986435 3 0
7 716.490 168.635 3.205070 784.479 164.950 3.228610 749.044 166.871 3.202680 2.435240e-07 ... 13.9481 0.929913 50.7467 10.77950 0.977179 81.2959 12.5451 0.988022 3 1
8 479.303 176.464 3.246790 543.014 182.569 2.770000 509.911 179.395 3.017950 4.108990e-04 ... 11.2594 0.947585 47.0452 9.34734 0.980063 75.5185 14.2036 0.982153 4 0
9 714.553 168.688 3.207410 782.450 165.205 3.220600 747.076 167.020 3.199380 6.968250e-06 ... 13.9029 0.930097 50.7319 10.75400 0.977275 81.1839 12.4982 0.988079 4 1
10 470.816 177.830 3.256630 534.262 179.498 2.859700 501.108 178.628 3.085840 3.060320e-04 ... 11.2811 0.947357 46.5185 9.75474 0.977767 75.0467 13.4640 0.983775 5 0
11 712.544 169.551 3.209890 780.033 165.988 3.210180 744.708 167.853 3.198770 2.795140e-05 ... 13.9498 0.928680 50.1132 10.76210 0.976668 80.5823 12.5187 0.987859 5 1
12 462.075 177.982 3.210970 524.995 176.503 3.030230 492.342 177.271 3.145340 1.522340e-04 ... 11.3852 0.943474 46.4387 9.21737 0.980104 74.7458 11.1467 0.988818 6 0
13 710.566 169.532 3.212240 778.705 165.782 3.196870 743.339 167.729 3.198140 7.662780e-06 ... 14.0237 0.927176 51.4117 10.77740 0.977781 81.5359 12.5464 0.988090 6 1
14 454.527 177.529 3.117440 518.244 175.685 3.184560 484.783 176.654 3.167730 2.692190e-05 ... 11.4332 0.943606 46.3523 8.62862 0.982521 75.4788 10.2507 0.990735 7 0
15 708.511 169.652 3.224300 776.925 165.645 3.192980 741.296 167.733 3.201050 2.255120e-05 ... 14.1751 0.924998 51.7071 10.77380 0.978052 81.8150 12.6499 0.987975 7 1
16 446.765 176.826 3.035510 510.228 176.705 3.267810 476.795 176.768 3.154120 2.210330e-04 ... 11.5913 0.941885 45.9396 9.08682 0.980243 74.9672 11.3943 0.988382 8 0
17 707.284 170.313 3.232620 775.659 165.836 3.189250 739.576 168.199 3.206210 2.209890e-05 ... 14.2558 0.926129 51.6447 10.80640 0.977863 81.8121 12.7489 0.987784 8 1
18 438.930 175.183 2.982220 501.979 178.293 3.267060 468.931 176.663 3.111100 2.808450e-04 ... 11.7231 0.939486 45.5004 9.85956 0.976240 74.4316 12.2700 0.986319 9 0
19 705.404 170.474 3.235600 773.505 165.561 3.194930 737.606 168.151 3.212300 6.100980e-06 ... 14.2715 0.925425 51.7379 10.91900 0.977476 81.6081 12.7985 0.987626 9 1
20 430.844 173.798 2.966070 494.005 180.243 3.181060 461.049 176.880 3.056600 1.692520e-04 ... 11.7307 0.938671 45.3372 10.05690 0.975087 74.7649 11.8061 0.987454 10 0
21 704.196 170.767 3.240200 772.502 165.411 3.198710 736.403 168.242 3.218030 1.533290e-05 ... 14.1875 0.928079 51.6464 10.99990 0.977056 81.8679 12.7882 0.987725 10 1
22 423.526 173.288 2.979760 486.552 182.139 3.082400 453.248 177.462 3.013400 9.263110e-05 ... 11.7513 0.938935 45.4363 9.56562 0.977588 74.9734 11.0003 0.989178 11 0
23 702.275 171.510 3.236640 771.070 165.691 3.205900 735.105 168.734 3.223260 4.646450e-05 ... 14.1966 0.927271 52.3333 11.08350 0.977316 82.5480 12.8005 0.987904 11 1
24 415.880 172.405 3.006000 479.105 182.258 2.999180 445.834 177.073 2.990950 2.719290e-05 ... 11.7489 0.938396 46.0038 9.14376 0.980048 75.4526 10.5744 0.990131 12 0
25 701.006 171.393 3.229500 770.307 165.274 3.219860 734.013 168.480 3.227830 4.712230e-05 ... 14.2091 0.928500 52.4505 11.12540 0.977245 83.1002 12.8105 0.988046 12 1
26 408.395 172.131 3.032990 471.336 181.781 2.956320 438.432 176.738 2.987640 9.795730e-05 ... 11.6411 0.938396 46.4035 8.83239 0.981718 75.2619 10.4622 0.990291 13 0
27 699.420 171.579 3.218510 767.696 165.178 3.258620 732.226 168.503 3.237720 1.554810e-05 ... 14.0765 0.928823 51.0941 11.20130 0.975673 81.8414 12.7806 0.987731 13 1
28 401.253 172.345 3.052990 464.223 181.177 2.947490 431.324 176.563 2.997320 1.122580e-04 ... 11.5358 0.939987 46.3455 8.69880 0.982227 75.1865 10.4483 0.990297 14 0
29 697.707 171.823 3.172960 764.838 165.609 3.327640 729.796 168.853 3.244190 4.904920e-05 ... 14.0216 0.928367 49.4355 11.10550 0.974440 80.2221 13.1277 0.986520 14 1
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
3932 335.283 180.316 2.715660 388.202 214.966 2.414630 360.420 196.775 2.550510 6.337450e-04 ... 11.5906 0.939834 46.3058 8.77106 0.981897 74.7089 11.8093 0.987428 1985 0
3933 394.976 301.583 6.194530 329.226 291.630 6.089520 364.361 296.949 6.132350 2.670470e-04 ... 13.8589 0.929420 47.6355 10.64270 0.974723 78.7811 12.6125 0.987102 1985 1
3934 330.464 179.151 2.812890 384.032 211.105 2.379830 355.909 194.330 2.584740 7.551120e-04 ... 11.5196 0.940473 45.8918 8.92140 0.980922 73.5937 13.2460 0.983669 1986 0
3935 396.513 302.636 6.234800 330.002 293.007 6.082090 366.055 298.227 6.140360 1.915540e-04 ... 14.0556 0.929286 48.3303 10.48660 0.976177 79.5540 12.8953 0.986775 1986 1
3936 325.345 178.162 2.911680 379.944 205.940 2.379210 351.228 191.331 2.644140 8.945630e-04 ... 11.4720 0.940432 45.3551 9.40605 0.978259 72.1952 14.6338 0.979241 1987 0
3937 398.181 302.993 0.038438 330.476 294.449 6.054270 367.365 299.104 6.158820 3.336390e-04 ... 14.0849 0.932195 49.2179 10.43960 0.977246 80.7163 13.6860 0.985520 1987 1
3938 320.397 176.725 2.978460 376.351 200.542 2.426700 347.042 188.068 2.706560 9.188460e-04 ... 11.5251 0.937981 45.7570 9.81352 0.976731 71.7752 15.1006 0.977618 1988 0
3939 399.421 302.130 0.209122 330.595 295.548 5.967060 368.142 299.140 6.183640 5.811520e-04 ... 14.2348 0.933444 50.8658 10.40700 0.978846 81.5734 16.7422 0.978711 1988 1
3940 316.389 176.074 3.004170 373.688 196.695 2.518860 343.528 185.841 2.768490 1.011480e-03 ... 11.5342 0.937912 44.9382 9.60294 0.976901 71.7674 14.1244 0.980442 1989 0
3941 399.820 301.289 0.408695 332.663 298.886 5.873540 369.450 300.203 6.237110 8.550340e-04 ... 14.7808 0.929795 49.3442 11.06740 0.974522 78.6003 21.3182 0.962517 1989 1
3942 311.530 174.877 3.001360 370.341 193.163 2.644630 339.562 183.592 2.820350 6.696100e-04 ... 11.6784 0.934893 45.4299 9.05418 0.979938 72.7201 12.4968 0.985124 1990 0
3943 399.724 300.299 0.612728 337.186 303.733 5.823860 371.055 301.873 0.035277 1.223190e-03 ... 15.2133 0.920793 47.1540 12.50910 0.964171 72.9083 24.8927 0.939909 1990 1
3944 307.774 172.894 2.971870 367.640 190.288 2.753030 336.038 181.106 2.850740 5.464520e-04 ... 11.7160 0.935753 45.7178 8.58850 0.982196 73.6641 11.1096 0.988562 1991 0
3945 398.861 298.564 0.843415 342.340 308.412 5.827180 372.901 303.087 0.151702 1.290550e-03 ... 15.7599 0.907301 43.9085 13.61200 0.950734 66.3142 27.1205 0.912548 1991 1
3946 303.607 170.909 2.936680 363.944 188.312 2.833750 332.016 179.104 2.863280 1.837350e-04 ... 11.8579 0.934337 45.4529 8.59749 0.981948 74.0579 10.5886 0.989726 1992 0
3947 397.650 296.922 1.105200 347.999 313.208 5.862700 374.401 304.549 0.301045 1.562380e-03 ... 15.7955 0.899374 39.9462 14.17090 0.934961 59.8562 28.3366 0.880842 1992 1
3948 299.503 169.149 2.919350 359.514 187.340 2.869500 327.905 177.760 2.857870 1.471470e-04 ... 11.9825 0.932247 45.3360 9.11574 0.979577 73.9414 10.8052 0.989265 1993 0
3949 396.630 294.282 1.406020 354.090 317.389 5.912710 376.726 305.088 0.480504 2.212570e-03 ... 15.4633 0.900596 38.7062 13.96230 0.932672 54.8942 30.2026 0.835035 1993 1
3950 295.672 166.866 2.924090 355.461 186.490 2.845400 323.956 176.149 2.837360 8.459970e-05 ... 12.1011 0.930915 45.1896 9.65435 0.976912 74.0821 11.1834 0.988540 1994 0
3951 395.121 289.725 1.686810 360.472 319.689 5.987910 378.937 303.725 0.690952 3.047780e-03 ... 15.1822 0.901527 39.1493 13.62470 0.937487 51.4366 31.9911 0.783056 1994 1
3952 291.730 165.019 2.968830 350.406 185.700 2.742660 319.494 174.805 2.807710 4.740270e-04 ... 11.8833 0.932809 45.1473 9.35517 0.978296 73.3453 11.4833 0.987668 1995 0
3953 392.913 283.415 1.951360 368.674 321.202 6.192020 380.881 302.167 0.957530 2.706370e-03 ... 14.5722 0.896876 39.6227 15.14930 0.924022 50.2804 32.1367 0.769083 1995 1
3954 287.949 164.630 3.047960 346.232 184.500 2.632220 315.273 173.946 2.802630 7.617400e-04 ... 11.8078 0.933531 45.7050 8.65644 0.981900 72.6217 12.8722 0.984166 1996 0
3955 375.403 322.731 3.308520 390.305 278.967 5.207610 382.897 300.726 4.358780 1.687060e-03 ... 16.2064 0.904654 31.9481 14.87900 0.884929 51.9439 30.1970 0.813661 1996 1
3956 284.421 164.893 3.154300 343.245 182.238 2.567020 312.084 173.049 2.833330 1.059890e-03 ... 11.8434 0.935724 45.4689 9.03358 0.980065 72.0973 15.1811 0.977580 1997 0
3957 381.046 322.590 3.605810 388.490 274.752 5.235390 384.789 298.549 4.530790 1.740410e-03 ... 17.1656 0.884005 31.3969 15.07070 0.877266 54.8958 27.4961 0.865518 1997 1
3958 280.348 165.446 3.250850 339.325 178.337 2.558270 308.209 171.536 2.895280 1.055620e-03 ... 11.6211 0.938436 44.9839 9.66435 0.976649 70.8427 16.7815 0.971538 1998 0
3959 387.121 270.479 2.063460 385.267 321.570 0.784702 386.213 295.501 1.509900 1.859580e-03 ... 14.9335 0.880002 35.7334 17.11040 0.877905 58.4820 24.0425 0.911586 1998 1
3960 275.471 166.260 3.302780 334.374 173.655 2.634210 303.470 169.774 2.977500 1.136060e-03 ... 11.5223 0.936586 44.9439 10.27380 0.973522 69.8733 16.6869 0.971065 1999 0
3961 386.293 266.329 2.035440 388.680 319.711 1.080720 387.454 292.276 1.588310 1.645940e-03 ... 14.8242 0.880714 36.9575 15.92380 0.902415 61.7829 20.9365 0.940832 1999 1

3962 rows × 23 columns

# Count the number of detected object
objectNumber = np.max(data["id"]) + 1
objectNumber
2
# Count the number of image
imageNumber = np.max(data["imageNumber"]) + 1
imageNumber
2000
# Plot the number of objects detected by frame
objectByFrame = np.zeros(imageNumber)
for i in range(imageNumber):
    objectByFrame[i] = data[data["imageNumber"] == i].shape[0]
    
plt.scatter(range(imageNumber), objectByFrame)
<matplotlib.collections.PathCollection at 0x7fa41831c6d8>

png

# Plot the trajectory of the first object and its orientation
dataObject0 = data[data["id"] == 0]
distance = np.sqrt(np.diff(dataObject0["xBody"].values)**2 + np.diff(dataObject0["yBody"].values)**2)
framerate = 50
time = np.diff(dataObject0["imageNumber"].values)/framerate
velocity = distance/time

fig, ax = plt.subplots(1, 2)
fig.subplots_adjust(right = 2)

ax[0] = plt.subplot(121)
plot = ax[0].scatter(dataObject0["xBody"][0:-1], dataObject0["yBody"][0:-1], c = velocity, s = 1)
ax[0].set_xlabel("x-position")
ax[0].set_ylabel("y-position")
bar = fig.colorbar(plot)
bar.set_label("Velocity")

ax[1] = plt.subplot(122, projection='polar')
ax[1].scatter(range(dataObject0["tBody"].shape[0]), dataObject0["tBody"], s = 0.4)
ax[1].set_title("Object direction")

Text(0.5, 1.05, 'Object direction')

png


Introducing feature based registration

May 15, 2019

Benjamin GalloisFast Track creator

Benjamin Gallois

Fast Track is now integration feature-based registration alongside the other registration methods. Feature-based registration consists of finding stable points in an image, these points are called key points and their descriptors. Then the same key points are found in the second image. From these key points, a homography is computed between the two images and the transformation is applied to all the pixels of the image to register.

Feature automatic detection

Fast Track used an automatic algorithm to find the key points and the descriptors (~500) in the two images. This algorithm is called ORB feature detector and was brought up by Ethan Rublee, Vincent Rabaud, Kurt Konolige and Gary R. Bradski in 2011.

Feature matching

The key points are matched pairwise between the two images using the Hamming distance. The Hamming distance measures the minimum number of errors that could transform one feature descriptor in another one.

Compute the homography

The homography is computed between the matching key points. It is possible that more than 30% of the features matched are incorrect. To reduce errors when finding the homography, Fast Track used Random Sample Consensus RANSAC estimation technic brought up by Fischler and Bolles in 1981.

This new registration method will be available in the 4.8 Fast Track release. It can be tested in the nightly build and on the dev branch on GitLab.

Introducing ECC registration

May 9, 2019

Benjamin GalloisFast Track creator

Benjamin Gallois

Fast Track is now integrating a new method of registration: the so-called ECC registration. This method was developed by Georgios D. Evangelidis and Emmanouil Z. Psarakis. It consists of maximizing the Enhanced Correlation Coefficient function to find the parameters that described the best transformation between the two images. This is done by solving iteratively a sequence of nonlinear optimization problems.

This method has several advantages:

  • Invariant with respect to photometric distortion, ie, in contrast, and brightness changes.
  • The optimization problem solution is linear, ie, the computing time is acceptable.
  • This method performs well in noisy conditions.

For the moment, only one mode of registration is integrated into Fast Track. The euclidian mode can correct the translation and rotation of the image. For example, this mode can correct small camera vibrations.

Currently in testing, this registration mode will be available in the 4.8.0 version. You can test this feature in the nightly release or in the dev branch on the GitLab.

Fast Track User Manual
Community
User ShowcaseAssistance
More
Gitlab
Copyright © 2019 Benjamin Gallois