コード例 #1
0
bool DepthVisualizerInput::update(){
	bool isFrameNew = false;

	/*if(useKinect) {
		kinect.update();
		if(kinect.isFrameNew()) {
			isFrameNew = true;
			depthImage.setFromPixels(kinect.getDepthPixels(), camWidth, camHeight);
			depthImage.flagImageChanged();
		}
	} else */ {
		
		if(panel->getValueB("playbackPause") ) {
			animation.setPlaySpeed(0);
		} else {
			animation.setPlaySpeed(panel->getValueF("playSpeed"));
		}
		
		if(animation.isFrameNew()) {
			isFrameNew = true;
			ofImage& cur = animation.getAlpha();
			depthImage.setFromPixels(cur.getPixels(), cur.getWidth(), cur.getHeight());
			depthImage.flagImageChanged();
			colorPixels = animation.get().getPixels();
		}
	}
	
	if(isFrameNew) {
		thresholdDepthImage();
		buildPointCloud();
	}
	
	return isFrameNew;
}
コード例 #2
0
ファイル: VitalsModel.cpp プロジェクト: TLadd/SeniorDesign
/**
 * Grab a new frame and process it
 */
void VitalsModel::processFrame() {
	cout << "ProcessFrame";

	ImageBundle images = imGrab.getLatestImages();

	Mat threshDepth = thresholdDepthImage(images.getDepth());

	heartTracker.track(images.getColor(), threshDepth);

	breathTracker.track(images.getColor(), threshDepth);

	Rect forehead = getForeheadFromHead(heartTracker.getTrackedRegion());

	Mat foreheadDepth = threshDepth(forehead);

	imageTimer.expires_at(imageTimer.expires_at() + boost::posix_time::milliseconds(imInterval));
	imageTimer.async_wait(bind(&VitalsModel::processFrame, this));
}