Kraysent / OMTool

Modeling N-Body problem in galactic evolution application.
https://omtool.readthedocs.io/en/latest/
Apache License 2.0
0 stars 0 forks source link

Add ability to create videos in visualizer #131

Open Kraysent opened 2 years ago

Kraysent commented 2 years ago

Problem: for now visualizer can create only images according to ceratain pattern. Desired functionality: ability to specify video and its parameters in configuration file Approach:

visualizer:
  output_dir: ....
  pic_filename: .....
  video:
    name: "some name.mp4"
    frame_frequency: 5
    ...
  ...

Solution lies somewhere in FuncAnimation field

Kraysent commented 2 years ago

Pure FuncAnimation approach seems to be too complex.

Duct tape approach is as follows:

  1. Save each image to StringIO buffer
  2. Save it to disk if needed
  3. Load it to ndarray with Pillow
  4. Put it onto the canvas with plt.imshow()
  5. Use FuncAnimation to animate these pics