User manual

Table Of Contents
Small Vision System User Manual 57
image; the Y axis is vertical and the positive direction is down relative to the center of the image (a right-
handed coordinate system). Negative values of Z are used to indicate there was no valid disparity reading
at a pixel
If the 3D array is present, then
have3D is true. The actual number of 3D points present in the arrays
is given by
numPoints.
5.4.6 File I/O
bool SaveToFile(char *basename); // saves images and params to files
bool ReadFromFile(char *basename); // gets images and params from files
bool ReadParams(char *name); // reads just params from file
bool SaveParams(char *name); // save just params to file
Images and parameters in a stereo object can be saved to a set of files (SaveToFile), and read back
in from these files (
ReadFromFile). The basename is used to create a file set. For example, if the
basename is
TESTIMAGE, then the files set is:
TESTIMAGE-L.bmp // left image, if present
TESTIMAGE-R.bmp // right image, if present
TESTIMAGE-C.bmp // left color image, if present
TESTIMAGE.ini // parameter file
Just the parameters can be read from and written to a parameter file, using ReadParams and
SaveParams. These functions take the explicit name of the file, e.g., TESTIMAGE.ini. Parameter
files have the extension
.ini, by convention.
5.4.7 Copying Functions
void SetImages(unsigned char *left, // Sets images from user data
unsigned char *right,
unsigned char *color,
unsigned char *color_right,
svsImageParams *ip = NULL,
svsRectParams *rp = NULL,
bool rect = false,
bool copy = false);
void CopyFrom(svsStereoImage *si); // copies contents of si to object
These functions are not used in typical applications, since they manipulate the stereo object buffers.
User programs can insert buffer data into a stereo image object using the above functions. These functions
are generally useful for making memory buffers of sequences of images, rather than for initial input of
images. For example, if you want to input images from your own stereo rig, with images stored in
memory, it is recommended to use the
svsStoredImages acquisition class, which will produce
svsStereoImage samples. Acquisition classes can perform rectification operations, while the
svsStereoImage class cannot.
Optional parameter information can be supplied with the images, via the parameter arguments;
otherwise, the parameters already present in the object remain the same. If any of the image arguments is
NULL, then no image data is inserted for that image. If the
copy argument is true, then the buffer
contents are copied onto the stereo image object’s own buffers. If not, then the input buffers are used
internally.