Loading src/PointCloudManager.cpp +13 −3 Original line number Diff line number Diff line #include "PointCloudManager.h" void PointCloudManager::draw() void PointCloudManager::drawPointCloud() { //ofLog(OF_LOG_NOTICE) << "Drawing cloud point (" << pointCloud.getVertices().size() << ") points)"; ofPushMatrix(); Loading @@ -17,6 +17,14 @@ void PointCloudManager::draw() ofPopMatrix(); } void PointCloudManager::drawRGB(const ofRectangle& viewRect) { rgbTex.draw(viewRect); } void PointCloudManager::drawDepth(const ofRectangle& viewRect) { depthTex.draw(viewRect); } void PointCloudManager::updateRGB(RGBFrame::Ptr data) { rgbFrameSize.x = data->getCols(); Loading @@ -36,7 +44,7 @@ void PointCloudManager::updateRGB(RGBFrame::Ptr data) const int index = y * depthFrameSize.x + x; const int skippedIndex = (y / skip) * (depthFrameSize.x / skip) + (x / skip); pointCloud.setColor(skippedIndex, 10 * rgbPix.getColor(index)); pointCloud.setColor(skippedIndex, rgbPix.getColor(x, y)); } } } Loading Loading @@ -71,6 +79,8 @@ void PointCloudManager::createPointCloudIfNotExist(glm::vec2 dim) ofLog(OF_LOG_NOTICE) << "YOU ONLY SEE THIS ONCE"; pointCloud.setMode(OF_PRIMITIVE_POINTS); pointCloud.enableColors(); // Allocate pointCloud.clear(); int size = ceil(((float)dim.x / skip) * ((float)dim.y / skip)); Loading @@ -80,7 +90,7 @@ void PointCloudManager::createPointCloudIfNotExist(glm::vec2 dim) pointCloud.addVertices(p); vector<ofFloatColor> c; c.assign(size, ofFloatColor(0, 0, 0, 0.9)); c.assign(size, ofFloatColor(0, 0, 0, 1)); pointCloud.addColors(c); } } Loading src/PointCloudManager.h +5 −2 Original line number Diff line number Diff line Loading @@ -19,12 +19,15 @@ private: ofVboMesh pointCloud; const int skip = 2; const int skip = 4; void createPointCloudIfNotExist(glm::vec2 dim); public: void draw(); void drawPointCloud(); void drawRGB(const ofRectangle& viewRect); void drawDepth(const ofRectangle& viewRect); void updateRGB(RGBFrame::Ptr data); void updateDepth(DepthFrame::Ptr data); Loading src/ofApp.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -561,9 +561,9 @@ void ofApp::draw(){ //ofLogNotice() << "draw next frame"; if(bShowVisuals){ //Draw viewport previews // TODO: basic rgb & depth streams pointCloudManager.drawRGB(viewGrid[0]); pointCloudManager.drawDepth(viewGrid[1]); // TODO: These might all be useless //skeletonFinder.grayImage.draw(viewGrid[2]); //skeletonFinder.contourFinder.draw(viewGrid[3]); //skeletonFinder.maskFbo.draw(viewGrid[4]); Loading @@ -571,13 +571,11 @@ void ofApp::draw(){ switch (iMainCamera) { case 0: // TODO //realSense->drawDepthStream(viewMain); pointCloudManager.drawRGB(viewMain); drawCalibrationPoints(); break; case 1: // TODO //realSense->drawInfraLeftStream(viewMain); pointCloudManager.drawDepth(viewMain); drawCalibrationPoints(); break; case 2: Loading Loading @@ -668,7 +666,7 @@ void ofApp::drawPreview() { ofMultMatrix(deviceTransform); if (bPreviewPointCloud) { // TODO: what does this do pointCloudManager.draw(); pointCloudManager.drawPointCloud(); } ofFill(); ofSetColor(255, 0, 0); Loading Loading @@ -732,7 +730,7 @@ void ofApp::drawCapturePointCloud(bool _mask) { ofPushMatrix(); ofMultMatrix(deviceTransform); //realSense->draw(); pointCloudManager.draw(); pointCloudManager.drawPointCloud(); ofPopMatrix(); shader.end(); Loading Loading
src/PointCloudManager.cpp +13 −3 Original line number Diff line number Diff line #include "PointCloudManager.h" void PointCloudManager::draw() void PointCloudManager::drawPointCloud() { //ofLog(OF_LOG_NOTICE) << "Drawing cloud point (" << pointCloud.getVertices().size() << ") points)"; ofPushMatrix(); Loading @@ -17,6 +17,14 @@ void PointCloudManager::draw() ofPopMatrix(); } void PointCloudManager::drawRGB(const ofRectangle& viewRect) { rgbTex.draw(viewRect); } void PointCloudManager::drawDepth(const ofRectangle& viewRect) { depthTex.draw(viewRect); } void PointCloudManager::updateRGB(RGBFrame::Ptr data) { rgbFrameSize.x = data->getCols(); Loading @@ -36,7 +44,7 @@ void PointCloudManager::updateRGB(RGBFrame::Ptr data) const int index = y * depthFrameSize.x + x; const int skippedIndex = (y / skip) * (depthFrameSize.x / skip) + (x / skip); pointCloud.setColor(skippedIndex, 10 * rgbPix.getColor(index)); pointCloud.setColor(skippedIndex, rgbPix.getColor(x, y)); } } } Loading Loading @@ -71,6 +79,8 @@ void PointCloudManager::createPointCloudIfNotExist(glm::vec2 dim) ofLog(OF_LOG_NOTICE) << "YOU ONLY SEE THIS ONCE"; pointCloud.setMode(OF_PRIMITIVE_POINTS); pointCloud.enableColors(); // Allocate pointCloud.clear(); int size = ceil(((float)dim.x / skip) * ((float)dim.y / skip)); Loading @@ -80,7 +90,7 @@ void PointCloudManager::createPointCloudIfNotExist(glm::vec2 dim) pointCloud.addVertices(p); vector<ofFloatColor> c; c.assign(size, ofFloatColor(0, 0, 0, 0.9)); c.assign(size, ofFloatColor(0, 0, 0, 1)); pointCloud.addColors(c); } } Loading
src/PointCloudManager.h +5 −2 Original line number Diff line number Diff line Loading @@ -19,12 +19,15 @@ private: ofVboMesh pointCloud; const int skip = 2; const int skip = 4; void createPointCloudIfNotExist(glm::vec2 dim); public: void draw(); void drawPointCloud(); void drawRGB(const ofRectangle& viewRect); void drawDepth(const ofRectangle& viewRect); void updateRGB(RGBFrame::Ptr data); void updateDepth(DepthFrame::Ptr data); Loading
src/ofApp.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -561,9 +561,9 @@ void ofApp::draw(){ //ofLogNotice() << "draw next frame"; if(bShowVisuals){ //Draw viewport previews // TODO: basic rgb & depth streams pointCloudManager.drawRGB(viewGrid[0]); pointCloudManager.drawDepth(viewGrid[1]); // TODO: These might all be useless //skeletonFinder.grayImage.draw(viewGrid[2]); //skeletonFinder.contourFinder.draw(viewGrid[3]); //skeletonFinder.maskFbo.draw(viewGrid[4]); Loading @@ -571,13 +571,11 @@ void ofApp::draw(){ switch (iMainCamera) { case 0: // TODO //realSense->drawDepthStream(viewMain); pointCloudManager.drawRGB(viewMain); drawCalibrationPoints(); break; case 1: // TODO //realSense->drawInfraLeftStream(viewMain); pointCloudManager.drawDepth(viewMain); drawCalibrationPoints(); break; case 2: Loading Loading @@ -668,7 +666,7 @@ void ofApp::drawPreview() { ofMultMatrix(deviceTransform); if (bPreviewPointCloud) { // TODO: what does this do pointCloudManager.draw(); pointCloudManager.drawPointCloud(); } ofFill(); ofSetColor(255, 0, 0); Loading Loading @@ -732,7 +730,7 @@ void ofApp::drawCapturePointCloud(bool _mask) { ofPushMatrix(); ofMultMatrix(deviceTransform); //realSense->draw(); pointCloudManager.draw(); pointCloudManager.drawPointCloud(); ofPopMatrix(); shader.end(); Loading