9
$\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$
  • $\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 Jan 15 '15 at 7:05
  • $\begingroup$ Nice question! Do you really think it's possible to compute optical flow with build in tools? $\endgroup$ – p2or Jan 17 '15 at 9:59
  • $\begingroup$ Yes. I posted an answer to my own question, please see that. $\endgroup$ – aarslan Jan 17 '15 at 20:16
5
$\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$
  • 1
    $\begingroup$ Do you get resulting images that look like the ones from the MPI-Sintel set? $\endgroup$ – user1033657 Jul 5 '15 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 Jul 6 '15 at 13:24
  • $\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$ – Sibbs Gambling Oct 29 '16 at 15:40
  • $\begingroup$ Could you kindly explain how exactly you "scale the values with some compression"? $\endgroup$ – Sibbs Gambling Oct 29 '16 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.