Controls pixels displayed in an image with control devices as mouse input or web cam. It is necessary to have a web cam installed.

All the tabs + Images is attached in this zipped folder: Zipped verision

The script grew a bit out of proportions, but a lot of it is purely interface code. The really interesting is in the clsPix and the clsBumb classes.
BumbMapTheory.jpg
// Script by Bjork B. Christensen
// www.BjorkBC.dk
 
//========================Declare Veariables===========================
//---------Libraries-----------
import processing.video.*; //Part of processing.
 
//---------Screen--------------
int SizeH = 512; //Screen size
int SizeW = 768;
 
//----Changeable Variables-----
int NumLayers = 200; // How many images genereted in the Image Stack
 
int Trans = 0; //Controls transparency of control bars
int BgImgNum = 1; //Used when shyffling trough background images
int BgImgNumTop = 14; //Maximum number of background images
int ActiveRadio = 3; //Variable for Radiobutton
boolean SlideShow = false; // Activate or deactive the slide show effect
int Filter= 0; //Used for filtereing effect on bumbmap
int FilterMin =0; // min value for filter effect
int FilterMax = 20; // min value for filter effect
 
 
//----Global Image Stuff-------
PImage img;
PImage imgBumb;
PImage imgFin;
PImage imgStill;
Capture cam; // Is used for webcam input
 
//------Declare Classes--------
clsPix pix[] = new clsPix[NumLayers]; //The class that control the pixelated images
clsBox tab; //the class makes squares with round corners
clsScrollbar TranspScrollbar;
clsBumb Bumb; // Class to control the bumb map
clsButtons Buttons; //class that holds(and control) the interface objects
 
//---Some Global Variables------
boolean initial = true;
 
 
void setup() //======================SETUP=============================
{
  frameRate(30);
  img = loadImage(BgImgNum +  ".jpg");
  imgBumb = createImage(width,height,RGB);
 
  if(initial) { //Run this once in the beginning. Must skip this next time Setup() is called
    size(SizeW,SizeH);
    tab = new clsBox(5,height-30,width-5,height-5,7,0.4);
    Bumb = new clsBumb();
    TranspScrollbar = new clsScrollbar(0,0,width,5,1.0,255.0,155);
    Buttons = new clsButtons();
    cam = new Capture(this, SizeW, SizeH);
  }
  for(int i = 0; i < NumLayers; i++) { //One new class for each layer of images
    pix[i] = new clsPix(img,i+1);
  }
  initial = false;
}
 
 
void draw() //----------------------------------------------------------
{
  Bumb.Generate();
 
  //-------This part is using the Radiobuttons to chose which kind of Bumb map---------------
  if(ActiveRadio == 1 ) {
    println("ON1!!");
    if (cam.available() == true) {
      cam.read();
      imgBumb = cam;
      imgBumb.filter(BLUR, Filter);
      imgStill = cam;
    }
  }
 
  if(ActiveRadio == 2) {
    println("ON2!!");
    imgBumb= imgStill;
    imgBumb.filter(BLUR, Filter);
  }
 
  if(ActiveRadio == 3) {
    println("ON3!!");
    imgBumb= Bumb.Mouse(img);
  }
 
  image(imgFin,0,0);
  TranspScrollbar.update(mouseX,mouseY);
  TranspScrollbar.display(155);
  Trans = int(TranspScrollbar.getPos());
  tab.Display();
  Buttons.Display();
}
 
void mousePressed() {
  TranspScrollbar.press(mouseX, mouseY);
  Buttons.mPressed();
 
}
 
void mouseReleased() {
  TranspScrollbar.release();
  Buttons.mReleased();
}
 
void keyPressed() {
  if (key == 's' ||key == 'S') {
    imgFin.save("/ScreenShots/" + "Picture" + frameCount + ".jpg");
  }
}
 
class clsPix {
 
