Exemple #1
0
        static void MainMain(string[] args)
        {
            //not sure how beneficial this is
            CvInvoke.RedirectError(CvInvoke.CvErrorHandlerIgnoreError, IntPtr.Zero, IntPtr.Zero);

            //string inFile = null;
            //inFile = fileList.FirstOrDefault();
            //if (String.IsNullOrWhiteSpace(inFile)) {
            //	Console.WriteLine("Missing input file");
            //	return;
            //}
            //if(String.IsNullOrEmpty(outFile))
            //{
            //	if (fileList.Count > 1) {
            //		outFile = fileList[1];
            //	} else {
            //		outFile = Path.GetFileNameWithoutExtension(inFile)
            //			+".out"+Path.GetExtension(inFile);
            //	}
            //}

            if (Method == MethodType.NlMeans)
            {
                var ments = NlMeansArgs.Parse(args);
                Methods.NlMeans(ments);
            }
            else if (Method == MethodType.NlMeansColored)
            {
                var ments = NlMeansColoredArgs.Parse(args);
                Methods.NlMeansColored(ments);
            }
            else if (Method == MethodType.Dct)
            {
                var ments = DctArgs.Parse(args);
                if (!ments.sigma.HasValue)
                {
                    Console.WriteLine("option -s is required");
                    return;
                }
                Methods.Dct(ments);
            }
            else if (Method == MethodType.TVL1)
            {
                var ments = TVL1Args.Parse(args);
                if (!ments.lambda.HasValue)
                {
                    Console.WriteLine("option -l is required");
                    return;
                }
                if (!ments.niters.HasValue)
                {
                    Console.WriteLine("option -n is required");
                    return;
                }
                Methods.TVL1(ments);
            }
            //else if (Method == MethodType.DFTForward) {
            //	Methods.DFTForward(inFile,outFile);
            //}
            //else if (Method == MethodType.DFTInverse) {
            //	if (fileList.Count < 2 || fileList[0] == null || fileList[1] == null) {
            //		Console.WriteLine("your must specify both a magnitude image and a phase image");
            //		return;
            //	}
            //	if (fileList.Count > 2) {
            //		outFile = fileList[2];
            //	} else {
            //		outFile = Path.GetFileNameWithoutExtension(fileList[0])+".inv.png";
            //	}
            //
            //	Debug.WriteLine("mi="+m6mi.GetValueOrDefault()
            //		+" mx="+m6mx.GetValueOrDefault()
            //		+" pi="+m6pi.GetValueOrDefault()
            //		+" px="+m6px.GetValueOrDefault()
            //	);
            //
            //	if (!m6mi.HasValue || !m6mx.HasValue || !m6pi.HasValue || !m6px.HasValue) {
            //		Console.WriteLine("you must specify magnitude and phase ranges");
            //		return;
            //	}
            //
            //	Methods.DFTInverse(fileList,outFile,m6mi.Value,m6mx.Value,m6pi.Value,m6px.Value);
            //	return;
            //}
        }