Kinect Depth Sensitivity

Hi OF-ers,
I was wondering if there is a way of editing the sensitivity of the depth map that the kinect produces. I’m conscious that the 0-255 grayscale values correspond to a specific depth, but is there a way of narrowing that field. The kinect wiki says it is possible:

“The sensing range of the depth sensor is adjustable, and the Kinect software is capable of automatically calibrating the sensor based on gameplay and the player’s physical environment, accommodating for the presence of furniture or other obstacles”

Where would I be looking to adjust this? Essentially, I need to get a higher contrast (more sensitivity) in depth when focussing on someone’s face. The person is singing and I’m eager to capture the contours of the eyes, nose but especially mouth. At the moment I’m using OF 0.62 as I’d issues compiling 0.7.

Any help would be incredible and massively appreciated - and thanks for the code base for this.

Many thanks,
Eoghan

You can try something like this.

Setting a near and far distance will tighten up what the kinect sees. Then some math to set the depth pixels colour. My example only turns the pixels white but thats where you can figure out the new pixel value.

  
  
//set the near and far threshold  
int nearThreshold = 40;  
int farThreshold  = 180;  
  
grayImage.setFromPixels(kinect.getDepthPixels(), kinect.width, kinect.height);  
	  
unsigned char * pix = grayImage.getPixels();  
int numPixels = grayImage.getWidth() * grayImage.getHeight()-1;  
	  
depthImage.setFromPixels(pix, kinect.width, kinect.height);  
depthImage.flagImageChanged();  
	  
for(int i = numPixels; i > 0 ; i--){  
	if( pix[i] > nearThreshold && pix[i] < farThreshold ){  
		//turns pixels white. need to do math here.   
		//eg. (if farThreshold was equal to 0 and nearThreshold was 255 what is the new pixel value?)  
		pix[i] = 255;  
	}else{  
		pix[i] = 0;  
	}  
}  
	  
grayImage.flagImageChanged();