  //------Image Stuff------------
  PImage imgOut;
  PImage imgIn;
 
//-------Changeable Variables-----
 
//-----Some Local Variables-------
  int NextHeight = 0;
 
 
  clsPix(PImage img, int Jump) {//==============================
 //---------Image Stuff----------
    imgIn = img;
    imgIn.loadPixels();
    imgOut = createImage(imgIn.width, imgIn.height, RGB);
 
    color col = imgIn.pixels[0];
 
 
    for (int h = 0; h < imgIn.height; h++) {
      for (int w = 0; w < imgIn.width ; w++) { // for loop begin
 
        if(w % Jump == 0) {
          col = imgIn.pixels[NextHeight*imgIn.width + w];
        }
        if(h % Jump == 0) {
          NextHeight = h;
        }
        imgOut.pixels[h*imgIn.width + w] = col;
 
      }
    }
 
    imgOut.updatePixels();
  }
 
  void Display(int Jump) {
    color col = imgIn.pixels[0];
 
    for (int h = 0; h < imgIn.height; h++) {
      for (int w = 0; w < imgIn.width ; w++) { // for loop begin
 
        if(w % Jump == 0) {
          col = imgIn.pixels[NextHeight*imgIn.width + w];
        }
        if(h % Jump == 0) {
          NextHeight = h;
        }
        imgOut.pixels[h*imgIn.width + w] = col;
      }
    }
    imgOut.updatePixels();
    image(imgOut,0,0);
  }
 
  PImage img() {
    return imgOut;
  }
 
}
 
class clsBumb {
 
  PImage imgBumbOut;
  color col;
  int NextHeightBumb = 0;
  color colbumb = imgBumb.pixels[0];
  float c;
 
 
  clsBumb() {
    imgBumbOut = createImage(imgBumb.width, imgBumb.height, RGB);
    imgFin = createImage(imgBumb.width, imgBumb.height, RGB);
    col = imgFin.pixels[0];
  }
 
  void Generate() {
    for (int i = 0; i < imgFin.height*imgFin.width; i++) { // for loop begin
      imgBumb.loadPixels();
      c = brightness(imgBumb.pixels[i]);
      imgFin.pixels[i] = pix[int(map(c,1,255,1,NumLayers-1))].img().pixels[i];
      imgFin.updatePixels();
 
    }
  }
 
  PImage Mouse(PImage img) { //===========Returns Image From Where Mouse Is=============
    imgBumb.loadPixels();
    for (int h = 0; h < imgBumb.height; h++) {
      for (int w = 0; w < imgBumb.width ; w++) {
        colbumb = color(255);
 
        if(dist(w,h,mouseX,mouseY) < 80) {
          colbumb = color(0);
        }
 
        if(dist(w,h,mouseX,mouseY) > 80 && dist(w,h,mouseX,mouseY) < 130) {
          colbumb = color(map(dist(w,h,mouseX,mouseY),80,130,0,100));
        }
        imgBumbOut.pixels[h*imgBumb.width + w] = colbumb;
      }
    }
    imgBumbOut.updatePixels();
 
    //imgBumbOut = loadImage("bumb8.jpg");
    return imgBumbOut;
  }
 
  void WebCam() {
    if (cam.available() == true) {
      cam.read();
      imgBumb = cam;
    }
  }
}
 
class clsButtons{
 
  PImage imgCamera;
  clsScrollbar ResolutionScrollbar;
  clsScrollbar FilterScrollbar;
  clsRadio[] RButton = new clsRadio[3];
 
  clsButtons() {
    imgCamera = loadImage("Camera.png");
    ResolutionScrollbar = new clsScrollbar(10,height-21,200,7,1.0,NumLayers,Trans);
    FilterScrollbar = new clsScrollbar(500,height-21,200,7,FilterMin,FilterMax,Trans);
    RButton[0] = new clsRadio(320,height-17,10,color(155,Trans),color(0,Trans),0,RButton);
    RButton[1] = new clsRadio(335,height-17,10,color(155,Trans),color(0,Trans),1,RButton);
    RButton[2] = new clsRadio(350,height-17,10,color(155,Trans),color(0,Trans),2,RButton);
  }
 
