flyWalk is a MATLAB class based on movieAnalyser that tracks flies in videos.
% Create a flyWalk object, open the movie and display the gui
fileName = 'my_movie.mat';
gui_on = 1;
f = openFileFlyWalk(fileName,gui_on);You can now watch the tracking in real time using the Play button.
For programmatic access to flyWalk, see the Methods section below.
flyWalk accepts videos in .mat format. It can run on .avi files with a few changes in the code.
In order to convert .avi files to .mat files use Vid2Mat function. flyWalk requires the user to define the location of the source and camera, the pixel to mm conversion factor, borders for exclusion etc. HandleFlyWalkVideo function can be used for this purpose.
flyWalk inherits methods from movieAnalyser and from handle.
In addition, the following functions operate on flyWalk objects and are used for tracking, etc.:
assignObjectsToTheseFliesmatches objects in current frame to specified flies. Look at the section on the algorithm to see how this matching is done efficientlyfindAllObjectsInFramefinds objects in frame usingregionpropsfindSuspectedMergedObjectsfinds objects that are suspiciously large compared to the previous frame. these are probably the result of flies touching/colliding.initTrackingInfoinitialises some tracking infomapObjectsOntoFlieswrapper function that co-ordinates mapping from objects to fliesmarkFlyMissingmarks a given fly as missing in this framemaskVideomasks each frame of the video using a mask generated byannotateVideoresolveCollidingObjectswrapper forsplitObjectthat separates objects based onfindSuspectedMergedObjectsseperateTouchingObjectswrapper forsplitObjectthat separates objects in the 1st framesplitObjectsplits a object into two using k-meanswipeAllTrackingInfoAfterCurrentFramedebugging tool; wipes tracking info after current frame
- show_live: {true,false} show tracking live as it happens.
- fly_body_threshold: scalar, image thresholded with this
- min_fly_area: scalar, objects smaller than this are ignored
- use_gpu: {true, false} See section on GPU support
- area_ratio_to_resolve: used by
findSuspectedMergedObjects. ratio of area of object in current frame to area of fly in previous frame. - perimeter_ratio_to_resolve: this is used only in the first frame, to seperate touching flies based on the perimeter of each object.
- maximum_distance_to_link_trajectories
- start_frame: scalar. where do you want to start tracking from?
- ft_debug: {true, false} show debug messages?
- current_raw_frame: contains the raw frame that is currently being worked on
- current_objects: list of objects in current frame
- current_object_status
- tracking_info: structure with all tracking info
- mask: logical, same size as
current_raw_frame - handles: handles to all GUI objects. inherited from
movieAnalyser - path_name: path name to movie. inherited from
movieAnalyser - current_frame: scalar, index of where we are in the movie
- nframes: scalar, automatically set to the number of frames in the movie
Principally, the goal of flyWalk is total data capture. So for every fly, for every frame, you want to have all relevant tracking information.
flyWalk stores data in a structure called tracking_info, which has various fields, let's say, called A, B, etc. Each of those fields is a matrix, where each row corresponds to the frame #, and each column corresponds to a fly #.
