11
$\begingroup$

I'm trying to compute optic flow in my Blender scene using the "speed" render layer (appears as "vector" in the outliner window). This render layer is supposed to return the speed and direction of movement in the scene. Its primary purpose, according to the documentation, is to enable vector blur computation during rendering.

Since this layer is computing what is required for optical flow computation, I would like to output this information as images in HSV color space. In this color space, Hue should be direction of motion (defined in angles around a color circle), and Saturation should be the magnitude of the motion.

There are example of this done with blender, so I know this is possible: https://www.youtube.com/watch?v=ZmiBI4tPk_o#t=75

However, the output the "speed" render layer is very poorly documented for purposes outside of vector blur.

My questions are:

  1. How can I tease apart the direction and magnitude information in the speed layer?
  2. What are the ranges of these values and how can I remap them (ie linearly or nonlinearly?) onto values that can make sense
    for the output image formats

Here is a .blend file that contains my progress up to a certain point. Tips and ideas are appreciated

$\endgroup$
3
  • 1
    $\begingroup$ Enable motion blur, enable vector in render layers. Connect the speed to a separateRGB node then a map range node. (motion would be greater than the 0-1 for colour channels) r should be x motion g should be y motion b should be z motion. Not sure that's exactly what you want but it's something to play with. $\endgroup$
    – sambler
    Commented Jan 15, 2015 at 7:05
  • $\begingroup$ Nice question! Do you really think it's possible to compute optical flow with build in tools? $\endgroup$
    – p2or
    Commented Jan 17, 2015 at 9:59
  • $\begingroup$ Yes. I posted an answer to my own question, please see that. $\endgroup$
    – aarslan
    Commented Jan 17, 2015 at 20:16

1 Answer 1

7
$\begingroup$

Found the solution. The trick is to enable the desired render layer (ie "vector") and then save the render output as OpenEXR file. That format will save all the desired render layers (in this case, motion information in 4 channels) in a single file, which could then be accessed through various interfaces like Python and Matlab.

$\endgroup$
5
  • 2
    $\begingroup$ Do you get resulting images that look like the ones from the MPI-Sintel set? $\endgroup$ Commented Jul 5, 2015 at 12:34
  • 1
    $\begingroup$ You only get motion information in 2d. After that you'll need to use that information to calculate the color in HSV color space to obtain images like the sintel dataset. Also you would need to scale the values with some compression, since the range can be too erratic to display. $\endgroup$
    – aarslan
    Commented Jul 6, 2015 at 13:24
  • 1
    $\begingroup$ @user1033657 Did you manage to succeed in what aarslan said? I have the OpenEXR files output, but I am not sure how I should process (e.g., scale, transform, etc.) them. Appreciate it if you could help? $\endgroup$ Commented Oct 29, 2016 at 15:40
  • 1
    $\begingroup$ Could you kindly explain how exactly you "scale the values with some compression"? $\endgroup$ Commented Oct 29, 2016 at 17:32
  • $\begingroup$ Is there a way to obtain optical flow between frames t and t + k where k > 1? Thanks! $\endgroup$
    – aviator
    Commented Feb 29 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .