Open martinRenou opened 3 years ago
Great library thank you.
Did you manage to get this enhancement to work?
I am trying to hand draw onto a video stream from opencv video capture. I have a Multicanvas setup with the background image being updated every 50ms and the top canvas being used for drawing. This works ok but he drawing is slow and the stroke colour defaults to black even through it is set to white, also the line width is 1 even through the attribute is set to 3. Not sure if improving put_image_data performance will help this with this issue or it is a different bug.
I tried to install the development version so I could try the put_image_data_improvements but I through an error during install. I will post this as a separate issue.
Actually never mind, I found the solution to my issue from looking at the Interaction during animation example. I need to implement an event loop. For some reason the iMac I was using was handling widget events most of the time but only with black lines but my MacBook was waiting until the loop had completed.
I think simplejpeg
is even faster for encoding, it's used in https://github.com/vispy/jupyter_rfb
We can improve
put_image_data
by sending a jpeg encoded value instead of the entire matrix: See this code in ipyvtk https://github.com/Kitware/ipyvtk-simple/blob/7a30b215c7d8dce5109330e8c4a197ff2e2c4426/ipyvtk_simple/viewer.py#L165-L171