User manual
Small Vision System User Manual 53
5.5 Stereo Engine functions
These functions compute a stereo disparity or confidence image from an input stereo pair. Stereo
processing is affected by many parameters, such as the correlation window size, confidence filter
threshold, etc. A parameter structure (svsSP) contains most of these; a few others are global variables.
5.5.1 Parameter Structure svsSP
This structure is used by most Stereo Engine functions. It holds image size and stereo processing
parameters. A parameter structure can be saved to a file and reloaded from a file. Please see the
definition in the file src/svs.h.
svsSP svsParams
This global variable contains an svsSP structure that is the default structure for most functions,
if an explicit parameter structure is not passed as an argument.
5.5.2 MMX
This function and variable control the use of MMX instructions on Pentium processors. Normally,
MMX is enabled.
int svsHasMMX
This global integer controls whether optimized MMX code is being used. User programs
can set this flag to 0 (no MMX) or 1 to control whether such code is used. Normally, the
SVS library will call svsCheckMMX to determine the correct state of svsHasMMX before
any stereo processing.
int svsCheckMMX(void)
Checks whether the host computer supports MMX code, and sets the value of svsHasMMX
appropriately. This check is done internally by the stereo function, and can also be called by
user programs. Returns the value of svsHasMMX.
If svsHasMMX has already been set to 0 or 1, then svsCheckMMX does nothing. The value
of svsHasMMX must be negative (unknown) for svsCheckMMX to have an effect.
Currently svsCheckMMX does not work under Windows 95/NT, and the default is to set
svsHasMMX to 1.
5.5.3 Warping
Warping is used to correct for lens distortion, and to rotate the images to bring them into alignment as
in a perfectly parallel stereo setup. It uses the distortion and external parameters in an svsSP structure.
If desired, warping should be done before calling the stereo calculation functions.
void svsWarpImage(unsigned char *dest, unsigned char *src, int which,
svsSP *sp)
Warps the image pointed to by src into the buffer dest. This function corrects for radial
distortion and rectifies the images to align the epipolar geometry. The warping uses an internal
buffer, so src and dest can be the same buffer, if desired. If sp is NULL, the default parameter
structure svsParams will be used.
The which parameter says which image is being rectified, left, right or left-color. Symbolic
names for these are in svs.h:
svsLEFT










