Эх сурвалжийг харах

Added sample runs and output (if applicable) to tutorials

Clemens-Alexander Brust 11 жил өмнө
parent
commit
1bb1da9e05

+ 14 - 0
core/tutorial/doc/01_imageio.md

@@ -139,3 +139,17 @@ return 0;
 
 Remember that _ImageFile_ objects are just containers for a file's location
 and only open the file when you call methods that require reading or writing.
+
+## Running the sample
+
+_Command line:_
+
+```bash
+./01_imageio ../../nice-core/core/tutorial/samples/peppers_color.ppm /tmp/output.ppm
+```
+
+_Output:_
+
+```
+Source image dimensions: 512 x 512 (3 channels, 8 bpp)
+```

+ 8 - 0
core/tutorial/doc/02_grayscale.md

@@ -151,3 +151,11 @@ NICE::ImageFile dest_image(output_path);
 dest_image.writer(&image);
 return 0;
 ```
+
+## Running the sample
+
+_Command line:_
+
+```bash
+./02_grayscale ../../nice-core/core/tutorial/samples/peppers_gray.pgm /tmp/output.ppm
+```

+ 9 - 1
core/tutorial/doc/03_color.md

@@ -123,4 +123,12 @@ After this is done, we write __pseudo_image__ to disk so we can look at it:
 NICE::ImageFile dest_image(output_path);
 dest_image.writer(&pseudo_image);
 return 0;
-```
+```
+
+## Running the sample
+
+_Command line:_
+
+```bash
+./03_color ../../nice-core/core/tutorial/samples/peppers_gray.pgm /tmp/output.ppm
+```

+ 10 - 1
core/tutorial/doc/04_filter.md

@@ -84,4 +84,13 @@ You need to call two methods in this case:
 
 ```c++
 NICE::Filter::filterX(image, kernel, result);
-NICE::Filter::filterY(image, kernel, result);
+NICE::Filter::filterY(image, kernel, result);
+```
+
+## Running the sample
+
+_Command line:_
+
+```bash
+./04_filter ../../nice-core/core/tutorial/samples/peppers_color.ppm /tmp/output.pgm
+```

+ 34 - 0
core/tutorial/doc/06_algebra.md

@@ -55,3 +55,37 @@ NICE::VectorT<double> eigenvals = NICE::eigenvalues(matrix);
 NICE::VectorT<double> my_own_vector(3);
 NICE::eigenvalues(matrix, my_own_vector);
 ```
+
+## Running the sample
+
+_Command line:_
+
+```bash
+./05_matio ../../nice-core/core/tutorial/samples/simple.mat MyMatrix
+```
+
+_Output:_
+
+```
+Loading matrix "MyMatrix"...
+Dimensions: 4 x 4
+1       2       3       4
+4       5       6       7
+2       3       4       5
+2       9       8       1
+Vt:
+-0.266556       -0.584949       -0.621772       -0.447418
+-0.188645       0.497147        0.204551        -0.821837
+0.925622        0.0646203       -0.282292       -0.243639
+-0.191273       0.637577        -0.701334       0.255031
+U:
+-0.285172       -0.294773       -0.738967       -0.534522
+-0.607906       -0.440949       0.603809        -0.267261
+-0.39275        -0.343498       -0.291375       0.801784
+-0.62839        0.775037        -0.0666614      -1.08901e-16
+S:
+17.8539 0       0       0
+0       6.33725 0       0
+0       0       1.03735 0
+0       0       0       2.17065e-16
+```

+ 22 - 0
core/tutorial/doc/07_optimization.md

@@ -137,3 +137,25 @@ __position__ method:
 double x_min = problem.position()(0);
 std::cout << "Solution: " << x_min << "\n";
 ```
+
+## Running the sample
+
+_Command line:_
+
+```bash
+./06_optimization 4.3 5 2.3
+```
+
+_Output:_
+
+```
+Optimizing function f(x) = 4.3 x^2 + 5 x + 2.3
+FirstOrderRasmussen: initial value of the objective function is 2.3
+Iteration 1 / 100  objective function = 2.3
+FirstOrderRasmussen: new objective value 0.846598
+Iteration 3 / 100  objective function = 0.846598
+FirstOrderRasmussen: new objective value 0.846512
+Iteration 7 / 100  objective function = 0.846512
+FirstOrderRasmussen: low gradient 7.72715e-14 < 1e-05 = epsilonG
+Solution: -0.581395
+```