how to change kinect color

edited October 2014 in Kinect

i want to change kinect color... i can change single color. for example, change red to yellow. but i can't change single color to gradient color i want to change single color to gradient color.. T.T help me please...

this is the code (i found the code source from processing forum.. i can't remember author.. sorry)

import SimpleOpenNI.*;
SimpleOpenNI  context;

int[] sceneMap;//this will store data about the scene 
PImage myUserImage;//this is where we'll draw the user
int user1Colour = color(150, 0, random(255)); //change to whatever you like

void setup()
  context = new SimpleOpenNI(this);

  background(200, 0, 0);
  //  size(context.sceneWidth() , context.sceneHeight());
  size(screen.width, screen.height);
  //set scene map array
  sceneMap = new int[context.sceneWidth()*context.sceneHeight()];
  //create the image to draw the user into, by default it will be filled black
  myUserImage = createImage( context.sceneWidth(), context.sceneHeight(), RGB );

void draw()


  // // gives you a label map, 0 = no person, 0+n = person n - tell OpenNI to update the numbers in the array
  //clear myUserImage - fill everything with black
  Arrays.fill(myUserImage.pixels, color(0));//We've never used Arrays.
//  fill() before, 
// but all it does is it loops through all elements on an array you pass and sets a value you want for each element 
//- fills an array with a value

  for (int i = 0 ; i < myUserImage.pixels.length; i++) {
    //check if there is a user for the current pixel, if so, use our custom colour for the pixel at this index
    if (sceneMap[i] > 0) myUserImage.pixels[i] = user1Colour;

  //display image
  image(myUserImage, -500, 0, screen.width+500, screen.height);


Sign In or Register to comment.