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:
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).
Recent Comments
Archives
- April 2023
- January 2023
- November 2022
- May 2022
- March 2022
- January 2022
- December 2021
- April 2021
- December 2020
- October 2020
- August 2020
- July 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- October 2019
- January 2019
- December 2018
- November 2018
- August 2018
- July 2018
- April 2018
- March 2018
- November 2017
- October 2017
- February 2017
- October 2016
- August 2016
- July 2016
- November 2015
- October 2013
- February 2013
- January 2013
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- February 2012
- December 2011