An Alias Camera Depth file contains depth information corresponding to the image created from that camera. The Camera Depth file is used for post-render 3D compositing. The file contains a magic number, an X and Y resolution, and an array of floating point depth values.
bytes | header value | notes | C-type |
0, 1, 2, 3 | magic number | Uniquely identifies files of this type | int |
4, 5 | width | x resolution in pixels | short |
6, 7 | height | y resolution in pixels | short |
The magic number for Alias camera depth files is 55655. The rest of the file contains an X by Y array of floating point values in row order.
The following C-code is an example of how to read a camera depth file:
filein = open( infilename, O_RDONLY ); read( filein, &magic, sizeof( int ) ); /* magic number */ if ( magic != 55655 ) { fprintf( stderr,”given input file '%s' does not have proper magic number (55655)\n”, infilename ); exit(0); } read ( filein, &width, sizeof(short) ); /* Xres */ read ( filein, &height, sizeof(short) ); /* Yres */ size = width * height; buffer = (float *)malloc ( size * sizeof( float ) ); read( filein, buffer, sizeof(float)*size2 ); /* fill the array */ close( filein ); for (i = 0; i < height; ++i) { for (j = 0; j < width; ++j) { /* Do something to the pixel. */ } }