Post Image
By Matt GaidicaNovember 19, 2017In Uncategorized

Creating an Actogram from Video in MATLAB

An actogram is a way of quantifying movement, useful in behavioral studies in order to understand how an animal moves over the duration of an experiment. An actogram is usually based on movement sensors (e.g., IR beams), but because video is often being recorded anyways, it’s a natural method of extracting movement information. The method I present here produces actogram data based on the changes in pixel values from frame-to-frame:

frameData = videoActogram(videoFile,frameInterval,resizePx);

For large videos you may also use a frameInterval to skip frames between each data point. The result is a frameData array consisting of frame number, frame timestamp, and movement data. More details are included within the file comments.

Find these functions on Github: MoveAlgorithms

Example

Exporting your original video to a smaller size will speed processing. This sample video of my hand is 15 seconds, taken with an iPhone, then exported as 540p with no audio. It takes about 10 seconds to get the actogram data using every frame.

Using the test_videoActogram.m function you can easily plot the actogram data:

MGhand_MoveAlgorithms-540p_actogramFig.png

For a full view, you can use the overlayActogram.m function to create a video with a running actogram below the original video. Note, if you used a frameInterval your resulting video will only contain those frames (i.e. your video will be abbreviated).

svgUsing Compose in MATLAB for Pretty Tick Labels
svg
svgCharacterizing Tremor from Video using Frequency Analysis in MATLAB