[pktools] 268/375: default SQLite in pkdiff

Bas Couwenberg sebastic at xs4all.nl
Wed Dec 3 21:54:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch upstream-master
in repository pktools.

commit 88204b80caed0fa9ec3428f42424106dc56bd94a
Author: Pieter Kempeneers <kempenep at gmail.com>
Date:   Tue May 13 23:06:48 2014 +0200

    default SQLite in pkdiff
---
 src/apps/pkdiff.cc    | 32 ++++++++++++++++----------------
 src/apps/pkextract.cc | 10 ++++++----
 src/apps/pkoptsvm.cc  | 22 ++++++++++------------
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/src/apps/pkdiff.cc b/src/apps/pkdiff.cc
index da98e98..c7bb770 100644
--- a/src/apps/pkdiff.cc
+++ b/src/apps/pkdiff.cc
@@ -32,18 +32,18 @@ int main(int argc, char *argv[])
   Optionpk<string> input_opt("i", "input", "Input image file.");
   Optionpk<string> reference_opt("ref", "reference", "Reference image file");
   Optionpk<string> output_opt("o", "output", "Output image file. Default is empty: no output image, only report difference or identical.");
-  Optionpk<string> ogrformat_opt("f", "f", "Output sample file format","ESRI Shapefile");
+  Optionpk<string> ogrformat_opt("f", "f", "Output sample file format","SQLite");
   Optionpk<string> mask_opt("m", "mask", "Mask image file. A single mask is supported only, but several mask values can be used. See also msknodata option. (default is empty)");
   Optionpk<int> masknodata_opt("msknodata", "msknodata", "Mask value(s) where image is invalid. Use negative value for valid data (example: use -t -1: if only -1 is valid value)", 0);
   Optionpk<string> colorTable_opt("ct", "ct", "color table (file with 5 columns: id R G B ALFA (0: transparent, 255: solid)");
-  Optionpk<short> valueE_opt("\0", "correct", "Value for correct pixels", 0,1);
-  Optionpk<short> valueO_opt("\0", "omission", "Value for omission errors: input label > reference label", 1,1);
+  Optionpk<short> valueE_opt("\0", "correct", "Value for correct pixels", 0,2);
+  Optionpk<short> valueO_opt("\0", "omission", "Value for omission errors: input label > reference label", 1,2);
   Optionpk<short> valueC_opt("\0", "commission", "Value for commission errors: input label < reference label", 2,1);
   Optionpk<short> nodata_opt("nodata", "nodata", "No value flag(s)");
   Optionpk<short> band_opt("b", "band", "Input band", 0);
   Optionpk<bool> confusion_opt("cm", "confusion", "create confusion matrix (to std out)", false);
-  Optionpk<string> labelref_opt("lr", "lref", "name of the reference label in case reference is shape file", "label");
-  Optionpk<string> labelclass_opt("lc", "lclass", "name of the classified label in case output is shape file", "class");
+  Optionpk<string> labelref_opt("lr", "lref", "name of the reference label in case reference is OGR vector file", "label");
+  Optionpk<string> labelclass_opt("lc", "lclass", "name of the classified label in case output is OGR vector file", "class");
   Optionpk<short> boundary_opt("bnd", "boundary", "boundary for selecting the sample", 1,1);
   Optionpk<bool> disc_opt("circ", "circular", "use circular disc kernel boundary)", false,1);
   Optionpk<bool> homogeneous_opt("hom", "homogeneous", "only take homogeneous regions into account", false,1);
@@ -55,27 +55,27 @@ int main(int argc, char *argv[])
   bool doProcess;//stop process when program was invoked with help option (-h --help)
   try{
     doProcess=input_opt.retrieveOption(argc,argv);
-    output_opt.retrieveOption(argc,argv);
-    ogrformat_opt.retrieveOption(argc,argv);
-    option_opt.retrieveOption(argc,argv);
     reference_opt.retrieveOption(argc,argv);
+    confusion_opt.retrieveOption(argc,argv);
+    labelref_opt.retrieveOption(argc,argv);
+    classname_opt.retrieveOption(argc,argv);
+    classvalue_opt.retrieveOption(argc,argv);
+    nodata_opt.retrieveOption(argc,argv);
     mask_opt.retrieveOption(argc,argv);
+    masknodata_opt.retrieveOption(argc,argv);
+    output_opt.retrieveOption(argc,argv);
+    ogrformat_opt.retrieveOption(argc,argv);
+    labelclass_opt.retrieveOption(argc,argv);
     colorTable_opt.retrieveOption(argc,argv);
+    option_opt.retrieveOption(argc,argv);
     valueE_opt.retrieveOption(argc,argv);
     valueO_opt.retrieveOption(argc,argv);
     valueC_opt.retrieveOption(argc,argv);
-    nodata_opt.retrieveOption(argc,argv);
-    masknodata_opt.retrieveOption(argc,argv);
     band_opt.retrieveOption(argc,argv);
-    confusion_opt.retrieveOption(argc,argv);
-    labelref_opt.retrieveOption(argc,argv);
-    labelclass_opt.retrieveOption(argc,argv);
     // class_opt.retrieveOption(argc,argv);
     boundary_opt.retrieveOption(argc,argv);
     disc_opt.retrieveOption(argc,argv);
     homogeneous_opt.retrieveOption(argc,argv);
-    classname_opt.retrieveOption(argc,argv);
-    classvalue_opt.retrieveOption(argc,argv);
     verbose_opt.retrieveOption(argc,argv);
   }
   catch(string predefinedString){
@@ -539,7 +539,7 @@ int main(int argc, char *argv[])
 		if(verbose_opt[0])
 		  cout << "creating feature" << endl;
 		if(writeLayer->CreateFeature( writeFeature ) != OGRERR_NONE ){
-		  string errorString="Failed to create feature in shapefile";
+		  string errorString="Failed to create feature in OGR vector file";
 		  throw(errorString);
 		}
 	      }
