Fast way to draw moving graphs in video

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fast way to draw moving graphs in video

Lex Fridman
Hi all,

I'm currently drawing a graph snapshot to an image file, then loading it back in and writing that image to a video with OpenCV. This I/O process is a big bottleneck. Does anyone know a faster way to do this? Are there ways in graph-tool to speed this up or skip the I/O alltogether?

- Lex

_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool
Reply | Threaded
Open this post in threaded view
|

Re: Fast way to draw moving graphs in video

Joseph Redfern-2

`graph_draw` accepts either a file name or a file object. I would investigate passing a BytesIO (https://docs.python.org/3/library/io.html#io.BytesIO) object to the `output` parameter of  `graph_draw` (instead of a filename).

 

You can then read from the BytesIO object (for instance, to a numpy array) and then pass it to OpenCV. This should avoid disk I/O entirely.

 

Joe

 

From: graph-tool <[hidden email]> On Behalf Of Lex Fridman
Sent: 21 April 2020 00:14
To: [hidden email]
Subject: [graph-tool] Fast way to draw moving graphs in video

 

Hi all,

 

I'm currently drawing a graph snapshot to an image file, then loading it back in and writing that image to a video with OpenCV. This I/O process is a big bottleneck. Does anyone know a faster way to do this? Are there ways in graph-tool to speed this up or skip the I/O alltogether?

 

- Lex


_______________________________________________
graph-tool mailing list
[hidden email]
https://lists.skewed.de/mailman/listinfo/graph-tool