Skip to main content

Extract motion energy features from video using spatio-temporal Gabors

Project description

Build Status Github Python

What is pymoten?

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

# Download 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymoten-0.0.0.tar.gz (19.7 kB view details)

Uploaded Source

File details

Details for the file pymoten-0.0.0.tar.gz.

File metadata

  • Download URL: pymoten-0.0.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pymoten-0.0.0.tar.gz
Algorithm Hash digest
SHA256 6ea96a3cf289a83cac87ebbc083cfad7e6ab8b5076461d8527eccc8db35a3ee5
MD5 fb1cff13531581e562ddf8dee1a2a646
BLAKE2b-256 66c3eb8053871e96862d37d47a08b5821617054ea9700b7dcaebb75bc80c734a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page