コード例 #1
0
ファイル: ofApp.cpp プロジェクト: nosarious/kinect-gui
//--------------------------------------------------------------
void ofApp::draw() {
    
    triangulation.reset();
	ofSetColor(255, 255, 255);
	
	if(pointcloud) { // was "bDrawPointCloud"
		easyCam.begin();
        if (maskPointcloud) {
            drawPointCloud(grayImage);
        } else {
            drawPointCloud();
        }
		easyCam.end();
	} else {
		// draw from the live kinect
		kinect.drawDepth(10, 10, 400, 300);
		kinect.draw(420, 10, 400, 300);
		
		grayImage.draw(10, 320, 400, 300);
		contourFinder.draw(10, 320, 400, 300);
		
#ifdef USE_TWO_KINECTS
		kinect2.draw(420, 320, 400, 300);
#endif
	}
    
    /*
	// draw instructions
	ofSetColor(255, 255, 255);
	stringstream reportStream;
    
    if(kinect.hasAccelControl()) {
        reportStream << "accel is: " << ofToString(kinect.getMksAccel().x, 2) << " / "
        << ofToString(kinect.getMksAccel().y, 2) << " / "
        << ofToString(kinect.getMksAccel().z, 2) << endl;
    } else {
        reportStream << "Note: this is a newer Xbox Kinect or Kinect For Windows device," << endl
		<< "motor / led / accel controls are not currently supported" << endl << endl;
    }
    
	reportStream << "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;

    if(kinect.hasCamTiltControl()) {
    	reportStream << "press UP and DOWN to change the tilt angle: " << angle << " degrees" << endl
        << "press 1-5 & 0 to change the led mode" << endl;
    }
    
	ofDrawBitmapString(reportStream.str(), 20, 652);
    */
    
    
    gui.draw();
}
コード例 #2
0
ファイル: ofApp.cpp プロジェクト: tq303/ALP
//--------------------------------------------------------------
void ofApp::update() {
	
	kinect.update();

	ofEnableAlphaBlending();
	
	//lets draw some graphics into our two fbos
    rgbaFbo.begin();
		drawPointCloud();
    rgbaFbo.end();
	  	
    rgbaFboFloat.begin();	
		drawPointCloud();		
	rgbaFboFloat.end();
}
コード例 #3
0
ファイル: ofApp.cpp プロジェクト: tq303/umbrella
//--------------------------------------------------------------
void ofApp::draw() {

	ofSetColor(255, 255, 255);

	cam.setPosition(ofVec3f(0, cameraUpDwn, cameraInOut));
	cam.begin();

	centreNode.draw();
	cam.draw();

	// draw line from cam to its lookat
	ofSetColor(0, 255, 255);
	ofVec3f v1 = cam.getGlobalPosition();
	ofVec3f v2 = centreNode.getGlobalPosition();
    ofLine(v1,v2);

	// points cloud
	drawPointCloud();

	cam.end();

	ofSetColor(255, 255, 255);

    gui.setPosition(1068, 10);
	gui.draw();

	ofSetColor(255, 255, 0);
}
コード例 #4
0
//--------------------------------------------------------------
void testGame::draw() {
	
	ofSetColor(255, 255, 255);
	
	if(bDrawPointCloud) {
		easyCam.begin();
		drawPointCloud();
		easyCam.end();
	} if(bDrawTrackerConfig){
		//drawConfig();
    
#ifdef USE_TWO_KINECTS
		kinect2.draw(420, 320, 400, 300);
#endif
	} if(bDrawGame){
        drawTracking();
    } else{
    
    }
	
	// 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);
}
コード例 #5
0
ファイル: PCM.cpp プロジェクト: Kaftan777ski/mapinect
	//--------------------------------------------------------------
	void PCM::draw() {
		ofResetColor();

		if(drawPC) {
			ofPushMatrix();
			ofTranslate(420, 320);
			// we need a proper camera class
			drawPointCloud();
			ofPopMatrix();
		}
		else {
			gKinect->drawDepth(0, 0, 640, 480);
			ofResetColor();
			ofPushMatrix();
			gModel->objectsMutex.lock();
			/*glTranslatef(320, 240, 0);
			glScalef(1, 1, 1);*/
			for (list<ModelObject*>::iterator iter = gModel->objects.begin();
				iter != gModel->objects.end(); iter++) {
					(*iter)->drawObject();
			}
			gModel->objectsMutex.unlock();

			ofPopMatrix();
		}
	}
