Exemple #1
0
 void config( program_options::variables_map& params ){
     if ( params.count( "mms-token" ) ){
         _token = params["mms-token"].as<string>();
     }
     if ( params.count( "mms-name" ) ){
         _name = params["mms-name"].as<string>();
     }
     _secsToSleep = params["mms-interval"].as<int>();
 }
AbstractStereoBlockMatcher::AbstractStereoBlockMatcher(const program_options::variables_map &options)
    :  AbstractStereoMatcher(options)
{

    window_width = get_option_value<int>(options, "window_size");
    window_height = window_width;


    // window size has to be odd
    assert(window_width % 2 == 1);
    assert(window_height % 2 == 1);

    do_dumb_left_right_consistency_check = get_option_value<bool>(options, "left_right_consistency");
    left_right_disparity_tolerance = get_option_value<int>(options, "left_right_tolerance");

    // check exceptions ---
    {
        string stereo_method;
        if (options.count("method") != 0)
        {
            stereo_method = get_option_value<std::string>(options, "method");
        }
        else if (options.count("stereo.method") != 0)
        {
            stereo_method = get_option_value<std::string>(options, "stereo.method");
        }
	else if (options.count("cost_volume.method") != 0)
	  {
            stereo_method = get_option_value<std::string>(options, "cost_volume.method");
	  }
        else
        {
            throw std::invalid_argument("AbstractStereoBlockMatcher failed to find the stereo method");
        }

        if(stereo_method.find("simple_") == 0)
        {
            printf("Transfering left right consistency check to the algorithm implementation (not doing double calls)\n");
            // these methods implement the left right consistency check inside themselves
            do_dumb_left_right_consistency_check = false;
        }

    }


    interpolate_occluded_pixels = get_option_value<bool>(options, "interpolate_occluded_pixels");

    return;
}
void TestObjectsDetectionApplication::setup_problem(const program_options::variables_map &options)
{
    print_gpu_information();

    should_save_detections = get_option_value<bool>(options, "save_detections");

    const boost::filesystem::path configuration_filepath = get_option_value<std::string>(options, "configuration_file");

    bool use_ground_plane = false, use_stixels = false;

    if(options.count("video_input.images_folder") > 0)
    {
        printf("Application will use monocular input\n");
        use_ground_plane = false;
        use_stixels = false;

        const filesystem::path folder_to_process = get_option_value<string>(options, "video_input.images_folder");
        directory_input_p.reset(new ImagesFromDirectory(folder_to_process));
    }
    else
    {
#if defined(MONOCULAR_OBJECTS_DETECTION_LIB)
        throw std::invalid_argument("This executable does not support stereo input");
#else // MONOCULAR_OBJECTS_DETECTION_LIB is not defined
        printf("Application will use stereo input\n");
        // FIXME should enable using ground_plane only
        use_ground_plane = true;
        use_stixels = true;

        video_input_p.reset(VideoInputFactory::new_instance(options));
#endif // MONOCULAR_OBJECTS_DETECTION_LIB is defined or not
    }


    if(video_input_p and should_save_detections)
    {
        throw std::runtime_error("save_detections option is only available when using video_input.images_folder");
    }

    objects_detection::init_objects_detection(configuration_filepath, use_ground_plane, use_stixels);


    if((not directory_input_p) and (not video_input_p))
    {
        throw std::invalid_argument("Failed to initialize a video input module. "
                                    "No images to read, nothing to compute.");
    }

    return;
}
Exemple #4
0
    // returns true if the service is started.
    bool serviceParamsCheck( program_options::variables_map& params, const std::string dbpath, int argc, char* argv[] ) {
        bool installService = false;
        bool removeService = false;
        bool reinstallService = false;
        bool startService = false;

        std::wstring windowsServiceName = L"MongoDB";
        std::wstring windowsServiceDisplayName = L"Mongo DB";
        std::wstring windowsServiceDescription = L"Mongo DB Server";
        std::wstring windowsServiceUser = L"";
        std::wstring windowsServicePassword = L"";

        if (params.count("install")) {
            if ( ! params.count( "logpath" ) ) {
                cerr << "--install has to be used with --logpath" << endl;
                ::exit(-1);
            }
            installService = true;
        }
        if (params.count("reinstall")) {
            if ( ! params.count( "logpath" ) ) {
                cerr << "--reinstall has to be used with --logpath" << endl;
                ::exit(-1);
            }
            reinstallService = true;
        }
        if (params.count("remove")) {
            removeService = true;
        }
        if (params.count("service")) {
            startService = true;
        }

        if (params.count("serviceName")) {
            string x = params["serviceName"].as<string>();
            windowsServiceName = wstring(x.size(),L' ');
            for ( size_t i=0; i<x.size(); i++) {
                windowsServiceName[i] = x[i];
            }
        }
        if (params.count("serviceDisplayName")) {
            string x = params["serviceDisplayName"].as<string>();
            windowsServiceDisplayName = wstring(x.size(),L' ');
            for ( size_t i=0; i<x.size(); i++) {
                windowsServiceDisplayName[i] = x[i];
            }
        }
        if (params.count("serviceDescription")) {
            string x = params["serviceDescription"].as<string>();
            windowsServiceDescription = wstring(x.size(),L' ');
            for ( size_t i=0; i<x.size(); i++) {
                windowsServiceDescription[i] = x[i];
            }
        }
        if (params.count("serviceUser")) {
            string x = params["serviceUser"].as<string>();
            windowsServiceUser = wstring(x.size(),L' ');
            for ( size_t i=0; i<x.size(); i++) {
                windowsServiceUser[i] = x[i];
            }
        }
        if (params.count("servicePassword")) {
            string x = params["servicePassword"].as<string>();
            windowsServicePassword = wstring(x.size(),L' ');
            for ( size_t i=0; i<x.size(); i++) {
                windowsServicePassword[i] = x[i];
            }
        }

        if ( reinstallService ) {
            ServiceController::removeService( windowsServiceName );
        }
        if ( installService || reinstallService ) {
            if ( !ServiceController::installService( windowsServiceName , windowsServiceDisplayName, windowsServiceDescription, windowsServiceUser, windowsServicePassword, dbpath, argc, argv ) )
                dbexit( EXIT_NTSERVICE_ERROR );
            dbexit( EXIT_CLEAN );
        }
        else if ( removeService ) {
            if ( !ServiceController::removeService( windowsServiceName ) )
                dbexit( EXIT_NTSERVICE_ERROR );
            dbexit( EXIT_CLEAN );
        }
        else if ( startService ) {
            if ( !ServiceController::startService( windowsServiceName , mongo::initService ) )
                dbexit( EXIT_NTSERVICE_ERROR );
            return true;
        }
        return false;
    }