#include #include #include #include #include #include #include using namespace icl; using namespace std; int main (int argc, char **argv) { pa_init(argc, argv,"-input(1) -output(1) -masksize(1) -globalthreshold(1)"); Size s(640,480); Img8u *I = new Img8u(s,formatRGB), *R = new Img8u(s,formatRGB); if(pa_defined("-input")){ string s = pa_subarg("-input",0,""); printf("input file %s \n",s.c_str()); FileReader(s).grab(I); } else{ printf("working with testimage tree: \n"); TestImages::create("tree")->deepCopy(I); } unsigned int maskSize = pa_subarg("-masksize",0,10); int gt = pa_subarg("-globalthreshold",0,0); printf("mask size was set to %d \n",maskSize); printf("global threshold was set to %d \n",gt); ImgBase *RBase =(ImgBase*)R; LocalThreshold t(maskSize,gt); t.apply(I,&RBase); string outputName = pa_subarg("-output",0,"./out.jpg"); printf("writing output file %s \n", outputName.c_str()); FileWriter(outputName).write(R); }