コード例 #6
0
ファイル: testApp.cpp プロジェクト: AsherBond/ofxKinect
//--------------------------------------------------------------
void testApp::draw() {
	ofSetColor(255, 255, 255);
	if(drawPC){
		ofPushMatrix();
		ofTranslate(420, 320);
		// we need a proper camera class
		drawPointCloud();
		ofPopMatrix();
	}else{
		kinect.drawDepth(10, 10, 400, 300);
		kinect.draw(420, 10, 400, 300);

		grayImage.draw(10, 320, 400, 300);
		contourFinder.draw(10, 320, 400, 300);
	}
	

	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";
	ofDrawBitmapString(reportStream.str(),20,666);
}
コード例 #7
0
//--------------------------------------------------------------
void testApp::draw() {

    ofSetColor(255, 255, 255);
    ofPushMatrix() ;
    ofTranslate( guiWidth + 10 , 0 ) ;
    if(bDrawPointCloud) {
        easyCam.begin();
        drawPointCloud();
        easyCam.end();
    } else {
        // draw from the live kinect
        kinect.drawDepth(10, 10, 400, 300);
        kinect.draw(420, 10, 400, 300);


#ifdef USE_TWO_KINECTS
        kinect2.draw(420, 320, 400, 300);
#endif
    }

    ofPopMatrix() ;

    //to debug to the screen use
    //ofDrawBitmapString( "STRING" , x , y ) ;


}
コード例 #8
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);}
	
	
}
コード例 #9
0
ファイル: BlackBoxApp.cpp プロジェクト: grifotv/blackbox
void BlackBoxApp::draw() {
	toogleRGB();
	
	if(noEffects) return;
		
	ofPushMatrix();
	ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2);
	
	switch (drawMethod) {
		case 1:
			rotationPointCloud += (kbControlEase - rotationPointCloud)/ease;
			ofRotateY(rotationPointCloud);
			
			zoom += (kbZoom - zoom) / ease;
			ofScale(400 * zoom, 400 * zoom, 400 * zoom);
			drawPointCloud();
			break;
			
		case 2:
			zoom += (kbZoom - zoom) / ease;
			ofScale(400 * zoom, 400 * zoom, 400 * zoom);
			drawCircleCloud();
			break;
			
		case 3:
			ofScale(400, 400, 400);
			drawParticlesCloud();
			break;
			
		case 4:
			ofScale(1000, 1000, 1000);
			drawPixels();
			break;
			
		case 5:
			drawTriangleLines();
			break;
			
		case 6:
			drawLaser();
			break;
			
		case 7:
			drawContour();
			break;
			
		case 8:
			drawTriangleColor();
			break;
			
		case 9:
			drawTriangleBlue();
			break;
	}
	
	ofPopMatrix();
	
	ofSetColor(255, 255, 255);
	string showrgbString = "showRGB: "+ofToString(showRGB, 2);
}
コード例 #10
0
ファイル: ofApp.cpp プロジェクト: Dairaku/of_city
void testApp::draw() {
    // ドラッグで視線を変更できるように(ofEasyCam)
    easyCam.begin();
    //ポイントクラウドの描画
    drawPointCloud();
    easyCam.end();
}
コード例 #11
0
void KinectCloud::update() {
	
	// Kinect更新
	((testApp*)ofGetAppPtr())->kinect.update();
	((testApp*)ofGetAppPtr())->kinect.setCameraTiltAngle(gui.getValueI("angle"));
	
	
	if (((testApp*)ofGetAppPtr())->kinect.isFrameNew()) {
		
		kinectCam.setFromPixels(((testApp*)ofGetAppPtr())->kinect.getPixels(), 
								((testApp*)ofGetAppPtr())->kinectWidth, 
								((testApp*)ofGetAppPtr())->kinectHeight,
								OF_IMAGE_COLOR);
		
		kinectDepth.setFromPixels(((testApp*)ofGetAppPtr())->kinect.getDepthPixels(), 
								  ((testApp*)ofGetAppPtr())->kinectWidth, 
								  ((testApp*)ofGetAppPtr())->kinectHeight,
								  OF_IMAGE_GRAYSCALE);
	}
   
    //ポイントクラウド記録
	recordPointCloud();
    
    //Glow
	glow.begin();
    
    //ポイントクラウドの描画
	drawPointCloud();

    glow.end();
	glow.update();
	
	//GUI
	gui.update();
}
コード例 #12
0
void kinactorApp::draw()
{
    setFullScreen();
    
    switch (currentFormat) 
    {
        case kinactor:
            kinactorDraw();
            break;
        case debug:
            debugDraw();
            break;
        case cloud:
            ofPushMatrix();
            ofTranslate(420, 320);
            // we need a proper camera class
            drawPointCloud();
            ofPopMatrix();
        default:
            break;
    }
    
    // show interface?
    bShowInterface == true ? showInterface() : hideInterface();
}
コード例 #13
0
ファイル: PCM.cpp プロジェクト: Kaftan777ski/mapinect
//--------------------------------------------------------------
void PCM::draw() {
    CHECK_ACTIVE;

    ofResetColor();

    if(drawPC) {
        ofPushMatrix();
        ofTranslate(420, 320);
        // we need a proper camera class
        drawPointCloud();
        ofPopMatrix();
    }
    else {
        gKinect->getDepthTextureReference().draw(0, 0, -0.001f, KINECT_DEFAULT_WIDTH, KINECT_DEFAULT_HEIGHT);

        if(IsFeatureActive(FEATURE_SHOW_RGB))
        {
            ofEnableAlphaBlending();
            ofSetColor(255,255,255,128);
            calibratedTex.draw(0,0);
            ofDisableAlphaBlending();
        }

        ofResetColor();

        // Dibujar mesa y objetos detectados
        ofPushMatrix();
        {
            gModel->objectsMutex.lock();
            for (vector<ModelObjectPtr>::const_iterator it = gModel->getObjects().begin(); it != gModel->getObjects().end(); it++)
            {
                (*it)->drawObject();
            }
            gModel->objectsMutex.unlock();

        }
        {
            gModel->tableMutex.lock();
            if(gModel->getTable().get() != NULL)
                gModel->getTable()->draw();
            gModel->tableMutex.unlock();
        }

        ofPopMatrix();

        // dibujar Frustum en ventana de debug
        Frustum::debugDrawFrustum();

        for (map<int, DataTouch>::const_iterator t = touchPoints.begin(); t != touchPoints.end(); ++t)
        {
            ofVec3f s(getScreenCoords(t->second.getTouchPoint()));
            ofSetColor(kRGBBlue);
            ofCircle(s.x, s.y, 3, 4);
            ofSetColor(kRGBRed);
            ofDrawBitmapString(ofToString(t->first), s.x, s.y);
        }
    }
}
コード例 #14
0
ファイル: ofApp.cpp プロジェクト: Dairaku/of_city
void testApp::draw() {
    ofBackground(255, 255, 255);
    // ドラッグで視線を変更できるように(ofEasyCam)
    easyCam.begin();
    //ポイントクラウドの描画
    drawPointCloud();
    easyCam.end();
    cout << curVol << endl;
}
コード例 #15
0
ファイル: testApp.cpp プロジェクト: martimorta/of
//--------------------------------------------------------------
void testApp::draw() {

	ofSetColor(255, 255, 255);

    easyCam.begin();
    drawPointCloud();
    easyCam.end();

}
コード例 #16
0
void PointCloudViewer::draw()
{
    glCallList(background);

    glTranslatef(0, 0, 1.6);
    glScalef(0.4, 0.4, -0.4);

    drawPointCloud();
    drawUserSkeltons();
}
コード例 #17
0
ファイル: testApp.cpp プロジェクト: evsc/kinoctulus
//--------------------------------------------------------------
void testApp::positionPointCloud(){
    
    
    ofPushMatrix();
    {
        ofMultMatrix( oculusRift.getHeadsetOrientationMat() );
        drawPointCloud();
    }
    ofPopMatrix();
}
コード例 #18
0
//--------------------------------------------------------------
void testApp::draw() {


	// drawing the kinect system

	ofSetRectMode(OF_RECTMODE_CENTER);
	ofSetColor(255,255,255);
		ofPushMatrix();
			ofTranslate(kleft+kleftAdd, kup);
			drawPointCloud3(kleft+kleftAdd, kup);
		ofPopMatrix();

		ofPushMatrix();
			ofTranslate(kleft2+kleft2Add, kup2);
			drawPointCloud4(kleft2+kleft2Add, kup2);
		ofPopMatrix();
	
		ofPushMatrix();
			ofTranslate(kleft3+kleft3Add, kup3);
			drawPointCloud(kleft3+kleft3Add, kup3);
		ofPopMatrix();

		ofPushMatrix();
			ofTranslate(kleft4+kleft4Add, kup4);
			drawPointCloud5(kleft4+kleft4Add, kup4);
		ofPopMatrix();

		ofPushMatrix();
			ofTranslate(kleft5+kleft5Add, kup5);
			drawPointCloud2(kleft5+kleft5Add, kup5);
		ofPopMatrix();
		
		ofPushMatrix();
			ofTranslate(kleft6+kleft6Add, kup6);
			drawPointCloud6(kleft6+kleft6Add, kup6);
		ofPopMatrix();
	

	// draw instructions

	ofSetColor(255, 255, 255);
	stringstream reportStream;
	reportStream << "multiplier1 = " << multiplier1 << endl
				 << "screenRatio " << screenRatio << endl
				 << "kleft1 = " << kleft+kleftAdd << endl
				 << "kleft2 " << kleft2+kleft2Add << endl
				 << "kleft3 = " << kleft3+kleft3Add << endl
				 << "kleft4 " << kleft4+kleft4Add << endl
				 << "kleft5 = " << kleft5+kleft5Add << endl
				 << "kleft6 " << kleft6+kleft6Add << endl;
	ofDrawBitmapString(reportStream.str(),ofGetWidth()/2,200);


}
コード例 #19
0
ファイル: audMode.cpp プロジェクト: alexiswolfish/AiVDJ
//--------------------------------------------------------------
void audMode::draw() {
	
	//ofBackground(0);
	ofBackground(10);
	//ofSetColor(0, 0, 0);
	easyCam.begin();
	drawPointCloud();
	// draw from the live kinect
	//grayImage.draw(10, 320, 400, 300);
	//contourFinder.draw(10, 320, 400, 300);
	easyCam.end();	
}
コード例 #20
0
//--------------------------------------------------------------
void testApp::draw() {
	
	ofSetColor(255, 255, 255);
    
    easyCam.begin();
    if(!playing) {
        drawPointCloud();
    } else {
        if(meshRecorder.readyToPlay) {
            drawRecordedPointCloud();
        }
    }
    easyCam.end();
    
    if(!playing) {
        kinect.draw(10, 10, 400/4, 300/4);
        kinect.drawDepth(10, 320/4+10, 400/4, 300/4);
        grayImage.draw(10, 320/2, 400/4, 300/4);
        #ifdef USE_TWO_KINECTS
		kinect2.draw(420, 320, 400, 300);
        #endif
    }
  
    // Loadinf info:
    
    if(!meshRecorder.readyToPlay) {
        string l = ofToString(meshRecorder.FramesLoaded);
        string t = ofToString(meshRecorder.TotalFrames);
        myFont.drawString("loading... " + l + "/" + t,10, 612);
    }
    
	// draw instructions
	ofSetColor(255, 255, 255);
	stringstream reportStream;
    
    reportStream << "ofxKinectMeshRecording 0.1 :: welovecode " << ", fps: " << ofGetFrameRate() << endl
    << " " << endl
    << "r: START RECORDING" << endl
    << "s: STOP RECORDING" << endl
    << "l: LAST RECORDING / LIVE MODE" << endl
    << " " << endl
	<< "set near threshold " << nearThreshold << " (press: + -)" << endl
	<< "set far threshold " << farThreshold << " (press: < >) " << endl
	<< "press c to close the connection and o to open it again, connection is: " << kinect.isConnected()
	<< "press UP and DOWN to change the tilt angle: " << angle << " degrees" << endl
    << "SPACE Color Mode on/off" << endl;
	//ofDrawBitmapString(reportStream.str(),10,652);
    myFont.drawString(reportStream.str(), 10, 632);
    ofSetColor(255, 0, 0);
    myFont.drawString(saveTo,120, 20);

}
コード例 #21
0
//--------------------------------------------------------------
void testApp::draw() {
	
	ofSetColor(255, 255, 255);
	
	
		easyCam.begin();
		drawPointCloud();
		easyCam.end();
		
	// draw instructions
	ofSetColor(255, 255, 255);
	stringstream reportStream;
	    
}
コード例 #22
0
void pointCloudStitcher::draw(){
    if(bDrawPointCloud){
        cam.begin();
            drawPointCloud();
        cam.end();
    } else {
        // draw from the live kinect
        kinect[0].drawDepth(10, 10, 200, 150);
        kinect[1].drawDepth(210, 10, 200, 150);
        
        kinect[0].draw(10, 160, 200, 150); //rgb
        kinect[1].draw(210, 160, 200, 150); //rgb
    }
}
コード例 #23
0
ファイル: testApp.cpp プロジェクト: igoumeninja/WireFace
//--------------------------------------------------------------
void testApp::draw() {
	ofSetColor(rBack, gBack, bBack, aBack);
	ofRect(0,0,ofGetWidth(), ofGetHeight());

	
	if(bDrawPointCloud) {
		ofPushMatrix();
		ofTranslate(420, 320);
		ofScale(600, 600, 600);
		// we need a proper camera class
		drawPointCloud();
		ofPopMatrix();
	}
}
コード例 #24
0
void ThreeDWidget::paintGL() 
{

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glMatrixMode(GL_MODELVIEW);

	drawView();
	drawFloor();
	drawOriginal();
	//	drawSkeleton();
	drawPointCloud();
	if(_calibrated)
		drawCameras();
}
コード例 #25
0
ファイル: drawer_3d.cpp プロジェクト: ulyssesrr/carmen_lcad
void Drawer3D::draw()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    setView();


    if(drawAxesEnabled)
        drawAxes();


    glPointSize(pointSize);
    drawPointCloud();
    //glPointSize(1.0);

}
コード例 #26
0
//--------------------------------------------------------------
void TriangleKinectShader::draw() {

        
    if ( bToggleTrails )
    {
        glDisable( GL_DEPTH_TEST ) ; 
        ofSetColor( 0 , 0 , 0 ) ;
        ofRect( -1000, -1000 , 3000, 3000 ) ;
        trailFbo.begin () ;

        ofEnableAlphaBlending() ;
        ofSetColor( 0 , 0 , 0 , fboFadeAmount ) ;
        ofRect( -1000 , -1000 , 3000, 3000 ) ;

    }
    else
    {
        trailFbo.begin () ;
        ofClear( 1 , 1 , 1 , 0 ) ;
    }
    
    ofSetColor( 255 , 255 ,255 ) ;
    glEnable( GL_DEPTH_TEST ) ;
//    kinectMan->post.begin( cameraMan->cam ) ;
    cameraMan->begin();
    ofPushMatrix() ;
    ofTranslate(0 , 0 , cameraMan->zOffset ) ;
    drawPointCloud();
    ofPopMatrix();

    cameraMan->end() ; 
    //kinectMan->post.end() ;

    trailFbo.end() ;
    
    ofSetColor( 255 , 255 , 255 ) ;
    ofPushMatrix( ) ;
        ofTranslate( 0 , ofGetHeight() ) ;
        ofScale( 1 , -1 , 1 ) ;
        trailFbo.draw(0 , 0 ) ;
    /*
        ofEnableBlendMode(OF_BLENDMODE_ADD ) ;
        ofSetColor( 255 , 255 , 255 , redrawAlpha ) ;
        trailFbo.draw( 0 , 0 );*/
    ofPopMatrix( ) ;
}
コード例 #27
0
ファイル: testApp.cpp プロジェクト: wiedenkennedy/kinect-osc
//--------------------------------------------------------------
void testApp::draw() {
	
	ofSetColor(255, 255, 255);
	
	if(bDrawPointCloud) {
		easyCam.begin();
		drawPointCloud();
		easyCam.end();
	} else {
		// draw from the live kinect
		//kinect.drawDepth(10, 10, 400, 300);
		//kinect.draw(420, 10, 400, 300);
		
		kinect.draw(10, 10, 400, 300);
		
		//grayImage.draw(10, 320, 400, 300);
		grayImageA.draw(10, 320, 400, 300);
		contourFinderA.draw(10, 320, 400, 300);
		
#ifdef USE_TWO_KINECTS
		kinect2.draw(420, 10, 400, 300);
		//kinect2.draw(420, 320, 400, 300);
		grayImageB.draw(420, 320, 400, 300);
		//contourFinderA.draw(420, 320, 400, 300);
#endif
	}
	
	// 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
	<< "p = point cloud" << endl
	<< "space = toggle opencv threshold = " << bThreshWithOpenCV << endl
	<< "near threshold " << nearThreshold << " (press: + -)" << endl
	<< "far threshold " << farThreshold << " (press: < >)" << endl
	<< "num blobs found " << contourFinderA.blobs.size() << endl
	<< "fps: " << ofGetFrameRate() << endl
	<< "c/o close open conn: " << kinect.isConnected() << endl
	<< "UP/DOWN tilt angle: " << angle << " degrees" << endl
	<< "Closest Object: " << closestObject << endl;
	ofDrawBitmapString(reportStream.str(),20,652);
}
コード例 #28
0
//--------------------------------------------------------------
void testApp::draw() {

	ofSetColor(255, 255, 255);

	if(bDrawPointCloud) {
		easyCam.begin();
		drawPointCloud();
		easyCam.end();
	} else {
		// draw from the live kinect
		cvGrayImage1.draw(0, 0);
        cvGrayImage2.draw(kinect.width, 0);
//        kinect.draw(kinect.width, kinect.height);
//		  kinect.drawDepth(kinect.width, 0, 400, 300);

		// if two points are selected, draw a rectangle
        if(corners.size() == 2){
            ofNoFill();
            ofRect(corners[0].x, corners[0].y, corners[1].x - corners[0].x, corners[1].y - corners[0].y);
            cvSelectedNearImg.draw(0, kinect.height);
            cvSelectedFarImg.draw(cvSelectedNearImg.width, kinect.height);
            cvSubtractedImg.draw(cvSelectedNearImg.width * 2, kinect.height);
            contourFinder1.draw(0, kinect.height);
            contourFinder2.draw(cvSelectedNearImg.width, kinect.height);
//            contourFinder3.draw(cvSelectedNearImg.width * 2, kinect.height);
            if(gesture_lines.size() > 0){
                for(vector<ofPoint>::iterator blob_it = gesture_lines.begin(); blob_it != gesture_lines.end(); blob_it++){
                    ofSetColor(0, 255, 255);
                    ofFill();
                    ofCircle(blob_it->x + cvSelectedNearImg.width, blob_it->y + kinect.height, 10);
                }
            }
        }
	}

    // draw crosshair on cursor
    ofSetColor(255, 255, 255);
    ofSetLineWidth(2);
	ofLine(mousePt.x+10, mousePt.y, mousePt.x-10, mousePt.y);
	ofLine(mousePt.x, mousePt.y+10, mousePt.x, mousePt.y-10);

	// GUI
	gui.draw();
}
コード例 #29
0
//--------------------------------------------------------------
void testApp::draw() {
	    
	ofSetColor(255, 255, 255);
    ofPushMatrix() ; 
	ofTranslate( guiWidth + 10 , 0 ) ;
	if(bDrawPointCloud) {
        
        if ( bDrawShader )
        {
            shader.begin() ;
            //shader.setUniform1f("time", ofGetElapsedTimef() ) ;
            shader.setUniform1f("time", ofGetElapsedTimef() ) ;
            shader.setUniform1f("var1", shaderVar1 ) ;
            shader.setUniform1f("var2", shaderVar2 ) ;
            shader.setUniform1f("var3", shaderVar3 ) ;
            shader.setUniform1f("var4", shaderVar4 ) ;
        }
		easyCam.begin();
		drawPointCloud();
		easyCam.end();
        
        if ( bDrawShader )
            shader.end( ) ;
	} else {
		// draw from the live kinect
		kinect.drawDepth(10, 10, 400, 300);
		kinect.draw(420, 10, 400, 300);
		
		
#ifdef USE_TWO_KINECTS
		kinect2.draw(420, 320, 400, 300);
#endif
	}
    
    ofPopMatrix() ;
	
    //to debug to the screen use
    //ofDrawBitmapString( "STRING" , x , y ) ;
    
    
}
コード例 #30
0
//--------------------------------------------------------------
void KinectShaderScene::draw() {

    trailFbo.begin () ;

    if ( bToggleTrails )
    {

        ofEnableBlendMode(OF_BLENDMODE_ADD ) ;
        ofSetColor( 255 , 255 , 255 , redrawAlpha ) ;
        trailFbo.draw( 0 , 0 );

        ofEnableAlphaBlending() ;
        ofSetColor( 0 , 0 , 0, fboFadeAmount ) ;
        ofRect( 0 , 0,  getWidth() , getHeight() ) ;
    }
    else
    {
        ofClear( 1 , 1 , 1 , 0 ) ;
    }

    ofSetColor( 255 , 255 ,255 ) ;
    cameraMan->cam.begin() ;
    ofPushMatrix() ;
    ofTranslate(0 , 0 , cameraMan->zOffset ) ;
    drawPointCloud();
    ofPopMatrix();
    cameraMan->cam.end() ;
    trailFbo.end() ;

    ofSetColor( 255 , 255 , 255 ) ;
    ofPushMatrix( ) ;
    ofTranslate( 0 , ofGetHeight() ) ;
    ofScale( 1 , -1 , 1 ) ;
    trailFbo.draw(0 , 0 ) ;
    ofEnableBlendMode(OF_BLENDMODE_ADD ) ;
    ofSetColor( 255 , 255 , 255 , redrawAlpha ) ;
    trailFbo.draw( 0 , 0 );
    ofPopMatrix( ) ;
}