motmot.wxvideo – display of uncompressed video using wxPython

The wxvideo package allows display of numpy arrays into wxPython OpenGL contexts. In particular, it defines a class DynamicImageCanvas, which is a subclass of wx.glcanvas.GLCanvas into which arrays are blitted.

See also motmot.wxglvideo.simple_overlay for hardware accelarated video display in a manner compatible with this module.


class motmot.wxvideo.wxvideo.DynamicImageCanvas(*args, **kw)

Bases: wx._core.Window

Display uncompressed video images

This class supports the display of multiple, side-by-side images. Each of these images is from a single source (a camera, for example), so multiple views can be displayed with one DynamicImageCanvas instance. Each source has an identity string id_val which is used when updating that view’s image.

Simple overlay drawings are also possible. Points and lines may be drawn on top of the displayed images.

get a copy of the current image as an RGB8 numpy array

blit bitmap to drawing context

Optional keyword Arguments

drawDC : wx.PaintDC instance
The draw context into which to blit

update the view transformation to include a left-right image flip for all images

Arguments val : boolean

Whether to flip the image

update the view transformation to include a 180 degree rotation for all images


val : boolean
Whether to rotate the image
update_image_and_drawings(id_val, image, format=None, points=None, linesegs=None, point_colors=None, point_radii=None, lineseg_colors=None, lineseg_widths=None, xoffset=0, yoffset=0, doresize=None)

update the displayed image


id_val : string
An identifier for the particular source being updated
image : numpy array
The image data to update

Optional keyword arguments

format : string
The image format (e.g. ‘MONO8’, ‘RGB8’, or ‘YUV422’)
points : list of points
Points to display (e.g. [(x0,y0),(x1,y1)])
linesegs : list of line segments
Line segments to display (e.g. [(x0,y0,x1,y1),(x1,y1,x2,y2)])