AR face database is one of the famous and well-used face databases. This post is a memo how to convert RAW images of AR face database to other formats.
All images are stored as RGB RAW files and each image is of 768x576 pixels and of 24 bits of depth. Considering this format and some hints on the web, the following command converts a RAW image m-001-1.raw to a bmp image m-001-1.bmp using ImageMagick: convert -size 768X576 -depth 8 -interlace plane rgb:m-001-1.raw m-001-1.bmp The first option is to specify the resolution as 768x576, the second to specify the depth of color as 8 bit, and the third to specify the interlace format as (RRRRRRR..., GGGGGGG..., BBBBBBB...)
Here's a shell script that makes a directory, whose name is conv, and saves all converted images as bmp files in the directory:
[sourcecode language="bash"]
!/bin/bash
# uncompress directories for f in .tar .Z do tar xf $f done
uncompress files
for dirName in dbf1 dbf2 dbf3 dbf4 dbf5 do uncompress ./${dirName}/* done
convert .raw files to .bmp files
mkdir conv for dirName in dbf1 dbf2 dbf3 dbf4 dbf5 dbfaces6 dbfaces7 dbfaces8 do dirConvName="conv/${dirName}" mkdir ${dirConvName} cd ${dirName} for f in .raw do convert -size 768X576 -depth 8 -interlace plane rgb:${f} ../${dirConvName}/${f%.}.bmp done cd .. done [/sourcecode]