Пример #1
0
//--------------------------------------------------------------
void testApp::draw() {
	
	ofSetColor(255, 255, 255);

	// Draw some debug images along the top
	handDiff.draw(20, 256, 315, 236);
	footDiff.draw(20, 502, 315, 236);
	
	// Draw a larger image of the calibrated RGB camera and overlay the found blobs on top of it
	colorImg.mirror(false,true);
	colorImg.draw(20, 10, 315, 236);

	contourFinder.draw(20, 10, 315, 236);
	footContourFinder.draw(20, 10, 315, 236);
		
	// Display some debugging info
	char reportStr[1024];
	//sprintf(reportStr, "left: %i right: %i foot: %i", leftDown, rightDown, footDown);
	sprintf(reportStr, "left: %f right: %f foot: %f", shm->x, shm->y, shm->z);
	ofDrawBitmapString(reportStr, 20, 800);
	
	drawFigures();
	
	
	if(bDrawPointCloud) 
	{
		easyCam.begin();
		drawPointCloud();
		easyCam.end();
	} 
	
	else if(bDrawContourFinder) { contourFinder.draw(0,0, 1024, 768);}
	
	
}
Пример #2
0
//--------------------------------------------------------------
void testApp::draw() {
	
	ofSetColor(255, 255, 255);

	// Draw some debug images along the top
	kinect.drawDepth(10, 10, 315, 236);
	grayDiff.draw(335, 10, 315, 236);
	footDiff.draw(660, 10, 315, 236);
	
	// Draw a larger image of the calibrated RGB camera and overlay the found blobs on top of it
	colorImg.draw(10,256);
	contourFinder.draw(10,256);
	//footContourFinder.draw(10,256);
		
	// Display some debugging info
	char reportStr[1024];
	//sprintf(reportStr, "left: %i right: %i foot: %i", leftDown, rightDown, footDown);
	sprintf(reportStr, "left: %f right: %f foot: %f", shm->x, shm->y, shm->z);
	ofDrawBitmapString(reportStr, 20, 800);
	
	drawFigures();
	
	/*if(bSetup)
	{
		handTracking.drawSetup();
		
		glColor3f(1.0f, 1.0f, 1.0f);
		ofPoint center = ofPoint(ofGetWidth() / 2.0f, ofGetHeight() / 2.0f );
		glBegin(GL_LINES);
		glVertex2f( center.x, center.y );
		glVertex2f(center.x + (avgFlow.x * 5), center.y + (avgFlow.y * 5) );
		glEnd();
		
	}
	else
	{
		handTracking.draw();
		for(vector<Draggable>::iterator it = draggables.begin(); it != draggables.end(); ++it)
		{
			it->draw();
		}
	}
	glColor3f(1.0f, 1.0f, 1.0f);
	kinect.getTextureReference().draw(ofGetWidth() - 180, ofGetHeight() - 140, 160, 120); 
	*/
	if(bDrawPointCloud) 
	{
		easyCam.begin();
		drawPointCloud();
		easyCam.end();
	} 
	
	else if(bDrawContourFinder) { contourFinder.draw(0,0, 1024, 768);}
	
	if(physics.spheres>0){physics.drawBall();}
	if(physics.lines>0 && flag==true){physics.drawLines();}

	// draw instructions
	ofSetColor(255, 255, 255);
	stringstream reportStream;
	reportStream << "accel is: " << ofToString(kinect.getMksAccel().x, 2) << " / "
	<< ofToString(kinect.getMksAccel().y, 2) << " / "
	<< ofToString(kinect.getMksAccel().z, 2) << endl
	<< "press p to switch between images and point cloud, rotate the point cloud with the mouse" << endl
	<< "using opencv threshold = " << bThreshWithOpenCV <<" (press spacebar)" << endl
	<< "set near threshold " << nearThreshold << " (press: + -)" << endl
	<< "set far threshold " << farThreshold << " (press: < >) num blobs found " << contourFinder.nBlobs
	<< ", fps: " << ofGetFrameRate() << endl
	<< "press c to close the connection and o to open it again, connection is: " << kinect.isConnected() << endl
	<< "press UP and DOWN to change the tilt angle: " << angle << " degrees" << endl;
	ofDrawBitmapString(reportStream.str(),20,652);
	

}