forked from boostorg/gil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure all examples build without error (boostorg#628)
* Added all missing examples, dodgy Jamfile still * Fixed attributions and Jamfile indent * One readme per example: synopsis, build and exec reqs * Cleaned up example/convolve2d.cpp * Added example target to root Jamfile Closes boostorg#436
- Loading branch information
1 parent
b6526de
commit 0b24f4c
Showing
61 changed files
with
799 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Adaptive Histogram Equalization | ||
|
||
Adaptive Histogram Equalization (AHE) capabilities in GIL are demonstrated by the program `adaptive_he`, compiled from the sources `example/adaptive_he.cpp`. | ||
|
||
## Synopsis | ||
`adaptive_he` | ||
|
||
The program doesn't take any argument on the command line. | ||
|
||
`adaptive_he` expects to find an image called `test_adaptive.png` in the current directory, and produces the image `out-adaptive.png` in return. | ||
|
||
## Specific requirements | ||
|
||
### Build requirements | ||
- A C++ compiler compliant with C++11 or above | ||
- The PNG library installed and configured. | ||
|
||
### Execution requirements | ||
- `adaptive_he` expects to find an image called `test_adaptive.png` in the current directory. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Adaptive Thresholding | ||
|
||
Adaptive Thresholding capabilities in GIL are demonstrated by the program `adaptive_threshold`, compiled from the sources `example/adaptive_threshold.cpp`. | ||
|
||
## Synopsis | ||
`adaptive_threshold` | ||
|
||
The program doesn't take any argument on the command line. | ||
|
||
`adaptive_threshold` expects to find an image called `test_adaptive.png` in the current directory, and produces one image for each thresholding method: | ||
- `out-threshold-adaptive-mean.png` | ||
- `out-threshold-adaptive-mean-inv.png` | ||
- `out-threshold-adaptive-gaussian.png` | ||
- `out-threshold-adaptive-gaussian-inv.png`. | ||
|
||
## Specific requirements | ||
|
||
### Build requirements | ||
- A C++ compiler compliant with C++11 or above | ||
- The PNG library installed and configured. | ||
|
||
### Execution requirements | ||
- `adaptive_threshold` expects to find an image called `test_adaptive.png` in the current directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Affine transformation | ||
|
||
Affine transformation capabilities in GIL are demonstrated by the program `affine`, compiled from the sources `example/affine.cpp`. | ||
|
||
## Synopsis | ||
`affine` | ||
|
||
The program doesn't take any argument on the command line. | ||
|
||
`affine` expects to find an image called `test.jpg` in the current directory, and produces an image in return, where the transformations have been applied: `out-affine.jpg` | ||
|
||
## Specific requirements | ||
|
||
### Build requirements | ||
- A C++ compiler compliant with C++11 or above | ||
- The JPEG library installed and configured. | ||
|
||
### Execution requirements | ||
- `affine` expects to find an image called `test.jpg` in the current directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Anisotropic diffusion | ||
|
||
Anisotropic diffusion capabilities in GIL are demonstrated by the program `anisotropic_diffusion`, compiled from the sources `example/anisotropic_diffusion.cpp`. | ||
|
||
## Synopsis | ||
`anisoptropic_diffusion input.png output.png gray|rgb iterations kappa` | ||
- The first parameter must be the full path to an existing image in the JPEG format for `anisoptropic_diffusion` to process | ||
- The second parameter is the full path to the output image of `anisotropic_diffusion`. The directory will *not* be created and must exist. | ||
- The third parameter is the colour space: either `gray` or `rgb` | ||
- The fourth parameter is the number of iterations, which *must* be a positive integer | ||
- The fifth and last parameter is the value of the kappa constant | ||
|
||
Note that both the input and the ouput images must be in the PNG format. | ||
|
||
## Specific requirements | ||
|
||
### Build requirements | ||
- A C++ compiler compliant with C++11 or above | ||
- The PNG library installed and configured. | ||
|
||
### Execution requirements | ||
`anisotropic_diffusion` has no specific execution requirements. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Convolution | ||
|
||
Convolution capabilities in GIL are demonstrated by the program `convolution`, compiled from the sources `example/convolution.cpp`. | ||
|
||
## Synopsis | ||
`convolution` | ||
|
||
The program doesn't take any argument on the command line. | ||
|
||
`convolution` expects to find an image called `test.jpg` in the current directory, and produces two images in return, where the filters have been applied: `out-convolution.jpg` and `out-convolution2.jpg` | ||
|
||
## Specific requirements | ||
|
||
### Build requirements | ||
- A C++ compiler compliant with C++11 or above | ||
- The JPEG library installed and configured. | ||
|
||
### Execution requirements | ||
- `convolution` expects to find an image called `test.jpg` in the current directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
// | ||
// Copyright 2019 Miral Shah <[email protected]> | ||
// | ||
// Distributed under the Boost Software License, Version 1.0 | ||
// See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt | ||
// | ||
|
||
#include <vector> | ||
#include <iostream> | ||
#include <boost/gil/extension/numeric/kernel.hpp> | ||
#include <boost/gil/extension/numeric/convolve.hpp> | ||
#include <boost/gil/extension/io/png.hpp> | ||
|
||
#include <boost/gil/extension/io/jpeg.hpp> | ||
|
||
using namespace boost::gil; | ||
using namespace std; | ||
|
||
// Convolves the image with a 2d kernel. | ||
|
||
// Note that the kernel can be fixed or resizable: | ||
// kernel_2d_fixed<float, N> k(elements, centre_y, centre_x) produces a fixed kernel | ||
// kernel_2d<float> k(elements, size, centre_y, centre_x) produces a resizable kernel | ||
// The size of the kernel matrix is deduced as the square root of the number of the elements (9 elements yield a 3x3 matrix) | ||
|
||
// See also: | ||
// convolution.cpp - Convolution with 2d kernels | ||
|
||
|
||
int main() | ||
{ | ||
//gray8_image_t img; | ||
//read_image("test_adaptive.png", img, png_tag{}); | ||
//gray8_image_t img_out(img.dimensions()); | ||
|
||
gray8_image_t img; | ||
read_image("src_view.png", img, png_tag{}); | ||
gray8_image_t img_out(img.dimensions()), img_out1(img.dimensions()); | ||
|
@@ -21,21 +38,16 @@ int main() | |
detail::kernel_2d<float> kernel(v.begin(), v.size(), 1, 1); | ||
detail::convolve_2d(view(img), kernel, view(img_out1)); | ||
|
||
//write_view("out-convolve2d.png", view(img_out), png_tag{}); | ||
write_view("out-convolve2d.png", view(img_out1), jpeg_tag{}); | ||
write_view("out-convolve2d.png", view(img_out1), png_tag{}); | ||
|
||
|
||
//------------------------------------// | ||
std::vector<float> v1(3, 1.0f / 3.0f); | ||
kernel_1d<float> kernel1(v1.begin(), v1.size(), 1); | ||
|
||
detail::convolve_1d<gray32f_pixel_t>(const_view(img), kernel1, view(img_out), boundary_option::extend_zero); | ||
write_view("out-convolve_option_extend_zero.png", view(img_out), png_tag{}); | ||
|
||
if (equal_pixels(view(img_out1), view(img_out)))cout << "convolve_option_extend_zero" << endl; | ||
|
||
cout << "done\n"; | ||
cin.get(); | ||
if (equal_pixels(view(img_out1), view(img_out))) | ||
cout << "convolve_option_extend_zero" << endl; | ||
|
||
return 0; | ||
} |
Oops, something went wrong.