User manual
Table Of Contents
- Introduction
- Getting started with smallv
- Stereo Geometry
- Calibration
- API Reference – C++ Language
Small Vision System User Manual 21
2.2 Storing, Saving, and Loading Stereo Data
smallv provides a basic facility for loading and saving stereo data streams. The file load and store
functions are part of the SVS library, and their source code is included. smallv exercises these
functions, and provides a memory buffer for storing live stereo video. In smallv, the buffer always holds
the left and right input stereo images.
2.2.1 Stereo Stream Storage
smallv has an internal buffer capable of holding 30 stereo pairs (frames) at a 640x480 frame size.
The buffer will hold more frames at smaller sizes, fewer frames at larger sizes. The buffer can be filled
from a previously-saved file, or from live video input. The buffer can also be written out to a file, and used
as the source for stereo processing in smallv. The current frame is indicated in input information area.
When the input source is the buffer, the acquisition mode controls (Continuous, Single,
Freeze) control the processing of the buffer frames (Section 2.1.8). The frame control can also be used
to go to an individual frame when in Single acquisition mode.
The Record button controls the input of live video into the buffer. Clear clears the buffer and
resets it to frame 0. Activating the Record button starts the input of live video frames into the buffer.
The source must be set to Video; either Continuous or Single mode may be used. Frames are
stored sequentially until the buffer is full. Pressing Record again will also turn off acquisition..
As an example, to capture a short video sequence and replay it, perform the following steps.
1. Start acquiring live video in continuous mode.
2. Clear the buffer (Clear button).
3. Start buffer storage (Record button).
4. After a short period, stop buffer storage (Record button).
5. Change from Video to Buffer source.
At this point, the short segment that is in the buffer will be replayed as a short continuous loop. The
buffer, or individual images, can be saved to a file.
2.2.2 Loading and Storing Files
The SVS libraries work with different file types for image storage.
• BMP format. Each BMP file contains a single 8-bit grayscale image, or an RGB 24-bit color
image. The color coding for the 8-bit BMP file is 256 shades of gray, with 0 being black and
255 white. By convention, a stereo pair is saved as two files with the linked names XXX-
L.BMP (left image) and XXX-R.BMP (right image). The corresponding color file is saved as
XXX-C.BMP. Finally, the image parameters are stored as a text file XXX.INI.
• PNG format. PNG (Portable Network Graphics) allows for storage of non-standard formats,
such as 16-bit grayscale. This format is used to store disparity images, which are grayscale
images with pixels larger than 8 bits.
• Text files for disparity images. Disparity images can be saved as a text file, with one line of
text for each line of the image (e.g., a 320x240 image will have 240 lines). Each line contains
an image row of disparities, as integers. The special values –1 and –2 indicate that the
disparities were filtered out, by the texture measure (-1) or the left/right check (-2)..
• Text files for 3D points. 3D point arrays, generated from a disparity image (Section 2.4.2), can
be saved as a text file. Each line of the file represents one point of the array. The array has the
same format as the image from which it was produced, e.g., if the input image is 320x240, then
the file has 320x240 lines, in row-primary order. Each line has 3D X,Y,Z coordinates first, as
floating-point numbers, then three integers for the R,G,B values of the pixel at that point. If the
disparity at a pixel is filtered out, then the Z value is negative, indicating a filtered value.
Images and image sequences are loaded into and stored from the buffer using the File menu. To
load stereo frames, use the Load menu item to bring up a file choice dialog. Choosing either BMP file of
a pair automatically loads the other. In addition, if a color file or parameter file (.ini) is present, it is also
loaded.