Alias camera depth map ファイル

プラットフォーム

Windows

説明

Alias Camera Depth ファイルには、そのカメラから作成されたイメージに対応したデプス情報が含まれています。Camera Depth ファイルはレンダリング後の 3D コンポジットに使用されます。ファイルにはマジック ナンバー、X解像度とY解像度、浮動小数点デプス値の配列が含まれています。

バイト ヘッダ値 説明 C タイプ
0, 1, 2, 3 マジック ナンバー このタイプのファイルを一意に区別 int
4, 5 x 解像度のピクセル値 short
6, 7 高さ y 解像度のピクセル値 short

Alias の camera depth ファイルのマジック ナンバーは 55655 です。ファイルの残りの部分には、浮動小数点値の X 対 Y 配列が列順に含まれています。

次の C コードは camera depth ファイルの読み方の一例です。

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. */          
									} 
}