Single-Flash Texture Hallucination Process ============================== Mashhuda Glencross & Greg Ward 1. Set your camera into manual mode. You will need an SLR camera with a flash. We use a Nikon D200 camera, but you would also be fine using a Canon or other good-quality DSLR with RAW capture mode. 2. Use a tripod and make sure the area you are photographing is mostly flat and in shadowed conditions (no direct sunlight on the surface). 3. Using a flash, take a RAW photo at the camera's flash sync speed and using the smallest aperture that gives a good exposure with full flash output. Make sure the flash is set to dump its full output and does not zoom (some flashes have a zoom function). This may involve a little trial and error. 4. From exactly the same position, take a second RAW photo but this time without the flash, adjusting the exposure time to make sure that it is properly exposed. 5. Next capture a corresponding RAW flash calibration image using exactly the same settings and distance from the wall as the flash image, this time photograph a white wall. You will need to choose the white wall carefully as it needs to be fairly big and in a room that can be darkened completely. The wall also needs to be flat and reflects light uniformly/diffusely (ie. it has no texture or shininess to it). Ideally, if you want to shoot a range of condintions, it would help you enormously if you shoot a full flash calibration set of the diffuse wall for your camera and flash setup. To do this, you should shoot RAW images at a range of practical distances between about 0.6m through to about 2m away from the white wall. At each distance, take a flash calibration image at the camera's flash sync speed -- for a controlled set of possible lens-focal distances and apertures -- making sure each flash image is properly exposed and that the flash dumps its full output for each calibration image. ---------------- Image Processing -------------- A) On the set of RAW calibration images, run the script "tex1calib.csh", giving it the list of RAW images. You may wish to modify this script with an appropriate reflectance value for your particular wall. Output is a set of floating-point TIFF images named by the camera settings and containing appropriate Exif tags. These files need to be put in a calibration directory with a text file listing the TIFF file names. (You can create this file with something like "ls *.tif > calib_images.txt".) This text file is later given to "flash3surf" using the -c option. B) Create a "flash ID file" that lists flash names and positions relative to the camera focal point. The default file is: f1 0 0.170 f2 -0.1325 -0.170 f3 0.1325 -0.170 The positions are given as horizontal and vertical offsets in meters. If you only use a single flash, the entry for f1 will be used and the others may be left off (i.e., the file may contain a single line.) C) Convert your RAW flash and diffuse captures to 16-bit TIFF's using the "dctiff.csh" script, e.g.: csh -f dctiff.csh ambientA.RAW capA_am.tif csh -f dctiff.csh flashA1.RAW capA_f1.tif D1) If your flash and diffuse images are perfectly aligned and does not require cropping, you can execute the "flash3surf "command like so: flash3surf -c /path/to/calib_images.txt -f /path/to/FlashPos.txt +asp capA capB .. For each base image name, this creates the files: capA_a.tif - 24-bit RGB albedo (reflectance) image capA.obj - triangle mesh of surface NOTE: If flash3surf gives an error like "data: Missing metadata in image 'C_something.tif'" it means that the camera isn't storing the necessary metadata, and you need to manually add some using exiftool, such as: exiftool -SubjectDistance=2 -FocalLengthIn35mmFormat=50 *.tif D2) If you need to crop and/or align your captures, use the alternate invocation of flash3surf, passing a set of base names, crop rectangles, and flash alignment offsets, e.g.: flash3surf -c /path/to/calib_images.txt -f /path/to/FlashPos.txt +asp - # File format (xa ya xb yb are crop and 'f1' is flash condition): # "base_name" xa ya xb yb f1 xoff yoff capA 148 196 1571 1240 f1 1 -3 capB 148 0 1593 1137 f1 1 0 The first two lines are obviously comments, followed by each base file name, the x and y extrema for the cropping rectangle, and the offset (in pixels to the right and down) needed to align the indicated flash. (Note that we don't have the ability to correct for rotational alignment issues at this time.)