  void Display(){
    ResolutionScrollbar.update(mouseX,mouseY);
    ResolutionScrollbar.display(Trans);
 
    FilterScrollbar.update(mouseX,mouseY);
    FilterScrollbar.display(Trans);
 
    stroke(80,Trans);
    fill(155,0,0,Trans);
    ellipse(218,height-17,10,10);
 
    fill(0,0,155,Trans);
    beginShape();
    vertex(245,height-22);
    vertex(235,height-17);
    vertex(245,height-12);
    endShape(CLOSE);
 
    rect(250,height-22,10,10);
 
    beginShape();
    vertex(265,height-22);
    vertex(275,height-17);
    vertex(265,height-12);
    endShape(CLOSE);
 
    noFill();
    strokeWeight(3);
    stroke(0,0,155,Trans);
    arc(285,height-17,10,10,0,TWO_PI - HALF_PI);
 
    strokeWeight(1);
    RButton[0].display(color(155,Trans),color(0,Trans));
    RButton[1].display(color(155,Trans),color(0,Trans));
    RButton[2].display(color(155,Trans),color(0,Trans));
 
  }
 
  void mPressed() {
    ResolutionScrollbar.press(mouseX, mouseY);
    FilterScrollbar.press(mouseX, mouseY);
    Filter = int(FilterScrollbar.getPos());
 
    if(dist(218,height-17,mouseX,mouseY) < 6) {
      NumLayers = int(ResolutionScrollbar.getPos());
      setup();
    }
 
    if(dist(237,height-17,mouseX,mouseY) < 8) {
      println("Back");
 
      if(BgImgNum == 1){
        BgImgNum = BgImgNumTop+1;
      }
      if(BgImgNum > 1){
        BgImgNum--;
      }
      setup();
    }
 
    if(dist(255,height-17,mouseX,mouseY) < 8) {
      println("Stop");
      SlideShow = false;
    }
 
    if(dist(270,height-17,mouseX,mouseY) < 8) {
      println("Forward");
      if(BgImgNum == BgImgNumTop){
        BgImgNum = 0;
      }
      if(BgImgNum < BgImgNumTop){
        BgImgNum++;
      }
      setup();
    }
 
    if(dist(290,height-17,mouseX,mouseY) < 8) {
      println("Slideshow");
      SlideShow = true;
    }
 
    if(dist(320,height-17,mouseX,mouseY) < 8) {
      println("Radio1");
      setup();
    }
 
    if(dist(335,height-17,mouseX,mouseY) < 8) {
      println("Radio2");
      setup();
    }
 
    if(dist(350,height-17,mouseX,mouseY) < 8) {
      println("Radio3");
      setup();
    }
 
    RButton[0].press(mouseX,mouseY);
    RButton[1].press(mouseX,mouseY);
    RButton[2].press(mouseX,mouseY);
 
    for(int i = 0; i < 3; i++) {
      if(RButton[i].state() == true) {
        ActiveRadio = i+1;
      }
    }
 
  }
 
  void mReleased() {
    ResolutionScrollbar.release();
    FilterScrollbar.release();
  }
}
 
// A class to draw boxes with round corners...
class clsBox {
  int Xt;
  int Yt;
  int Xb;
  int Yb;
  int c;
  float p;
  float p1;
 
  clsBox(int Xt_in, int Yt_in, int Xb_in,int Yb_in, int c_in, float p_in) {
    Xt = Xt_in;
    Yt = Yt_in;
    Xb = Xb_in;
    Yb = Yb_in;
    c = c_in;
    p1 = p_in;
  }
 
