| User Documentation |
| Centre for Vision, Speech & Signal Processing |
| DEVELOP | IN NAMESPACE | AMMA TREE ROOT | AMMA SEARCH | AMMA HOME |
| BaseRangeC | |
| Base class for range images. | |
| include | "amma/BaseRange.hh" |
| User Level: | Default |
| Library: | Range |
| Example: | poltool.cc |
| Section: | default.Robert Crida |
| In Scope: | std |
Comments:
BaseRangeC is a virtual abstract base class from which ByteRangeC,
FloatRangeC and VectRangeC will be inherited.
The i/o routines do have basic error checks.
A valid image point is one in which a range measurement is available. How it is stored is dependent on the data structure but can be checked by calling the function IsValid(). In byte format, 0 is invalid and in vector format, z=-MAXFLOAT is invalid.
Range data is much more complicated than image data. It can be sampled on a regular grid or not, the grid spacings may vary. Together ByteRangeC, FloatRangeC and VectRangeC provide a powerful set of functionality. For accurate results it is important to understand precisely how the system is set up.
Firstly we explain the conventions for "gridded data". Consider a 4 pixel image row or column.
--- <-- 0.0 xgridmin=0.0 | ____ box center = 0.5 | ___ <-- 1.0 | | ___ <-- 2.0 | | ___ <-- 3.0 xgridmax=3.0 | | ___ <-- 4.0There are nrows=4 rows, i.e. r=0..3=nrows-1. Each bin hase size 1 and the total range is 0.0 - 3.9999999. For gridded data the pixels are deemed to be in the centers of the boxes, i.e. at 0.5, 1.5, 2.5, 3.5.
With each range image, the minimum and maximum x, y and z values are stored. In each case, the values are obtained by scanning all of the valid image points and finding the extremes in each dimension. These values are kept in xmin,xmax,ymin,ymax,zmin,zmax.
For conversions between row and column and x and y we use gridxmin,gridxmax,gridymin,gridymax. They are defined as shown above in the picture. In this example
For gridded data the xgridmin=0.0 xgridmax=3.0,
xmin=0.5 xmax=3.5
asuming valid pixels in the border rows.
These values are obtained if possible from the data file.To summarize the conversion is as follows:
gridsize.X = (gridmax.X - gridmin.X) / (ncols-1)
PixelC OfVect(const Vector3dC vect) const
{
return PixelC (int(floor((vect.Y()-gridmin.Y())/gridsize.Y())),
int(floor((vect.X()-gridmin.X())/gridsize.X())));
}
Vector3dC GetVect(const PixelC & pxl) const
{
return Vector3dC ((pxl.Col()+0.5)*gridsize.X()+gridmin.X(),
(pxl.Row()+0.5)*gridsize.Y()+gridmin.Y(),
f_data[pxl]);
}
The conversion from to a ByteRangeC uses the same scheme for z noting that
the range of valid pixels is 1..255, "nrows"=255.A vector range image may contain any vector in any pixel. If the operation MaptoGrid is called, however each pixel must contain a vector in the bin.
Any conversion from a vector representation will result in a rounding down of the x and y values to the grid positions. To compensate for this conversion from byte to vector will round up the positions to the centre of the grid boxes.
All loads are soft except Load, soft means no exit on error.
A left hand coordinate system is used with x and y increasing horizontally and vertically, respectively (col,row). z increases away from the camera with the result that when viewed using normal image viewers, greater distances will appear brighter unless photometric inversion is employed.
Files that can be read .pgm .dep .ris .nrcc .txt .vec .jrc .XYZim
Files that can be written .pgm .dep .ris
Derived Classes:
| Programmer:Robert Crida lib=Range, Documentation by CxxDoc: Tue Mar 20 10:48:08 2001 |