Classes | Defines
core/vgui/vgui_range_map.h File Reference

A mapping from pixels to 8 bit display range. More...

#include <vxl_config.h>
#include <vbl/vbl_array_1d.h>
#include <vgui/vgui_range_map_params.h>

Go to the source code of this file.

Classes

class  vgui_range_map< Type >

Defines

#define VGUI_RANGE_MAP_INSTANTIATE(T)   extern "please include vgui/vgui_range_map.txx first"

Detailed Description

A mapping from pixels to 8 bit display range.

Author:
J.L. Mundy Supports pixel look-up table mapping for contrast adjustment and other interactive controls of the image display range A key application is producing usable display of 16 bit pixels Can be used to interactively window the dynamic range of 8 bit pixels or to display signed char or signed short.

For byte and short pixel types, the mapping is implemented using a look-up table.

When mapping can be done by a look_up table, there are two table types available (* = [L,R,G,B,A]): ::*map() - rmap[in_pixel]->vxl_byte ::f*map() - frmap[in_pixe]->float

*map is used to map the image pixels during conversion to display pixels carried out by vgui_section_buffer. The range of this map is [0 256], which is the unclamped range in vgui_pixel.

*fmap is used to directly map image pixels using the OpenGL glPixelMapf() mapping function. The best form for a glPixelMap is an array of floats on the range [0,1] and is provided by frmap.

For pixel types with a larger dynamic range than can be stored in a table, the pixel conversion is done on the fly, using the ::map_pixel(in_pixel) method. This function is applied in vgui_section_buffer during pixel conversion.

The gamma mapping function is defined as, y = (x)^(1/gamma) which accounts for the standard photometric gamma correction. Note on Gamma (by Joel Savaric 1998): 1/gamma is used to be consistent with other software like Photoshop, Paintshop pro, GIMP or xv, that raise to the power of 1/gamma when making gamma correction. Gamma correction is considered to be a correction of the hardware setting. Monitors raise the input voltage to a power of gamma (generally gamma=1.7 or 2.5) When you want to correct the gamma of the monitor your raise to the power of 1/gamma. (for more detail see http://www.cgsd.com/papers/gamma.html)

The map can also be inverted, i.e. swapping dark and light intensity values, in = max(in)-in;

The map is recomputed whenever the domain limits, gamma or invert parameters are changed.

Notes:

In GUI applications, the dynamic mouse motion pixel display should show the source pixel values before mapping, not the frame buffer values.

The current scheme can easily be extended to full color support if the need arises. The number of maps has to be extended to three (four with an alpha channel or multi-spectras) as well as increasing the number of mapping parameters.

    Modifications
     <none>
   

Definition in file vgui_range_map.h.


Define Documentation

#define VGUI_RANGE_MAP_INSTANTIATE (   T)    extern "please include vgui/vgui_range_map.txx first"

Definition at line 167 of file vgui_range_map.h.