PFM

From MobileRead
Jump to: navigation, search

The Portable FloatMap (PFM) format was designed as a floating-point image format in the spirit the Portable Pixmap file format from the PBMPlus toolkit which include PBM and other extended Unix formats.

[edit] Overview

Like the Portable Pixmap format (.ppm), this format begins with three lines of text specifying the image size and type, and then continues with raw binary image data for the rest of the file.

The text header of a .pfm file takes the following form:

[type]
[xres] [yres]
[byte_order]

Each of the three lines of text ends with a 1-byte Unix-style carriage return: 0x0a in hex, not the Windows/DOS CR/LF combination. The "[type]" is one of "PF" for a 3-channel RGB color image, or "Pf" for a monochrome single-channel image. "[xres] [yres]" indicates the x and y resolutions of the image. "[byte_order]" is a number used to indicate the byte order within the file. A positive number (e.g. "1.0") indicates big-endian, with the most significant byte of each 4-byte float first. If the number is negative (e.g. "-1.0") this indicates little-endian, with the least significant byte first. There are no comments in these files. For example:

PF
768 512
-1.0

Indicates an RGB color image, 768 by 512 pixels, with little-endian byte order.

After the final carriage return the file proceeds with a series of three 4-byte IEEE 754 single precision floating-point numbers for each pixel, specified in left to right, bottom to top order.

This format is very specifically designed to handle HDR imaging.

[edit] For more information

This information taken from http://www.pauldebevec.com/Research/HDR/PFM/

Personal tools
Namespaces

Variants
Actions
Navigation
MobileRead Networks
Toolbox