Choppy video of a mobile network
I am creating a video of a mobile network (graph). For this case, they are following a simple mobility model: everyone moves right a small amount at every time step. Each image is written to file and loaded back in and written to video (via OpenCV).
As far as I can tell the layout is turned off, but their movement is strangely choppy, plus their y-position changes a bit too. The resulting video of 1,000 steps is attached.
The drawing code for one frame is as follows:
gt.graph_draw(g, g.vp.locs, # i thought this enforces node position & turns off layout vertex_size = 10, vertex_pen_width = 0.8, # default is 0.8 vertex_color = color['black'], # vertex stroke color vertex_fill_color = color['red'], edge_color = color['white'], edge_pen_width = 0.8, # default is 1 vertex_anchor = 0, bg_color = color['black'], output_size = [iw, ih], adjust_aspect = False, output = img_out_path) img = cm.imread(img_out_path) # this is my image reading function
In addition, if I try to set
fit_view = False to test if that fixes things I get the following error:
File "/usr/lib/python3/dist-packages/graph_tool/draw/cairo_draw.py", line 1146, in graph_draw x, y, zoom = x, y, 1 UnboundLocalError: local variable 'x' referenced before assignment