//-------------------------------------------------------------- void ArmCalibration::setup() { ofSetWindowTitle("arm calibration"); LoadFeatures(); gKinect = new ofxKinect(); if (IsFeatureKinectActive()) { MAX_Z = 4.0f; double fx_d, fy_d, fx_rgb, fy_rgb; float cx_d, cy_d, cx_rgb, cy_rgb; ofVec3f T_rgb; ofMatrix4x4 R_rgb; getKinectCalibData("data/calib/kinect-calib-27May.yml", fx_d, fy_d, cx_d, cy_d, fx_rgb, fy_rgb, cx_rgb, cy_rgb, T_rgb, R_rgb); gKinect->getCalibration().setCalibValues( fx_d, fy_d, cx_d, cy_d, fx_rgb, fy_rgb, cx_rgb, cy_rgb, T_rgb, R_rgb); gKinect->init(); gKinect->setVerbose(true); gKinect->open(); } arduino.setup(); }
void MayaPlugin::Load(MObject& pluginObject) { char finalVersionStr[256]; #ifdef WIN32 sprintf_s(finalVersionStr, sizeof(finalVersionStr), "%s, %s @ %s", m_versionString.asChar(), __DATE__, __TIME__); #else sprintf(finalVersionStr, "%s, | %s @ %s", m_versionString.asChar(), __DATE__, __TIME__); #endif MFnPlugin plugin(pluginObject, m_authorString.asChar(), finalVersionStr, "Any"); LoadFeatures(plugin); }
/** Constructor */ CSeqFeature::CSeqFeature() :seqfeature_verbosity(0), maxDuration(0), minDuration(0), numOfSeq(0), numOfAllSeq(0), featureDimension(0), featureFile(""), nnz(0), density(0) { CTimer loadfeaturetime; // decide the format string to use if(sizeof(Scalar) == sizeof(double)) { svec_feature_index_and_value_format = "%d:%lf"; scalar_value_format = "%lf"; } else { svec_feature_index_and_value_format = "%d:%f"; scalar_value_format = "%f"; } // get configurations Configuration &config = Configuration::GetInstance(); featureFile = config.GetString("Data.featureFile"); if(config.IsSet("Data.verbosity")) seqfeature_verbosity = config.GetInt("Data.verbosity"); // read dataset into memory if(seqfeature_verbosity >= 1) std::cout << "Loading feature file... "<< std::endl; loadfeaturetime.Start(); LoadFeatures(); loadfeaturetime.Stop(); // in centralized dataset, serial computation mode numOfAllSeq = numOfSeq; if(seqfeature_verbosity >= 2) { std::cout << "loadfeaturetime : " << loadfeaturetime.CPUTotal() << std::endl; } }
int main(int argc, char** argv) { std::string p_feature_img = ""; std::string p_density = ""; std::string p_fn_points = ""; std::string p_out = ""; unsigned p_num = 250; bool p_verbose = false; unsigned p_repetitions = 1; bool p_error = false; bool p_save_density = true; // parameters asp::Parameters params = asp::parameters_default(); namespace po = boost::program_options; po::options_description desc; desc.add_options() ("help", "produce help message") ("features", po::value(&p_feature_img), "feature image (leave empty for uniform image)") ("density", po::value(&p_density), "density function image (leave empty for test function)") ("points", po::value(&p_fn_points), "file with points to use as seeds (for DDS)") ("out", po::value(&p_out), "filename of result file with samples points") ("num", po::value(&p_num), "number of points to sample") ("p_num_iterations", po::value(¶ms.num_iterations), "number of DALIC iterations") ("p_pds_mode", po::value(¶ms.pds_mode), "Poisson Disk Sampling method") ("p_seed_mean_radius_factor", po::value(¶ms.seed_mean_radius_factor), "size factor for initial cluster mean feature") ("p_coverage", po::value(¶ms.coverage), "DALIC cluster search factor") ("p_weight_compact", po::value(¶ms.weight_compact), "weight for compactness term") ("verbose", po::value(&p_verbose), "verbose") ("repetitions", po::value(&p_repetitions), "repetitions") ("error", po::value(&p_error), "error") ("save_density", po::value(&p_save_density), "save_density") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); if(vm.count("help")) { std::cerr << desc << std::endl; return 1; } // load bool is_features_null = p_feature_img.empty(); bool is_density_null = p_density.empty(); Eigen::MatrixXf rho; std::vector<Eigen::Vector3f> features; int width = -1, height = -1; if(is_density_null && is_features_null) { std::cerr << "ERROR feature or density must not be both empty!" << std::endl; return 1; } if(!is_features_null) { features = LoadFeatures(p_feature_img, width, height); if(p_verbose) std::cout << "Loaded features dim=" << width << "x" << height << "." << std::endl; } if(!is_density_null) { rho = density::LoadDensity(p_density); if(p_verbose) std::cout << "Loaded density dim=" << rho.rows() << "x" << rho.cols() << ", sum=" << rho.sum() << "." << std::endl; } if(is_features_null) { width = rho.rows(); height = rho.cols(); features.resize(width*height, Eigen::Vector3f{1,1,1}); if(p_verbose) std::cout << "Created uniform features dim=" << rho.rows() << "x" << rho.cols() << "." << std::endl; } if(is_density_null) { //rho = CreateDensity(p_size, p_size, [](float x, float y) { return TestDensityFunction(x,y); } ); rho = CreateDensity(width, height, [](float x, float y) { return 1.0f; } ); if(p_verbose) std::cout << "Created density dim=" << rho.rows() << "x" << rho.cols() << ", sum=" << rho.sum() << "." << std::endl; } assert(width == rho.rows()); assert(height == rho.cols()); std::vector<Eigen::Vector2f> seed_points; if(!p_fn_points.empty()) { std::ifstream ifs(p_fn_points); if(!ifs.is_open()) { std::cerr << "Error opening file '" << p_fn_points << "'" << std::endl; } std::string line; while(getline(ifs, line)) { std::istringstream ss(line); std::vector<float> q; while(!ss.eof()) { float v; ss >> v; q.push_back(v); } seed_points.push_back({q[0], q[1]}); } }