Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Confluence
/
Processing Keystone

Processing Keystone

Mar 01, 2018

There is a simple library called Keystone for Processing that enables projection mapping.

You can download the library using the built-in library manager in Processing.

Basic Example

The following example shows a basic usage with one mapped surface:

import deadpixel.keystone.*;

Keystone ks;
CornerPinSurface surface;

PGraphics offscreen;

void setup() {
  // Keystone will only work with P3D or OPENGL renderers, 
  // since it relies on texture mapping to deform
  size(800, 600, P3D);

  ks = new Keystone(this);
  surface = ks.createCornerPinSurface(400, 300, 20);
  
  // We need an offscreen buffer to draw the surface we
  // want projected, note that we're matching the resolution
  // of the CornerPinSurface.
  // (The offscreen buffer can be P2D or P3D)
  offscreen = createGraphics(400, 300, P3D);
}

void draw() {
  // Convert the mouse coordinate into surface coordinates
  // this will allow you to use mouse events inside the 
  // surface from your screen. 
  PVector surfaceMouse = surface.getTransformedMouse();

  // Draw the scene, offscreen
  offscreen.beginDraw();
  offscreen.background(255);
  offscreen.fill(0, 255, 0);
  offscreen.ellipse(surfaceMouse.x, surfaceMouse.y, 75, 75);
  offscreen.endDraw();

  // most likely, you'll want a black background to minimize
  // bleeding around your projection area
  background(0);
 
  // render the scene, transformed using the corner pin surface
  surface.render(offscreen);
}

void keyPressed() {
  switch(key) {
  case 'c':
    // enter/leave calibration mode, where surfaces can be warped 
    // and moved
    ks.toggleCalibration();
    break;

  case 'l':
    // loads the saved layout
    ks.load();
    break;

  case 's':
    // saves the layout
    ks.save();
    break;
  }
}

Multiple Surfaces

You can map multiple interfaces by using multiple CornerPinSurface and PGraphics objects.


, multiple selections available,
For you

Computer Vision
Results will update as you type.
  • Digital Signal Processing
  • Einfache Algorithmen
  • Image Processing
  • Kinect
  • Klassen
  • Leap
  • Linksammlung
  • Marker Tracking
  • OpenCV
  • Processing Keystone
  • Resolume Arena
  • Sound als Input
  • Vektoren
  • Video Processing
  • Video Library 2.0
  • Arduino Portenta H7 + Vision Shield

{"serverDuration": 16, "requestCorrelationId": "6746bc3649284333ad075b581c4dab97"}