import imageadjuster.*;
/**
Illustrates using the very low-level LUT routines to accomplish a "solarize" operation.
Every value less than a given threshold will be left unchanged, every value greater than or equal to
the threshold will be negated. (Note that a threshold value of 255 simply produces a basic
negation operation)
*/
size(200,200);
background(loadImage("milan_rubbish.jpg"));
ImageAdjuster adjust = new ImageAdjuster(this);
// define the threshold
int threshold = 144;
// create a custom lookup table
float [] mylut = new float[256];
// populate the lookup table with thresholded values
for (int i=0; i<256; i++)
mylut[i] = (i < threshold) ? (float)(i) : (float)(255-i);
// tell the adjuster to use custom lookup table
adjust.setLUT(mylut);
// perform the adjustment
adjust.apply(g);