jeonghopark
4/19/2016 - 2:32 PM

IL 2016 SS

IL 2016 SS

import peasy.*;
import peasy.org.apache.commons.math.*;
import peasy.org.apache.commons.math.geometry.*;
import peasy.test.*;

PeasyCam camera;

PImage depthImg;


void setup() {

  size(625, 475, P3D);
  camera = new PeasyCam(this, 800);

  depthImg = loadImage("capture_01.jpg");

  noStroke();
}



void draw() {

  background(30);

  pushMatrix();
  camera.beginHUD();
  //translate(-width*0.5, -height*0.5);
  image(depthImg, 0, 0, 120, 90);
  camera.endHUD();
  popMatrix();

  pushMatrix();
  translate(-width*0.5, -height*0.5);

  int _stepSize = 4;

  for (int j=0; j<depthImg.height; j+=_stepSize) {
    for (int i=0; i<depthImg.width; i+=_stepSize) {

      int _index = i + j * depthImg.width; 
      
      color _zColor = depthImg.get(i, j);
      float _z = brightness(_zColor);

      pushMatrix();
      translate(i, j, _z);
      rect(0, 0, _stepSize, _stepSize);
      fill(_zColor);
      popMatrix();
    }
  }


  popMatrix();
}