From 44fecd1c4514d820b41691330a0f97d49394b988 Mon Sep 17 00:00:00 2001 From: John Morrison Date: Fri, 15 Jun 2012 13:37:18 -0400 Subject: implemented Getopts for sanity, removed some unused variables as well --- fly-tools/FlyTrackingMain.cpp | 78 +++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 28 deletions(-) (limited to 'fly-tools/FlyTrackingMain.cpp') diff --git a/fly-tools/FlyTrackingMain.cpp b/fly-tools/FlyTrackingMain.cpp index ba678a1..2e963a8 100644 --- a/fly-tools/FlyTrackingMain.cpp +++ b/fly-tools/FlyTrackingMain.cpp @@ -2021,22 +2021,55 @@ ofstream foutSt; ofstream foutDebugCen; ofstream foutDebugSpeed; -int main(int argc, char* argv[]) +int main(int argc, char **argv) { - if (argc < 5) - { - cerr << "Usage: executablename " << endl; // input file contains name of the - // input image files - return -1; - } - + int c; + int writeFinalImages; + string usage = "Usage: FlyTracking -i -o -f -m -O "; + string origImagePath; + string finalOutputPath; + string outputFilePrefix; + string maskImagePath; + string inputFileName; + opterr = 0; + + while ((c = getopt (argc, argv, "i:f:m:p:o:hx")) != -1) + switch (c) + { + case 'i': + inputFileName = optarg; + break; + case 'o': + origImagePath = optarg; + break; + case 'f': + finalOutputPath = optarg; + break; + case 'm': + maskImagePath = optarg; + break; + case 'p': + outputFilePrefix = optarg; + break; + case 'h': + cout << usage << endl; + exit(1); + break; + case 'x': + writeFinalImages; + break; + default: + break; + } + //MagickCore::SetMagickResourceLimit(MagickCore::MemoryResource, 1536); //MagickCore::SetMagickResourceLimit(MagickCore::MapResource, 4092); - string ifns(argv[1]); - inputFileName = ifns; - // cout << "input file name is "<