Image Based Vector Fields

I put together a very simple script for creating vector fields from images, visualising the results with one of SPM’s vector field components. The script iteratively rotates a vector based on the greyscale difference between neighbouring pixels, and outputs the grid of vectors. Results and definition below.

Vector Field From Image

~ by ledatomica on June 30, 2011.

3 Responses to “Image Based Vector Fields”

  1. hi, i really like this definition but im kinda stuck bcause i dont know how to turn vectors to curves, can you help me?

    • Hi David,

      In order to generate the curves, you iteratively push points through the vector field. Because of the iteration/looping required this is typically done with a script, but SPM’s vector field plugin ( will do this for you with their ‘Integration’ components. Have a look at their example files to figure out how they work. I didn’t include the components in the definition because not everyone will have them installed.

  2. Hi thank you for response, can you please upload the file with the spm vector component, i have it but i been strugling to get a result for the last 3 hours and i cant seem how to make it work the way you do.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: