Quantcast
Channel: Kinect - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 530

How and through what has processing libraries can we put a background that changes color over time ?

$
0
0

Hello all, I have a question: How and through what has processing libraries can we put a background that changes color over time with Kinect. I work with a group on a project to explain what augmented reality, being amateur we have chosen to work with the help of the Kinect and processing to achieve a small program. If you can help us thank you in advance.

The code :

import SimpleOpenNI.*;

import java.util.*;

SimpleOpenNI context;

int blob_array[];

int userCurID;

int cont_length = 640*480;

String[] sampletext = { "lu", "ma" , "me", "ve", "sa", "di", "week", "end" , "b", "c", "le"

}; // sample random text

void setup(){

size(640, 480);

context = new SimpleOpenNI(this);

context.setMirror(true);

context.enableDepth();

context.enableUser();

blob_array=new int[cont_length];

}

void draw() {

background(-1);

 context.update();

int[] depthValues = context.depthMap();

int[] userMap =null;

int userCount = context.getNumberOfUsers();

if (userCount > 0) {

userMap = context.userMap();

}

loadPixels();

background(255,260,150);

for (int y=0; y<context.depthHeight(); y+=35) {

for (int x=0; x<context.depthWidth(); x+=35) {

int index = x + y * context.depthWidth();

  if (userMap != null && userMap[index] > 0) {

     userCurID = userMap[index];

        blob_array[index] = 255;

        fill(150,200,30);

    text(sampletext[int(random(0,10))],x,y); // put your sample random text



      }

      else {

                blob_array[index]=0;



      }

    }

  }

}


Viewing all articles
Browse latest Browse all 530

Trending Articles