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. 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 [1] [2].
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
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)
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
File details
Details for the file pymoten-0.0.2.tar.gz
.
File metadata
- Download URL: pymoten-0.0.2.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3ad2b088dc9650aee6bdc177e1d79d273a07b4f7a694ed820afc6b7cd38aa67 |
|
MD5 | 72ea20245bd5d451e4e51d0eb89e89e9 |
|
BLAKE2b-256 | fd704c77fa7ad4339aee7f82df91bf111582b461b9dec902a16ac91a3dda23ce |