pointcloud treshold kinect

Hi,

I’m figuring out how to change the treshold of the pointcloud, generate with the kinect, with the ofxKinect add-on.
In the example file you can change the treshold of the depth-image, but how can you change it in the pointcloud?

thanx!

Adri

Hi,

The drawPointCloud() method draws a 640x480 grid placing a point on every step = 2 there is no threshold variable to adjust the point cloud, but you can easily implement it, lets say you want to adjust how far you want your points to be drawn so create a variable pcThreshold

  
for(int y = 0; y < h; y += step) {  
	for(int x = 0; x < w; x += step) {  
		ofPoint cur = kinect.getWorldCoordinateFor(x, y);  
		ofColor color = kinect.getCalibratedColorAt(x,y);  
		glColor3ub((unsigned char)color.r,(unsigned char)color.g,(unsigned char)color.b);  
		if ( cur.z < pcThreshold ) {  
			glVertex3f(cur.x, cur.y, cur.z);  
		}  
	}  
}  

or you can also do

  
for(int y = 0; y < h; y += step) {  
	for(int x = 0; x < w; x += step) {  
		ofPoint cur = kinect.getWorldCoordinateFor(x, y);  
		ofColor color = kinect.getCalibratedColorAt(x,y);  
		glColor3ub((unsigned char)color.r,(unsigned char)color.g,(unsigned char)color.b);  
		if ( cur.z < pcThreshold ) {  
			cur.z = pcThreshold;  
		}  
		glVertex3f(cur.x, cur.y, cur.z);  
	}  
}  

Hope that helps

  • rS

Hi,

Thanks a lot! Works great!

Adri