int command_maskContent( int argc, char ** argv ) { if (argc < 1) ELISE_ERROR_EXIT("a *_polyg3d.ply file is needed"); const string maskFilename = argv[1]; cMasqBin3D *masqBin3D = cMasqBin3D::FromSaisieMasq3d(maskFilename); if (masqBin3D == NULL) ELISE_ERROR_EXIT("cannot load mask 3d file [" << maskFilename << "]"); Pt3dr bbP0, bbP1; if (argc >= 2) { const string plyFilename = argv[1]; getPlyBoundingBox(plyFilename, bbP0, bbP1); cout << "--- bounding box [" << bbP0 << ", " << bbP1 << ']' << endl; list<Pt3dr> inMaskPoints; makeGrid(bbP0, bbP1 - bbP0, 1000, *masqBin3D, inMaskPoints); cout << "--- " << inMaskPoints.size() << " points in mask" << endl; const string outputFilename = "maskContent.ply"; if ( !writePly(inMaskPoints, outputFilename)) ELISE_ERROR_EXIT("failed to write point cloud in [" << outputFilename << ']'); } delete masqBin3D; return EXIT_SUCCESS; }
void Kinect::writeDataContent(string filePathWithoutFilesuffix, int kinectDataContent) { if (kinectDataContent & KINECT_RGB) { string filePath; filePath = filePathWithoutFilesuffix + ".jpg"; if(!mRgb.empty()) imwrite(filePath,mRgb); } if (kinectDataContent & KINECT_ORI_DEPTH) { string filePath; filePath = filePathWithoutFilesuffix + ".png"; if(!mDepth.empty()) imwrite(filePath,mDepth); } if (kinectDataContent & KINECT_MONOCOLOR_DEPTH) { string filePath; filePath = filePathWithoutFilesuffix + "_md.jpg"; if(!mDepthMonoColor.empty()) imwrite(filePath,mDepthMonoColor); } if (kinectDataContent & KINECT_COLOR_DEPTH) { string filePath; filePath = filePathWithoutFilesuffix + "_cd.jpg"; if(!mDepthColorful.empty()) imwrite(filePath,mDepthColorful); } if (kinectDataContent & KINECTmPointCloud) { // smooth Depth frame(mDepth); //frame.smooth(); frame.smooth(); mDepth = frame.data(); // retrieve cloud retrievePointCloud(mDepth); #ifdef MODELTYPE_PLY writePly(mPointCloud, mRgb, filePathWithoutFilesuffix, 1000); #else writeObj(mPointCloud, filePathWithoutFilesuffix, 1000); #endif } }