int main (int argc, char* argv []) { ntk::arg_base::set_help_option("-h"); ntk::arg_parse(argc, argv); ntk::ntk_debug_level = cmd::debug_level(); cv::setBreakOnError(true); QApplication app (argc, argv); pcl::console::setVerbosityLevel (pcl::console::L_DEBUG); RGBDCalibration calibration; calibration.loadFromFile(cmd::calibration_file()); OpenniRGBDProcessor processor; RGBDImage image1 (cmd::input_image1(), &calibration, &processor); RGBDImage image2 (cmd::input_image2(), &calibration, &processor);; MeshGenerator generator; generator.setMeshType(MeshGenerator::TriangleMesh); generator.setUseColor(true); generator.generate(image1); global::mesh1 = generator.mesh(); global::mesh1.computeNormalsFromFaces(); generator.generate(image2); global::mesh2 = generator.mesh(); global::mesh2.computeNormalsFromFaces(); ntk_dbg(0) << "============ ALIGN WITH ICP ============"; alignWithICP(image1, image2); ntk_dbg(0) << "============ ALIGN WITH LEVENBERG ICP ============"; alignWithLevenbergICP(image1, image2); ntk_dbg(0) << "============ ALIGN WITH RGBD ============"; alignWithRGBD(image1, image2); ntk_dbg(0) << "============ ALIGN WITH RGBD THEN ICP ============"; alignWithRGBDThenICP(image1, image2); ntk_dbg(0) << "============ ALIGN WITH RGBD-ICP ============"; alignWithRGBDICP(image1, image2); global::mesh1.normals.clear(); global::mesh1.saveToPlyFile("debug_mesh1.ply"); global::mesh2.normals.clear(); global::mesh2.saveToPlyFile("debug_mesh2.ply"); return 0; }
int main(int argc, char** argv) { // Parse command line arguments. arg_base::set_help_option("-h"); arg_parse(argc, argv); ntk::ntk_debug_level = 1; RGBDCalibration* calib = 0; if (opt::calibration_file()) { calib = new RGBDCalibration(); calib->loadFromFile(opt::calibration_file()); } RGBDImage image1; image1.loadFromDir(opt::image1(), calib); RGBDImage image2; image2.loadFromDir(opt::image2(), calib); RGBDProcessor rgbd_processor; rgbd_processor.setFilterFlag(RGBDProcessor::ComputeKinectDepthBaseline, true); rgbd_processor.processImage(image1); rgbd_processor.processImage(image2); FeatureSetParams feature_params(opt::detector(), opt::extractor(), true); FeatureSet features1; { TimeCount tc_extract("Extract keypoints"); features1.extractFromImage(image1, feature_params); tc_extract.stop(); ntk_dbg_print(features1.locations().size(), 1); cv::Mat3b display_image1; features1.draw(image1.rgb(), display_image1); imshow("feature points 1", display_image1); imwrite("debug_features_1.png", display_image1); } FeatureSet features2; { TimeCount tc_extract("Extract keypoints"); features2.extractFromImage(image2, feature_params); tc_extract.stop(); ntk_dbg_print(features2.locations().size(), 1); cv::Mat3b display_image2; features2.draw(image2.rgb(), display_image2); imshow("feature points 1", display_image2); imwrite("debug_features_1.png", display_image2); } std::vector<DMatch> matches; features1.matchWith(features2, matches, opt::match_threshold()); ntk_dbg_print(matches.size(), 1); cv::Mat3b display_image; features1.drawMatches(image1.rgb(), image2.rgb(), features2, matches, display_image); imshow("matches", display_image); while ((waitKey(0) & 0xff) != 27) ; }