28 #include <DGtal/base/Common.h>
29 #include "DGtal/io/readers/GenericReader.h"
30 #include "DGtal/io/writers/GenericWriter.h"
31 #include "DGtal/images/ImageContainerBySTLVector.h"
32 #include "DGtal/images/ImageSelector.h"
33 #include <DGtal/geometry/volumes/KanungoNoise.h>
34 #include <DGtal/images/IntervalForegroundPredicate.h>
44 using namespace DGtal;
85 void missingParam ( std::string param )
87 trace.
error() <<
" Parameter: "<<param<<
" is required..";
95 int main(
int argc,
char** argv )
99 std::string inputFileName;
100 std::string outputFileName {
"result.png"};
103 app.description(
"Add Kanungo noise to a binary object with 0 values as background points and values >0 for the foreground ones.\n Example: \n imgAddNoise ${DGtal}/examples/samples/klokan.pgm noise.pgm ");
104 app.add_option(
"-i,--input,1", inputFileName,
"input image file name (any 2D image format accepted by DGtal::GenericReader)." )
106 ->check(CLI::ExistingFile);
107 app.add_option(
"-o,--output,2", outputFileName,
"output image file name (any 2D image format accepted by DGtal::GenericWriter)",
true);
108 app.add_option(
"-n,--noise", noise,
"Kanungo noise level in ]0,1[ (default 0.5)",
true);
110 app.get_formatter()->column_width(40);
111 CLI11_PARSE(app, argc, argv);
117 trace.
info() <<
"Input image: "<< image<<std::endl;
118 Binarizer predicate(image, 0,255);
126 result.setValue(*it, 255);
128 result .setValue(*it, 0);
131 result >> outputFileName;
int main(int argc, char **argv)
const Domain & domain() const
Trace trace(traceWriterTerm)
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())