Skip to content

luteberget/ofxColorMap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ofxColorMap

Colorize your grayscale images with a linear segmented color map, as used in scientific plotting. Maps are taken from Matplotlib.

Usage

  • Add an ofxColorMap object to your app.

  • Select a colormap

    • Use a preset colormap. See list of preset maps below.

      colormap.setMapFromName("summer")
      
    • Alternatively, make your own color map. See matplotlib documentation for an explanation of the parameters.

      ofxColorMap::ColorMapChannel r ; r .push_back(ofVec3f( 0.0,0.0,0.0 )); r .push_back(ofVec3f( 1.0,1.0,1.0 ));
      ofxColorMap::ColorMapChannel g ; g .push_back(ofVec3f( 0.0,0.5,0.5 )); g .push_back(ofVec3f( 1.0,1.0,1.0 ));
      ofxColorMap::ColorMapChannel b ; b .push_back(ofVec3f( 0.0,0.4,0.4 )); b .push_back(ofVec3f( 1.0,0.4,0.4 ));
      ofxColorMap::ColorMap m; m.push_back(r); m.push_back(g); m.push_back(b);
      colormap.set(m);
      
  • Convert a grayscale ofImage (of type OF_IMAGE_GRAYSCALE) to a color image (allocated to same size with type OF_IMAGE_COLOR).

    colormap.apply(inputImage, outputImage);
    

Examples/screenshots

Available maps (from Matplotlib).

See: http://matplotlib.org/examples/color/colormaps_reference.html

About

Convert scalar data (grayscale images) to pseudo-color images with linear segmented color maps.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published