blenderproc.python.sampler.RandomWalk module

Creates a random walk with the specified properties

blenderproc.python.sampler.RandomWalk.random_walk(total_length, dims, step_magnitude=1.0, window_size=1, interval=None, distribution='uniform', order=1.0)[source]

Creates a random walk with the specified properties. Can be used to simulate camera shaking or POI drift. steps ~ step_magnitude * U[-1,1]^order

Parameters:
  • total_length (int) – length of the random walk

  • dims (int) – In how many dimensions the random walk should happen

  • step_magnitude (float) – Maximum magnitude of any coordinate in a single step

  • window_size (int) – Convolve the final trajectory with an average filter that smoothens the trajectory with a given filter size.

  • interval (Optional[List[ndarray]]) – Constrain the random walk to an interval and mirror steps if they go beyond. List of arrays with dimension dims.

  • distribution (str) – Distribution to sample steps from. Choose from [‘normal’, ‘uniform’].

  • order (float) – Sample from higher order distribution instead of the uniform. Higher order leads to steps being less frequently close to step_magnitude and thus overall decreased variance.

Return type:

ndarray

Returns:

The random walk trajectory (total_length, dims)