User manual

Table Of Contents
Small Vision System User Manual 55
5.4 Stereo Image Class
svsStereoImage
Stereo image class
The stereo image class encapsulates information and data for a single stereo image pair, along with any
of its processed results, e.g., disparity image or 3D point cloud.
Stereo image objects are usually produced by one of the image acquisition classes
(
svsVideoImages or svsFileImages), then processed further by an svsStereoProcess object.
An
svsStereoImage object holds information about its own state. For example, there are Boolean
flags to tell if there is a valid set of stereo images, whether they are rectified or not, if a valid disparity
image has been computed, and so on.
The
svsStereoImage class handles all necessary allocation of buffer space for images. User
programs can access the image buffers, but should be careful not to de-allocate them or destroy them.
5.4.1 Constructor and Destructor
svsStereoImage();
~svsStereoImage();
Constructor and destructor for the class. The constructor initializes most image parameters to default
values, and sets all image data to NULL.
char error[256];
If a member function fails (e.g., if ReadFromFile returns false), then error will usually contain
an error message that can be printed or displayed.
5.4.2 Stereo Images and Parameters
bool haveImages; // true if we have good stereo images
bool haveColor; // true if left image color array present
bool haveColorRight; // true if right image color array present
svsImageParams ip; // image format, particular to each object
unsigned char *Left(); // left image array
unsigned char *Right(); // right image array
unsigned long *Color(); // left-color image array
unsigned long *ColorRight(); // right-color image array
These members describe the stereo images present in the object. If stereo images are present,
haveImages is true. The stereo images are always monochrome images, 8 bits per pixel.
Additionally, there may be a color image, corresponding to the left image, and a color image for the right
imager, if requested. Color images are in RGBX format (32 bits per pixel, first byte red, second green,
third blue, and fourth undefined). If the left color image is present,
haveColor is true. The color
image isn’t used by the stereo algorithms, but can be used in post-processing, for example, in assigning
color values to 3D points for display in an OpenGL window. Similarly, if the right color image is present,
haveColorRight is true. The color images may be input independently of each other.
Frame size parameters for the images are stored in the variable ip. The parameters should be
considered read-only, with one exception: just before calling the SetImage function.
The
Left, Right, and Color functions return pointers to the image arrays. User programs should
not delete this array, since it is managed by the stereo object.