Extract motion energy features from video using spatio-temporal Gabors
Project description
What is pymoten?
pymoten is a python package that provides a convenient way to extract motion energy features from video using a pyramid of spatio-temporal Gabor filters [1] [2]. The filters are created at multiple spatial and temporal frequencies, directions of motion, x-y positions, and sizes. Each filter quadrature-pair is convolved with the video and their activation energy is computed for each frame. These features provide a good basis to model brain responses to natural movies [3] [4].
Installation
Clone the repo from GitHub and do the usual python install
git clone https://github.com/gallantlab/pymoten.git
cd pymoten
sudo python setup.py install
Or with pip:
pip install pymoten
Getting started
Example using synthetic data
import moten
import numpy as np
# Generate synthetic data
nimages, vdim, hdim = (100, 90, 180)
noise_movie = np.random.randn(nimages, vdim, hdim)
# Create a pyramid of spatio-temporal gabor filters
pyramid = moten.get_default_pyramid(vhsize=(vdim, hdim), fps=24)
# Compute motion energy features
moten_features = pyramid.project_stimulus(noise_movie)
Simple example using a video file
import moten
# Stream and convert the RGB video into a sequence of luminance images
video_file = 'http://anwarnunez.github.io/downloads/avsnr150s24fps_tiny.mp4'
luminance_images = moten.io.video2luminance(video_file, nimages=100)
# Create a pyramid of spatio-temporal gabor filters
nimages, vdim, hdim = luminance_images.shape
pyramid = moten.get_default_pyramid(vhsize=(vdim, hdim), fps=24)
# Compute motion energy features
moten_features = pyramid.project_stimulus(luminance_images)
Cite as
Nunez-Elizalde AO, Deniz F, Dupré la Tour T, Visconti di Oleggio Castello M, and Gallant JL (2021). pymoten: scientific python package for computing motion energy features from video. Zenodo. https://doi.org/10.5281/zenodo.6349625
References
A MATLAB implementation can be found here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pymoten-0.0.7.tar.gz
.
File metadata
- Download URL: pymoten-0.0.7.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fa33c22961f9c46f4d58bbb1a8cb1603206ad73f9e4444a4d2959e0a5d22d5c |
|
MD5 | 95e23652d18cf0c147309b3bfbc2bfa3 |
|
BLAKE2b-256 | 171316d4f6de9e9f659183bd43f1bb88b9f0f6cfd8e550835d7755ac80f75d65 |
File details
Details for the file pymoten-0.0.7-py3-none-any.whl
.
File metadata
- Download URL: pymoten-0.0.7-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c5129f604107a1b6e8e9df6e59b257797013e74b627dec431ed0b538770a992 |
|
MD5 | c2da19a7813892cb7e2689f6bf41c941 |
|
BLAKE2b-256 | 2db15acf87ee96dced24c64f88ae249d378d18a83b449c394b7738078db15972 |