Exemplo n.º 1
0
void Kinect::update() {
	
	plane.setFrom3Points(planeCoords[0], planeCoords[1], planeCoords[2]);
	
	// do the ofNode stuff
	applyTransformation();
	
	
	// actual processing
	if(running) {
		kinect.update();
		
		hasCreatedVertexArrays = false;
		


		doVision();
		
		
	}
}
Exemplo n.º 2
0
//--------------------------------------------------------------
void testApp::update(){
	if(clearAllVideos) {
		carousel.clearVideos();
		clearAllVideos = false;
	}
	if(saveAllVideos) {
		carousel.saveVideos();
		saveAllVideos = false;
	}
	ofBackground(0);

	carousel.checkForSize();
	
	doVision();
	doCompositing();
	activityMonitor.update(threshImg);
	presenceDetector.update(threshImg, false);// mouseIsDown);
	
	
	// if there's been no movement for a while, (and we're not recording)
	// start spinning the carousel
	if(!carousel.isScrolling() && activityMonitor.getTimeSinceLastMove()>carouselDelay && !recording) {
		printf("Activating carousel\n");
		carousel.autoScroll();
	} else {
		
		// decide whether to go back to the video feed
		if(activityMonitor.getTimeSinceLastMove()<carouselDelay && carousel.isScrolling()
		   && // allow the video to play for a while after recording.
		   ofGetElapsedTimef() - lastTimeFinishedRecording>minRecordingInterval
		   ) {
			carousel.scrollToVideoFeed();
			//printf("Creating space and going to end\n");
		}
		
		if(!presenceDetector.present()) {
			holdCount = 0;
		}

		if(!recording && presenceDetector.present() && carousel.isOnVideoFeed()) {
			holdCount++;
			if(holdCount>HOLD_COUNT) {
				video->clear();
				recording = true;
			}
		}

		// if we're still recording, but the user has lost touch,
		// stop recording
		if(recording && !presenceDetector.eitherHandPresent() && video->getLength()>MIN_VIDEO_LENGTH) {
			printf("Recording finished because user stepped away\n");
			finishedRecording();

		}
		
		if(recording) {
			// assemble composite
			
			bool stillCanRecord = video->record(videoFeedData);
			if(!stillCanRecord) {
				printf("Recording finished becasue it's maxed length\n");
				finishedRecording();
			}
		}
	}
	ofSetWindowTitle(ofToString(ofGetFrameRate(), 2));
}