 void Display(){
    p = c * map(p1,0,1,-1,1); //the input of p_0 should be between 0 and 1.
    fill(255,Trans);
    beginShape();
    vertex(Xb-c,Yt); //Top right corner, left vertex
    bezierVertex(Xb+p,Yt,Xb,Yt-p,Xb,Yt+c); //Start from above Vertex, 2 handles and a ending Vertex
    vertex(Xb,Yb-c); //Bottom right corner, upper vertex
    bezierVertex(Xb,Yb+p,Xb+p,Yb,Xb-c,Yb);
    vertex(Xt+c,Yb); //Bottom left corner, right vertex
    bezierVertex(Xt-p,Yb,Xt,Yb+p,Xt,Yb-c);
    vertex(Xt,Yt+c); //Top left corner, lower Vertex
    bezierVertex(Xt,Yt-p,Xt-p,Yt,Xt+c,Yt);
    endShape(CLOSE);
  }
}
class clsScrollbar { //=====See Processing Book========
  int x, y; // The x- and y-coordinates
  float sw, sh; // Width and height of scrollbar
  float pos; // Position of thumb
  float posMin, posMax; // Max and min values of thumb
  boolean rollover; // True when the mouse is over
  boolean locked; // True when its the active scrollbar
  float minVal, maxVal; // Min and max values for the thumb
  int transp;
 
  clsScrollbar(int xp, int yp, int w, int h, float miv, float mav,int Transp) {
    x = xp;
    y = yp;
    sw = w;
    sh = h;
    minVal = miv;
    maxVal = mav;
    pos = x;
    //pos = x + sw / 2 - sh / 2;
    posMin = x;
    posMax = x + sw - sh;
  }
 
  // Updates the over boolean and the position of the thumb
  void update(int mx, int my) {
    if (over(mx, my) == true) {
      rollover = true;
    } else {
      rollover = false;
    }
    if (locked == true) {
      pos = constrain(mx - sh / 2, posMin, posMax);
    }
  }
 
  // Locks the thumb so the mouse can move off and still update
  void press(int mx, int my) {
    if (rollover == true) {
      locked = true;
    } else {
      locked = false;
    }
  }
 
  // Resets the scrollbar to neutral
  void release() {
    locked = false;
  }
 
  // Returns true if the cursor is over the scrollbar
  boolean over(int mx, int my) {
    if ((mx > x) && (mx < x + sw) && (my > y) && (my < y + sh)) {
      return true;
    } else {
      return false;
    }
  }
 
  // Draws the scrollbar to the screen
  void display(int Transp) {
    stroke(150,Transp);
    fill(255,Transp);
    rect(x, y, sw, sh);
    if ((rollover == true) || (locked == true)) {
      fill(0,Transp);
    } else {
      fill(102,Transp);
    }
    //stroke(60,Transp);
    rect(pos, y, sh, sh);
    noStroke();
  }
 
  // Returns the current value of the thumb
  float getPos() {
    float scalar = sw / (sw - sh);
    float ratio = (pos - x) * scalar;
    float offset = minVal + (ratio / sw * (maxVal - minVal));
    return offset;
  }
}
class clsRadio {
  int x, y; // The x- and y-coordinates of the rect
  int size, dotSize; // Dimension of circle, inner circle
  color baseGray, dotGray; // Circle gray value, inner gray value
  boolean checked = false; // True when the button is selected
  int me; // ID number for this Radio object
  clsRadio[] others; // Array of all other Radio objects
 
  boolean active = false;
 
  clsRadio(int xp, int yp, int s, color b, color d, int m, clsRadio[] o) {
    x = xp;
    y = yp;
    size = s;
    dotSize = size - size / 3;
    ;
    baseGray = b;
    dotGray = d;
    others = o;
    me = m;
  }
 
  // Updates the boolean value press, returns true or false
  boolean press(float mx, float my) {
    if (dist(x, y, mx, my) < size / 2) {
      checked = true;
      for (int i = 0; i < others.length; i++) {
        if (i != me) {
          others[i].checked = false;
        }
      }
      active = true;
      return true;
    } else {
      active = false;
      return false;
    }
  }
 
  boolean state() {
  return active;
  }
 
 
  // Draws the element to the display window
  void display(color b, color d) {
 
    stroke(d);
    fill(b);
    ellipse(x, y, size, size);
    if (checked == true) {
      fill(d);
      ellipse(x, y, dotSize, dotSize);
    }
  }
}