From: <st...@us...> - 2009-07-02 14:11:15
|
Revision: 3989 http://hugin.svn.sourceforge.net/hugin/?rev=3989&view=rev Author: stativ Date: 2009-07-02 13:50:25 +0000 (Thu, 02 Jul 2009) Log Message: ----------- Add option to set sigma value to the deghosting_mask Modified Paths: -------------- hugin/branches/gsoc2009_deghosting/src/deghosting/deghosting_mask.cpp hugin/branches/gsoc2009_deghosting/src/deghosting/khan.cpp hugin/branches/gsoc2009_deghosting/src/deghosting/khan.h Modified: hugin/branches/gsoc2009_deghosting/src/deghosting/deghosting_mask.cpp =================================================================== --- hugin/branches/gsoc2009_deghosting/src/deghosting/deghosting_mask.cpp 2009-07-02 13:26:39 UTC (rev 3988) +++ hugin/branches/gsoc2009_deghosting/src/deghosting/deghosting_mask.cpp 2009-07-02 13:50:25 UTC (rev 3989) @@ -35,18 +35,8 @@ //<< " khan (default)" << endl << " -o prefix prefix for output masks" << endl << " -i number of iterations, default is 1" << endl - /*<< " -s file debug files to save each iteration, can be one of:" << endl - << " a - all debug files (can only be used alone)" << endl - << " w - calculated weights from each iteration" << endl - << " l - L*a*b images used for processing" << endl - << " -a calcs apply one or more advanced caculations, can be one or more of:" << endl - << " b - biasing weights logarithmically" << endl - << " c - choose pixels with heighest weight instead of averaging" << endl - << " (overrides options -a b and -a d)" << endl - << " d - choose a pixel with the heighest weight instead of" << endl - << " averaging when all pixel weights are within 10% of eachother" << endl - << " h - favor a high signal to noise ratio" << endl - << " i - ignore alpha channel" << endl*/ + << " -s value of sigma in probability density funtion" << endl + << " default is 50" << endl << " -r use camera response specified in EMoR format" << endl << " -h display this help" << endl << " -v verbose, repeat for more verbose output" << endl; @@ -61,6 +51,7 @@ string algorithm = "khan"; int iterations = 1; + double sigma = 50; uint16_t flags = 0; uint16_t debugFlags = 0; EMoR response(0.0f); @@ -83,20 +74,7 @@ iterations = atoi(optarg); break; case 's': - for(char *c = optarg; *c; c++) { - switch(*c) { - case 'w': - debugFlags += SAVE_WEIGHTS; - break; - case 'p': - debugFlags += SAVE_PROBABILITIES; - break; - default: - cerr << "Invalid argument for option -s: " << *c << std::endl; - usage(argv[0]); - return 1; - } - } + sigma = atof(optarg); break; case 'a': for(char *c = optarg; *c; c++) { @@ -135,11 +113,11 @@ Deghosting* deghoster = NULL; - Khan khanDeghoster(inputFiles, flags, debugFlags, iterations, response); + Khan khanDeghoster(inputFiles, flags, debugFlags, iterations, verbosity, response); + khanDeghoster.setSigma(sigma); deghoster = &khanDeghoster; - deghoster->setVerbosity(verbosity); deghoster->createWeightMasks(); } Modified: hugin/branches/gsoc2009_deghosting/src/deghosting/khan.cpp =================================================================== --- hugin/branches/gsoc2009_deghosting/src/deghosting/khan.cpp 2009-07-02 13:26:39 UTC (rev 3988) +++ hugin/branches/gsoc2009_deghosting/src/deghosting/khan.cpp 2009-07-02 13:50:25 UTC (rev 3989) @@ -18,13 +18,14 @@ using std::cout; namespace deghosting { - Khan::Khan(std::vector<std::string>& setInputFiles, const uint16_t setFlags, const uint16_t setDebugFlags, int setIterations, EMoR setResponse) { + Khan::Khan(std::vector<std::string>& setInputFiles, const uint16_t setFlags, const uint16_t setDebugFlags, + int setIterations, int setVerbosity, EMoR setResponse) { inputFiles = setInputFiles; flags = setFlags; debugFlags = setDebugFlags; iterations = setIterations; response = setResponse; - verbosity = 0; + verbosity = setVerbosity; sigma = 50; PIPOW = sigma*std::sqrt(2*PI); denom = 1/PIPOW; @@ -53,6 +54,10 @@ void Khan::setVerbosity(int newVerbosity) { verbosity = newVerbosity; } + + void Khan::setSigma(double newSigma) { + sigma = newSigma; + } float Khan::hat(RGBValue<float> pixel) { double value = (pixel[0]+pixel[1]+pixel[2])/3; Modified: hugin/branches/gsoc2009_deghosting/src/deghosting/khan.h =================================================================== --- hugin/branches/gsoc2009_deghosting/src/deghosting/khan.h 2009-07-02 13:26:39 UTC (rev 3988) +++ hugin/branches/gsoc2009_deghosting/src/deghosting/khan.h 2009-07-02 13:50:25 UTC (rev 3989) @@ -35,7 +35,7 @@ class Khan : public Deghosting { public: - Khan(std::vector< std::string >& inputFiles, const uint16_t flags, const uint16_t debugFlags, int iterations, EMoR response); + Khan(std::vector< std::string >& inputFiles, const uint16_t flags, const uint16_t debugFlags, int iterations, int verbosity, EMoR response); std::vector<FImagePtr> createWeightMasks(); void loadImages(std::vector<std::string>& inputFiles); void setFlags(const uint16_t flagslags); @@ -43,6 +43,7 @@ void setIterationNum(const int iterations); void setCameraResponse(EMoR newResponse); void setVerbosity(int verbosity); + void setSigma(double sigma); ~Khan() {} private: std::vector<std::string> inputFiles; @@ -74,6 +75,7 @@ */ void linearizeRGB(std::string, FRGBImage* pInputImg); /** kernel function + * Standard probability density function */ inline double Kh(deghosting::AlgTinyVector< float, 3 > x); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |