コード例 #1
0
void processCommand(int argc, char** argv, Arguments* args) {
    int i;
    int param_num = 0;

    /******* Set up default values *******/

    args->imageDir     = NULL;
    args->graphDir     = NULL;
    args->outputDir    = NULL;
    args->imageFile       = NULL;
    args->masksFile       = NULL;

    debuglevel = 0;

    /******* Read command line arguments *******/

    for (i = 1;i < argc;i++) {

        /* Catch common help requests */
        if      (readOption      (argc, argv, &i, "-help" )) { usage(argv[0]); }
        else if (readOption      (argc, argv, &i, "--help")) { usage(argv[0]); }

        /* other flags */
        else if (readOption    (argc, argv, &i, "-quiet")) { quiet = 1; }
        else if (readOption    (argc, argv, &i, "-dcfree")) { WiskottDCFree = 1.0; }
        else if (readOptionInt (argc, argv, &i, "-debuglevel", &debuglevel)) {}

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i)) {}

        /* read required arguments */
        else if (param_num == 0) {
            args->imageFile = argv[i];
            param_num++;
        }
        else if (param_num == 1) {
            args->imageDir = argv[i];
            param_num++;
        }
        else if (param_num == 2) {
            args->graphDir = argv[i];
            param_num++;
        }
        else if (param_num == 3) {
            args->masksFile = argv[i];
            param_num++;
        }
        else if (param_num == 4) {
            args->outputDir = argv[i];
            param_num++;
        }
        else{ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    }

    /* make sure that there are the proper number of required arguments */
    if (param_num != 5){ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    DEBUG(1,"Debuging enabled");
}
コード例 #2
0
void process_command(int argc, char** argv, Arguments* args)
{
    int i;
    int param_num = 0;

    /******* Set up default values *******/

    args->mode = octaveFormat;

    quiet = 0;
    debuglevel = 0;

    for (i = 1; i < argc; i++) {

        /* Catch common help requests */
        if      (readOption       (argc, argv, &i, "-help" )) {
            usage(argv[0]);
        }
        else if (readOption       (argc, argv, &i, "--help")) {
            usage(argv[0]);
        }

        /* other flags */
        else if (readOption       (argc, argv, &i, "-quiet")) {
            quiet = 1;
        }
        else if (readOptionInt    (argc, argv, &i, "-debuglevel", &debuglevel));
        else if (readOption       (argc, argv, &i, "-matlab")) {
            args->mode = matlabFormat;
        }

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i));

        else if (param_num == 0) {
            args->trainingFile = strdup(argv[i]);
            param_num++;
        }
    }

    if (param_num < 1)
        usage (argv[0]);

    /* Print out the program parameters for appropriate debug level */

    DEBUG_INT (1, "Debuging enabled", debuglevel);

    if (debuglevel > 0)
    {
        printf ("***************** Program Parameters *********************\n");
        printf ("trainingFile: %s\n", args->trainingFile);
    }
}
コード例 #3
0
ファイル: csuEBGMMasks.c プロジェクト: MBrauna/Biometria
void processCommand(int argc, char** argv, Arguments* args) {
    int i;
    int param_num = 0;

    debuglevel = 0;

    /******* Read command line arguments *******/

    for (i = 1;i < argc;i++) {

        /* Catch common help requests */
        if      (readOption      (argc, argv, &i, "-help" )) { usage(argv[0]); }
        else if (readOption      (argc, argv, &i, "--help")) { usage(argv[0]); }

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i)) {}

        /* read required arguments */
        else if (param_num == 0) {
            args->maskFile = argv[i];
            param_num++;
        }
        else if (param_num == 1) {
            args->outputDir = argv[i];
            param_num++;
        }
        else{ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    }

    /* make sure that there are the proper number of required arguments */
    if (param_num != 2){ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    /* Print out the program parameters for appropreate debug level */

    DEBUG(1,"Debuging enabled");
}
コード例 #4
0
void processCommand(int argc, char** argv, Arguments* args) {
    int i;
    int param_num = 0;

    args->imageList      = NULL;
    args->maskFile       = NULL;
    args->inputDir       = NULL;
    args->sfiDir         = NULL;
    
    args->gridStartX     = GRID_START_X;
    args->gridStartY     = GRID_START_Y;
    args->gridSpaceX     = GRID_SPACE_X;
    args->gridSpaceY     = GRID_SPACE_Y;

    args->saveMasks      = 1;

    quiet = 0;
    debuglevel = 0;

    /******* Read command line arguments *******/

    for (i = 1;i < argc;i++) {

        /* Catch common help requests */
        if      (readOption      (argc, argv, &i, "-help" )) { usage(argv[0]); }
        else if (readOption      (argc, argv, &i, "--help")) { usage(argv[0]); }

        /* size parameters */
        else if (readOptionInt2(argc, argv, &i, "-gridStart",&(args->gridStartX),&(args->gridStartY))) { }
        else if (readOptionInt2(argc, argv, &i, "-gridSpace",&(args->gridSpaceX),&(args->gridSpaceY))) { }

        /* other flags */
        else if (readOption    (argc, argv, &i, "-quiet")) { quiet = 1; }
        else if (readOptionInt (argc, argv, &i, "-debuglevel", &debuglevel)) {}

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i)) {}

        /* read required arguments */
        else if (param_num == 0) {
            args->inputDir = argv[i];
            param_num++;
        }
        else if (param_num == 1) {
            args->imageList = argv[i];
            param_num++;
        }
        else if (param_num == 2) {
            args->sfiDir = argv[i];
            param_num++;
        }
        else if (param_num == 3) {
            args->maskFile = argv[i];
            param_num++;
        }
        else{ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    }

    /* make sure that there are the proper number of required arguments */
    if (param_num != 4){ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    /* Print out the program parameters for appropreate debug level */

    DEBUG(1,"Debuging enabled");
}
コード例 #5
0
ファイル: csuEBGMGraphFit.c プロジェクト: MBrauna/Biometria
void processCommand(int argc, char** argv, Arguments* args) {
    int i;
    int param_num = 0;

    /******* Set up default values *******/

    args->imageDir     = NULL;
    args->graphDir     = NULL;
    args->outputDir    = NULL;
    args->modelFile       = NULL;
    args->novelFile       = NULL;
    args->masksFile       = NULL;

    args->bunchSize       = 70;

    debuglevel = 0;

    /******* Read command line arguments *******/

    for (i = 1;i < argc;i++) {

        /* Catch common help requests */
        if      (readOption      (argc, argv, &i, "-help" )) { usage(argv[0]); }
        else if (readOption      (argc, argv, &i, "--help")) { usage(argv[0]); }

        else if (readOptionInt (argc, argv, &i, "-bunchSize", &args->bunchSize)) {}
        /* other flags */
        else if (readOption    (argc, argv, &i, "-quiet")) { quiet = 1; }
         else if (readOption    (argc, argv, &i, "-dcfree")) { WiskottDCFree = 1.0; }
       else if (readOptionInt (argc, argv, &i, "-debuglevel", &debuglevel)) {}

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i)) {}

        /* read required arguments */
        else if (param_num == 0) {
            args->modelFile = argv[i];
            param_num++;
        }
        else if (param_num == 1) {
            args->novelFile = argv[i];
            param_num++;
        }
        else if (param_num == 2) {
            args->masksFile = argv[i];
            param_num++;
        }
        else if (param_num == 3) {
            args->imageDir = argv[i];
            param_num++;
        }
        else if (param_num == 4) {
            args->graphDir = argv[i];
            param_num++;
        }
        else if (param_num == 5) {
            if      (strcasecmp(argv[i],"DEGridSample") == 0) { args->dispEst = DEGridSample; }
            else if (strcasecmp(argv[i],"DEPredictiveStep") == 0) { args->dispEst = DEPredictiveStep; }
            else if (strcasecmp(argv[i],"DEPredictiveIter") == 0) { args->dispEst = DEPredictiveIter; }
            else if (strcasecmp(argv[i],"DEFixedLocalSearch") == 0) { args->dispEst = DEFixedLocalSearch; }
            else if (strcasecmp(argv[i],"DENarrowingLocalSearch") == 0) { args->dispEst = DENarrowingLocalSearch; }
            else{ clParseError(argc,argv,i,"Unknown Distance Estimator"); }
            param_num++;
        }
        else if (param_num == 6) {
            args->outputDir = argv[i];
            param_num++;
        }
        else{ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    }

    /* make sure that there are the proper number of required arguments */
    if (param_num != 7){ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    DEBUG(1,"Debuging enabled");
}
コード例 #6
0
void processCommand(int argc, char** argv, Arguments* args) {
    int i;
    int param_num = 0;

    /******* Set up default values *******/
    args->geoType      = CL_YES;
    args->histType     = HIST_POST;
    args->nrmType      = CL_YES;
    args->preNormType  = CL_NO;
    args->maskType     = CL_YES;
    args->preEdge      = EDGE_PRE;
    args->postEdge     = EDGE_POST;

    args->sizeWidth    = SIZE_WIDTH;
    args->sizeHeight   = SIZE_HEIGHT;

    args->eyeLx        = EYE_LX;
    args->eyeLy        = EYE_LY;
    args->eyeRx        = EYE_RX;
    args->eyeRy        = EYE_RY;

    args->scale        = SCALE;
    args->noise        = NOISE;
    args->shiftX       = SHIFT_X;
    args->shiftY       = SHIFT_Y;
    args->reflect      = CL_NO;
    args->configSuffix = CL_NO;

    args->ellipseX     = ELLIPSE_X;
    args->ellipseY     = ELLIPSE_Y;
    args->ellipseA     = ELLIPSE_A;
    args->ellipseB     = ELLIPSE_B;

    args->inputDir     = NULL;
    args->nrmDir       = NULL;
    args->sfiDir       = NULL;
    args->pgmDir       = NULL;

    debuglevel = 0;

    /******* Read command line arguments *******/

    for (i = 1;i < argc;i++) {

        /* Catch common help requests */
        if      (readOption      (argc, argv, &i, "-help" )) { usage(argv[0]); }
        else if (readOption      (argc, argv, &i, "--help")) { usage(argv[0]); }

        /******* Read in output directories *******/
        else if (readOptionString(argc, argv, &i, "-nrm", &(args->nrmDir))){ }
        else if (readOptionString(argc, argv, &i, "-sfi", &(args->sfiDir))){ }
        else if (readOptionString(argc, argv, &i, "-pgm", &(args->pgmDir))){ }

        /* read in shift option */
        else if (readOptionDouble2(argc, argv, &i, "-shift", &(args->shiftX), &(args->shiftY))) { }
        /******* Read in normalization options *******/
        /* Mask parameters */
        else if (readOptionDouble4(argc, argv, &i, "-mask-param", &(args->ellipseX), &(args->ellipseY), &(args->ellipseA), &(args->ellipseB))) { }
        else if (readOptionYesNo(argc, argv, &i, "-mask", &(args->maskType))) { }

        /* size parameters */
        else if (readOptionInt2(argc, argv, &i, "-size",&(args->sizeWidth),&(args->sizeHeight))) { }

        /* geometric parameters */
        else if (readOptionDouble4(argc, argv, &i, "-eye-target", &(args->eyeLx), &(args->eyeLy),  &(args->eyeRx), &(args->eyeRy))) { }
        else if (readOptionYesNo  (argc, argv, &i, "-geometric",&(args->geoType))) { }
        else if (readOptionYesNo  (argc, argv, &i, "-reflect"  ,&(args->reflect))) { }
        else if (readOption       (argc, argv, &i, "-half")) { args->scale = 0.5; }
        else if (readOptionDouble (argc, argv, &i, "-scale", &(args->scale))) { }        

        /* histogram parameters */
        else if (readOptionMatch(argc, argv, &i, "-hist", "NONE")) { args->histType   = HIST_NONE; }
        else if (readOptionMatch(argc, argv, &i, "-hist", "PRE" )) { args->histType   = HIST_PRE;  }
        else if (readOptionMatch(argc, argv, &i, "-hist", "POST")) { args->histType   = HIST_POST; }

        /* Image Edge Smoothing */
        else if (readOptionInt (argc, argv, &i, "-preEdge", &args->preEdge)) {}
        else if (readOptionInt (argc, argv, &i, "-postEdge", &args->postEdge)) {}

        /* Turn on noise */
        else if (readOptionDouble(argc, argv, &i, "-noise", &(args->noise))) { }

        /* Turn of ZeroMeanOneStdDev */
        else if (readOptionYesNo(argc, argv, &i, "-pixelNorm", &args->nrmType)) { }

        /* Turn of ZeroMeanOneStdDev */
        else if (readOptionYesNo(argc, argv, &i, "-preNorm", &args->preNormType)) { }

        /* Turn on file name configuration encoding */
        else if (readOption(argc, argv, &i, "-configSuffix")) { args->configSuffix = CL_YES; }

        /* other flags */
        else if (readOption    (argc, argv, &i, "-quiet")) { quiet = 1; }
        else if (readOptionInt (argc, argv, &i, "-debuglevel", &debuglevel)) {}

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i)) {}

        /* read required arguments */ 
        else if (param_num == 0) {
            args->eyeFile = argv[i];
            param_num++;
        }
        else if (param_num == 1) {
            args->inputDir = argv[i];
            param_num++;
        }
        else{ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    }

    /* make sure that there are the proper number of required arguments */
    if (param_num != 2){ clParseError(argc,argv,i,"Wrong number of required arguments"); }

    /* Print out the program parameters for appropreate debug level */
    DEBUG_CHECK(args->nrmDir || args->pgmDir || args->sfiDir,"You must specify at least one output directory.");

    DEBUG(1,"Debuging enabled");
    if(debuglevel > 0){
        printf("***************** Program Parameters *********************\n");
        printf("Eye coordinates file: %s\n", args->eyeFile ? args->eyeFile : "NONE");
        printf("Input directory:      %s\n", args->inputDir ? args->inputDir : "NONE");
        printf("nrm   directory:      %s\n", args->nrmDir ? args->nrmDir : "NONE");
        printf("sfi   directory:      %s\n", args->sfiDir ? args->sfiDir : "NONE");
        printf("pgm   directory:      %s\n", args->pgmDir ? args->pgmDir : "NONE");
        printf("Output Size:          %dX%d\n", args->sizeWidth, args->sizeHeight);
        printf("Geometric Norm:       %s\n", args->geoType ? "YES" : "NO");
        printf("Eye Target:           (%0.2f %0.2f %0.2f %0.2f)\n", args->eyeLx, args->eyeLy, args->eyeRx, args->eyeRy);
        printf("Histogram Norm:       %d\n", args->histType);
        printf("Value Norm:           %s\n", args->nrmType ? "YES" : "NO");
        printf("Apply Mask:           %s\n", args->maskType ? "YES" : "NO");
        printf("Mirror Reflect:       %s\n", args->reflect ? "YES" : "NO");
        printf("Config Suffix:        %s\n", args->configSuffix ? "YES" : "NO");
        printf("Mask Parameters:      (%0.2f %0.2f %0.2f %0.2f)\n", args->ellipseX, args->ellipseY, args->ellipseA, args->ellipseB);
    }    
}
コード例 #7
0
void processCommand(int argc, char** argv, Arguments* args) {
    int i;
    int param_num = 0;

    /******* Set up default values *******/

    args->argv         	 = argv;
    args->argc         	 = argc;
    args->imageNamesFile = NULL;
    args->faceGraphDir   = NULL;
    args->distList       = NULL;

    debuglevel = 0;

    /******* Read command line arguments *******/

    for (i = 1; i < argc; i++) {

        /* Catch common help requests */
        if      (readOption      (argc, argv, &i, "-help" )) {
            usage(argv[0]);
        }
        else if (readOption      (argc, argv, &i, "--help")) {
            usage(argv[0]);
        }

        /* other flags */
        else if (readOption    (argc, argv, &i, "-quiet")) {
            quiet = 1;
        }
        else if (readOptionInt (argc, argv, &i, "-debuglevel", &debuglevel)) {}

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i)) {}

        /* read required arguments */
        else if (param_num == 0) {
            args->imageNamesFile = argv[i];
            param_num++;
        }
        else if (param_num == 1) {
            args->faceGraphDir = argv[i];
            param_num++;
        }
        else if (param_num > 1) {
            DistDirNode* tmp = (DistDirNode*) malloc(sizeof(DistDirNode));
            tmp->next = args->distList;
            if      ( strcasecmp(argv[i], "FGMagnitude") == 0 )           {
                tmp->distMeasure = fgSimMagnitude;
            }
            else if ( strcasecmp(argv[i], "FGPhase") == 0 )               {
                tmp->distMeasure = fgSimPhase;
            }
            else if ( strcasecmp(argv[i], "FGGridSample") == 0 )          {
                tmp->distMeasure = fgSimPhaseGridSample;
            }
            else if ( strcasecmp(argv[i], "FGPredictiveStep") == 0 )      {
                tmp->distMeasure = fgSimPhasePredictiveStep;
            }
            else if ( strcasecmp(argv[i], "FGPredictiveIter") == 0 )      {
                tmp->distMeasure = fgSimPhasePredictiveIter;
            }
            else if ( strcasecmp(argv[i], "FGFixedLocalSearch") == 0 )    {
                tmp->distMeasure = fgSimPhaseFixedLocalSearch;
            }
            else if ( strcasecmp(argv[i], "FGNarrowingLocalSearch") == 0 ) {
                tmp->distMeasure = fgSimPhaseNarrowingLocalSearch;
            }
            else if ( strcasecmp(argv[i], "GeoSimL2") == 0 )              {
                tmp->distMeasure = GeometrySimL2;
            }
            else if ( strcasecmp(argv[i], "GeoSimCorrelation") == 0 )     {
                tmp->distMeasure = GeometrySimCorrelation;
            }
            else if ( strcasecmp(argv[i], "GeoSimLeastSquares") == 0 )    {
                tmp->distMeasure = GeometrySimLeastSquares;
            }
            else if ( strcasecmp(argv[i], "GeoSimLeastSquaresPS") == 0 )  {
                tmp->distMeasure = GeometrySimLeastSquaresPS;
            }
            else if ( strcasecmp(argv[i], "GeoSimLeastSquaresPI") == 0 )  {
                tmp->distMeasure = GeometrySimLeastSquaresPI;
            }
            else if ( strcasecmp(argv[i], "GeoSimLeastSquaresFLS") == 0 ) {
                tmp->distMeasure = GeometrySimLeastSquaresFLS;
            }
            else if ( strcasecmp(argv[i], "GeoSimLeastSquaresNLS") == 0 ) {
                tmp->distMeasure = GeometrySimLeastSquaresNLS;
            }
            else {
                clParseError(argc,argv,i,"Unrecognized FaceGraph Similarity function");
            }

            i++;
            DEBUG_CHECK( i < argc , "Distance directory expected at end of argument list.");
            tmp->distDirectory = strdup (argv[i]);
            args->distList = tmp;
            param_num++;
        }

    }

    /* make sure that there are the proper number of required arguments */
    if (param_num < 2) {
        clParseError(argc,argv,i,"Wrong number of required arguments");
    }

    DEBUG(1,"Debuging enabled");
}
コード例 #8
0
ファイル: csuBayesianTrain.c プロジェクト: MBrauna/Biometria
/**
 * Process the command line and initialize the variables
 *
 * @param argc The number of arguments
 * @param argv The arguments
 */
