Resources

MouseChaser Program- Automated mouse tracking

Behavior was quantified from videos using custom software written in C++ that analyzed each video frame, extracted the position of the mouse and saved it to a log file. The method for tracking the mouse in the video was similar in spirit to the feature-space based mean-shift algorithm with color histogram as feature (Comaniciu et al 2000).  However, since the video is taken in an indoor environment with similar lighting conditions this simplified the task of tracking in feature space thus eliminating the need for more robust density estimation based approaches (Yilmaz et al 2006).

The initial position of the mouse on the first video frame was specified manually by entering the x and y position of the top-left vertex of a square defining a 50 x 50 pixel patch on the mouse body as shown in figure 1. The red, green and blue values of each of the 50x50 pixels in the patch are computed. Each of the red, green and blue channel pixels are averaged and this produces a signature color based feature based on which subsequent tracking is performed. On each subsequent frame of the video, 50x50 patches around the starting position are analyzed and a Euclidean distance measure in feature is space is computed between each candidate patch (cp) and the target patch (tp) defined in the first frame as follows:

 

Where rtp and rcp are the mean red pixel values for tp and cp respectively and similarly ‘g’ and ‘b’ are the mean values for the green and blue channels respectively.  On each iteration, 8 nearby patches are analyzed and the cp with the smallest ‘d’ measure is chosen as the next location of the center of the mouse. The software recorded the x and y position of the position at each frame thus recording 30 samples per second of data. Further, the software generated an annotated video marking the position of the mouse (Figure 2).  When tested on the same videos, the software provided comparable results to human observers who measured the time the mouse spent on each plate using a timer.

The log file stored by the program contains x and y locations of the mouse over the period of the experiment, which can be plotted as a two dimensional histogram. The two dimensional space of the image is binned into 5 pixel wide bins and each time the mouse center is estimated to be at a particular x, y location the corresponding bin is incremented. The resulting x,y matrices were normalized to the number of mice in the data set and the resulting data graphed as heatmaps to visualize the evolution of plate positioning over genotype and temperature.

D. Comaniciu, V. Ramesh, and P. Meer, “Real-time tracking of non-rigid objects using mean shift,” in Proceedings of 2000 IEEE Conference on Computer Vision and Pattern Recognition, Hilton Head, SC, volume II, June 2000, pp. 142–149.

A. Yilmaz, O. Javed, and M. Shah, “Object Tracking: A Survey,” ACM Computing Surveys, vol. 38, no. 4, 2006.

Two-temperature_choice_assay.pptx

Figure 1

Left shows the first frame from a video of the mouse with the yellow square defining the patch on the mouse body. Right shows the plots of the varying pixel intensities for each of the red, green and blue channels. The x and y axes represent location in the 50x50 pixel patch while the height shows the intensity in the particular channel.

Figure 2

Screen capture from software after annotation of video with position of mouse. The red square is an estimate of the mouse's position with the yellow diamond marking the center, the x and y coordinates of which are logged over the course of the video.

  • McKemy Lab
  • 3641 Watt Way
  • HNB 201
  • Los Angeles, CA 90089
  • For information contact us at: