The Video class is an abstract base class for video device interfacing
The Video class is an abstract base class for video device interfacing. It provides an interface between tracking software and video hardware.Video-derived classes fulfill the following broad functions: Initialization and closing of hardware devices. Transfers (grabbing) of data from hardware device into memory, or, if the device can be memory mapped, access to pixel data. Displays of lines, etc., on the device monitor (in some instances, the user terminal may function as the device monitor).
For purposes of porting XVision to a new hardware device, a class that instantiates these functions must be defined. In many cases, the default Video class methods will be sufficient, although code at this level should be optimized for the specific device for best performance. The easiest way to create a new class is to model it on one of the many classes in the Devices directory. Most non-virtual member functions will probably not need to be rewritten in derived classes.
The classes MonoVideo and ColorVideo are derived from the Video class, and most instantiations should be derived from one of these (see comments for MonoVideo and ColorVideo classes).
Video class objects have an output type associated with them, which are one of the Device_output_type's enumerated in Video.hh. This allows one to switch (even during execution) between returning RGB data or monochrome intensity data, for example.
Many video devices are memory mapped in some fashion. If so, it's sometimes advantageous to bypass the usual memory acquisition routines and perform inline processing or dump memory straight to the display device without copying.
Video classes grab windows, which are rectangular, and have the following parameters: position (x,y) in pixels, orientation in radians, and subsampling rates (sampw,samph) in pixels. The conventions are that the position coordinates indicate the center of the window, and that the 0 orientation has window sides aligned with the camera image. Orientation is also measured to coincide with image coordinates (i.e., (0,0) at the top left and increasing Y values going down). Thus, a window that is tilted counterclockwise on the monitor (or in the image), would have NEGATIVE angular orientation. This is the same convention that is used in the rest of the XVision system.
The constructor should either initialize the video device or call
a function which does the initialization. Initialization should
include hardware initialization, hardware parameter settings,
memory mapping (if available), and so on. Example constructors
in specific Device classes in the Devices directory may help, but
generally, this function will be unique to the hardware and its drivers.
int _is_mappable
int ncols
int nrows
int fg_ncols
int fg_nrows
virtual int map_color(Color colin)
void set_size(int nrows_in, int ncols_in)
void set_fg_size(int nrows_in, int ncols_in)
Device_output_type output_type
Device_output_type input_type
Device_output_type set_input_type(Device_output_type ot)
void map_image(int *x, int npixels)
void map_image(Image &x)
int adjust_to_first_coord(float &x, int width)
Video(int nbytes, int nc_in = 640, int nr_in = 480)
~Video()
virtual char* device_info()
virtual void set_grab_type(Device_output_type ot)
Device_output_type output_data_type()
virtual int pre_grab()
virtual int post_grab()
virtual void close()
int width()
int height()
virtual void* current_frame_ptr()
virtual int is_mappable()
virtual void* direct_memptr()
virtual int bytesperpixel()
int in_view(int cx, int cy, int w, int h)
int in_view(int cx, int cy, int w, int h, float angle)
int in_view(const Image &x, int cx, int cy)
int in_view(const Image &x, int cx, int cy, float angle)
int in_view2(int x1, int y1, int x2, int y2)
virtual int grab(int *image, int x, int y, int width, int height, float angle = 0.0, int sampw =1, int samph =1, short int mask = 0xff)
virtual int grab(Image &image, int x, int y, float angle = 0.0, int sampw =1, int samph =1, short int mask = 0xff)
virtual int grab_aligned(int *image, float &x, float &y, int width, int height, int sampw =1, int samph =1, short int mask = 0xff)
virtual int grab_aligned(Image &image, float &x, float &y, int sampw =1, int samph =1, short int mask = 0xff)
virtual int grab_aligned(Image &image, int x, int y, int sampw =1, int samph =1, short int mask = 0xff)
virtual int grab_static(int *image, int x, int y, int width, int height, float angle = 0.0, int sampw =1, int samph =1, short int mask = 0xff)
virtual int grab_static(Image &image, int x, int y, float angle = 0.0, int sampw =1, int samph =1, short int mask = 0xff)
virtual int grab_region(int *image, int lx, int ly, int ux, int uy, int sampw =1, int samph = 1)
virtual int grab_region(Image &image, int lx, int ly, int sampw =1, int samph = 1)
virtual int show(int x, int y, int width, int height, int *image)
virtual int show(Image &im, int x=100, int y=100)
virtual void line(float x, float y, int length, float angle, Color color = default_color, int samp = 1)
virtual void clearline(float x, float y, int length, float angle, int samp = 1)
virtual void line2(float x1, float y1, float x2, float y2, Color color = default_color)
virtual void clearline2(float x1, float y1, float x2, float y2)
virtual void circle(float x, float y, int r, Color color = default_color)
virtual void clearcircle(float x, float y, int r)
virtual void cubic(float x, float y, int length, float angle, float a, float b, float c, Color color = default_color)
virtual void clearcubic(float x, float y, int length, float angle, float a, float b, float c)
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de