void
process_command (int argc, char **argv, Arguments * args)
{
    int i;
    int param_num = 0;
    int cutOffSet = 0;

    /******* Set up default values *******/

    args->argc = argc;
    args->argv = argv;

    args->nIntrapersonal = 100;
    args->nExtrapersonal = 100;
    args->distanceMatrix = NULL;
    args->maxRank        = -1;

    args->cutOffMode      = CUTOFF_SIMPLE;
    args->cutOff          = DEFAULT_CUTOFF_PERCENT_SIMPLE;
    args->dropNVectors    = 0;

    debuglevel = 0;

    /******* Read command line arguments *******/

    for (i = 1; i < argc; i++) {

        /* Catch common help requests */
        if      (readOption       (argc, argv, &i, "-help" )) {
            usage(argv[0]);
        }
        else if (readOption       (argc, argv, &i, "--help")) {
            usage(argv[0]);
        }

        /* Read in input directories */
        else if (readOptionString (argc, argv, &i, "-imDir",     &(args->imageDirectory)));
        else if (readOptionString (argc, argv, &i, "-distances", &(args->distanceMatrix)));

        /* Read in number of images to generate */
        else if (readOptionInt    (argc, argv, &i, "-ni", &(args->nIntrapersonal)));
        else if (readOptionInt    (argc, argv, &i, "-ne", &(args->nExtrapersonal)));

        /* Read in maxRank */
        else if (readOptionInt    (argc, argv, &i, "-maxRank", &(args->maxRank)));

        /* Read in PCA training options */
        else if (readOptionInt    (argc, argv, &i, "-dropNVectors", &(args->dropNVectors)));

        else if (readOptionMatch(argc, argv, &i, "-cutOffMode", "NONE"))
        {
            args->cutOffMode = CUTOFF_NONE;
        }
        else if (readOptionMatch(argc, argv, &i, "-cutOffMode", "SIMPLE"))
        {
            args->cutOffMode = CUTOFF_SIMPLE;
        }
        else if (readOptionMatch(argc, argv, &i, "-cutOffMode", "ENERGY"))
        {
            args->cutOffMode = CUTOFF_ENERGY;
        }
        else if (readOptionMatch(argc, argv, &i, "-cutOffMode", "STRETCH"))
        {
            args->cutOffMode = CUTOFF_STRETCH;
        }
        else if (readOptionMatch(argc, argv, &i, "-cutOffMode", "CLASSES"))
        {
            args->cutOffMode = CUTOFF_CLASSES;
        }

        else if (readOptionDouble (argc, argv, &i, "-cutOff", &(args->cutOff)))
        {
            if ((args->cutOff <= 1.0) && (args->cutOff >= 0.000001)) {
                printf("WARNING: cutOff value is %f, expects percentage "
                       "between 0.0 and 100.0", args->cutOff);
                printf("         will proceed assuming value is as desired.");
            }
            cutOffSet = 1;
        }

        /* other flags */
        else if (readOption       (argc, argv, &i, "-quiet")) {
            quiet = 1;
        }
        else if (readOptionInt    (argc, argv, &i, "-debuglevel", &debuglevel));

        /* check if the current argument is an unparsed option */
        else if (checkBadOption(argc,argv,&i));

        /* read required arguments */
        else if (param_num == 0) {
            args->imageList = argv[i];
            param_num++;
        }
        else if (param_num == 1) {
            args->trainingFilename = strdup (argv[i]);
            param_num++;
        }
    }

    /* make sure that there are the proper number of required arguments */

    if (param_num != 2) {
        clParseError(argc,argv,i,"Wrong number of required arguments");
    }

    /* Print out the program parameters for appropriate debug level */

    DEBUG_INT (1, "Debuging enabled", debuglevel);
    if(debuglevel > 0) {
        printf("***************** Program Parameters *********************\n");
        printf ("Image directory:  %s\n", args->imageDirectory);
        printf ("Image list:       %s\n", args->imageList);
        printf ("nIntrapersonal:   %d\n", args->nIntrapersonal);
        printf ("nExtrapersonal:   %d\n", args->nExtrapersonal);
        printf ("distanceMatrix:   %s\n ", args->distanceMatrix);
    }
}