Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.59 KB

README.md

File metadata and controls

45 lines (33 loc) · 1.59 KB

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