# We only need a shared view on the canvas...
img_buf = p.get_canvas(copy=False)
# ... because the following performs a deep copy:
img_np = img_buf.to_channels(3)
The last line has to be adjusted to img_np = np.array(...)
[ ] Test & document that there seems to be a notable performance penalty between the buffer-to-numpy conversions. For example, with a 4k image:
# Takes on average ~15ms
img_np = np.array(painter.canvas)[:, :, :3].copy()
[x] Remove quote from BoundingBox2DStyle docstr: How a 2D bounding box should be drawn.”
[x] There's a bug in the
painter
documentation:The last line has to be adjusted to
img_np = np.array(...)
[ ] Test & document that there seems to be a notable performance penalty between the buffer-to-numpy conversions. For example, with a 4k image:
[x] Remove quote from
BoundingBox2DStyle
docstr:How a 2D bounding box should be drawn.”