diff --git a/src/apps/pkextract.cc b/src/apps/pkextract.cc
index 56231e5..e771a18 100644
--- a/src/apps/pkextract.cc
+++ b/src/apps/pkextract.cc
@@ -124,10 +124,12 @@ int main(int argc, char *argv[])
   ruleMap["maxvote"]=rule::maxvote;
   ruleMap["sum"]=rule::sum;
 
-  while(srcnodata_opt.size()<bndnodata_opt.size())
-    srcnodata_opt.push_back(srcnodata_opt[0]);
-  while(bndnodata_opt.size()<srcnodata_opt.size())
-    bndnodata_opt.push_back(bndnodata_opt[0]);
+  if(srcnodata_opt.size()){
+    while(srcnodata_opt.size()<bndnodata_opt.size())
+      srcnodata_opt.push_back(srcnodata_opt[0]);
+    while(bndnodata_opt.size()<srcnodata_opt.size())
+      bndnodata_opt.push_back(bndnodata_opt[0]);
+  }
 
   if(verbose_opt[0])
     std::cout << class_opt << std::endl;
diff --git a/src/apps/pkoptsvm.cc b/src/apps/pkoptsvm.cc
index 864ccaf..ffcc488 100644
--- a/src/apps/pkoptsvm.cc
+++ b/src/apps/pkoptsvm.cc
@@ -101,7 +101,7 @@ double objFunction(const std::vector<double> &x, std::vector<double> &grad, void
     ntest+=nctest[iclass];
   }
   if(ntest)
-    assert(!cv_opt[0]);
+    cv_opt[0]=0;
   if(!cv_opt[0])
     assert(ntest);
     // ntraining+=(*tf)[iclass].size();
@@ -248,8 +248,7 @@ int main(int argc, char *argv[])
   Optionpk<unsigned int> maxit_opt("maxit","maxit","maximum number of iterations",500);
   Optionpk<string> algorithm_opt("a", "algorithm", "GRID, or any optimization algorithm from http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms","GRID"); 
   Optionpk<double> tolerance_opt("tol","tolerance","relative tolerance for stopping criterion",0.0001);
-  Optionpk<double> stepcc_opt("stepcc","stepcc","multiplicative step for ccost in GRID search",2);
-  Optionpk<double> stepg_opt("stepg","stepg","multiplicative step for gamma in GRID search",2);
+  Optionpk<double> step_opt("step","step","multiplicative step for ccost and gamma in GRID search",2);
 
   bool doProcess;//stop process when program was invoked with help option (-h --help)
   try{
@@ -259,7 +258,7 @@ int main(int argc, char *argv[])
     label_opt.retrieveOption(argc,argv);
     // reclass_opt.retrieveOption(argc,argv);
     balance_opt.retrieveOption(argc,argv);
-	random_opt.retrieveOption(argc,argv);
+    random_opt.retrieveOption(argc,argv);
     minSize_opt.retrieveOption(argc,argv);
     start_opt.retrieveOption(argc,argv);
     end_opt.retrieveOption(argc,argv);
@@ -282,8 +281,7 @@ int main(int argc, char *argv[])
     costfunction_opt.retrieveOption(argc,argv);
     maxit_opt.retrieveOption(argc,argv);
     tolerance_opt.retrieveOption(argc,argv);
-    stepcc_opt.retrieveOption(argc,argv);
-    stepg_opt.retrieveOption(argc,argv);
+    step_opt.retrieveOption(argc,argv);
     algorithm_opt.retrieveOption(argc,argv);
     classname_opt.retrieveOption(argc,argv);
     classvalue_opt.retrieveOption(argc,argv);
@@ -596,8 +594,8 @@ int main(int argc, char *argv[])
 
   std::vector<double> x(2);
   if(algorithm_opt[0]=="GRID"){
-    // if(step_opt.size()<2)//[0] for cost, [1] for gamma
-    //   step_opt.push_back(step_opt.back());
+    if(step_opt.size()<2)//[0] for cost, [1] for gamma
+      step_opt.push_back(step_opt.back());
     double minError=1000;
     double minCost=0;
     double minGamma=0;
@@ -607,10 +605,10 @@ int main(int argc, char *argv[])
     double progress=0;
     if(!verbose_opt[0])
       pfnProgress(progress,pszMessage,pProgressArg);
-    double ncost=log(ccost_opt[1])/log(10.0)-log(ccost_opt[0])/log(10.0);
-    double ngamma=log(gamma_opt[1])/log(10.0)-log(gamma_opt[0])/log(10.0);
-    for(double ccost=ccost_opt[0];ccost<=ccost_opt[1];ccost*=stepcc_opt[0]){
-      for(double gamma=gamma_opt[0];gamma<=gamma_opt[1];gamma*=stepg_opt[0]){
+    double ncost=log(ccost_opt[1])/log(step_opt[0])-log(ccost_opt[0])/log(step_opt[0]);
+    double ngamma=log(gamma_opt[1])/log(step_opt[1])-log(gamma_opt[0])/log(step_opt[1]);
+    for(double ccost=ccost_opt[0];ccost<=ccost_opt[1];ccost*=step_opt[0]){
+      for(double gamma=gamma_opt[0];gamma<=gamma_opt[1];gamma*=step_opt[1]){
 	x[0]=ccost;
 	x[1]=gamma;
 	std::vector<double> theGrad;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pktools.git



More information about the Pkg-grass-devel mailing list