Commit Graph

199 Commits

Author SHA1 Message Date
Mateusz Łoskot
100b8e32b4
[cmake] Rationalise names of tests vs targets
Cherry-picked from develop branch commit 4dc3836449
ignoring changes in all `CMakeLists.txt` files but this one
`test/extension/toolbox/CMakeLists.txt` which somehow missed the changes.
Possibly due to my mistake during previous cherry-picks to compose
the emergency fix #394 for docs in `master` branch, that also
brought the restructuring of the tests directories.

Missing changes in `test/extension/toolbox/CMakeLists.txt` file
are currently causing failures of AzP builds using CMake
for `master` Boost 1.72 merge e8a04f403e
This is attempt to fix it in the `master`.
2019-10-30 10:25:41 +01:00
Stefan Seefeld
e8a04f403e Merge branch 'develop' for Boost 1.72 release. 2019-10-29 16:54:55 -04:00
Olzhas Zhumabek
62379dd5b9
Implement Sobel and Scharr operators (#392)
* Implement Sobel and Scharr operators

This commit adds Sobel and Scharr
operators with support for 0th and 1st
degrees with other degrees planned for
later

* Migrate and fix Harris example

Generate Harris entries now uses
signed image view.
The Harris corner detector example
now uses the Scharr filter generator
and convolve_2d to reduce amount
of code needed.

* Fix and migrate Hessian example

The Hessian example now uses signed
image views and uses newly added kernel
generators to compute gradients

* Fix Harris and Hessian tests

The tests broke due to migration to
signed views in algorithms, but tests
were not adjusted

* Fix Jamfile for example/sobel_scharr.cpp

* Cosmetic changes

* Commented out fail tests

* Fixed pixel16 used in image16s

In Harris and Hessian tests, unsigned
pixel values was used to construct
signed image, which was causing
appveyor to error out.

* Reenable failing targets

* Unify kernel generator interface

This commit makes all kernel
generator functions to return kernel_2d
and adapts dependant threshold
function to use the new interface

* Migrate Hessian and Harris tests

Migrate Hessian and Harris tests to new
interface for kernel generators

* Migrate Harris and Hessian examples

Harris and Hessian examples now use
new interface for kernel generation

* Migrate simple_kernels tests

simple_kernels are now using kernel_2d
interface

* Add missing return

Normalized mean generation had missing
return at the end of the function

* Adapt code to namespace move

This commit reacts to kernel_2d,
convolve_2d being moved to
namespace detail
2019-10-29 22:38:04 +06:00
Mateusz Łoskot
20f511b7d0
Flatten structure of test/extension/io/output/ folder (#400)
There is no need for format-specific subfolders.
There is no code in place that checks if all those folders exist and
creates them.
This change simplifies the structure to simplify running of I/O tests.

Rename images/jpg/ to images/jpeg/ in tests
The `jpeg` is name of the format used in the I/O extension and
the folders inside `images/` are named after those formats.
2019-10-29 08:59:55 +01:00
Pranam Lashkari
146d81bb7e Update extend_boundary function to handle all boundary_option-s (#398)
Closes #391
2019-10-28 17:19:27 +01:00
Mateusz Łoskot
8235ee645a
Hide convolve_1d, convolve_2d and kernel_2 in namespace detail (#397)
* Hide convolve_1d and convolve_2d in namespace detail
* Hide kernel_2d in namespace detail.
* Tidy up naming of horizontal/vertical to y/x for kernel center.

Following @lpranam comments on planned changes to convolve_2d,
which will not be ready for Boost 1.72,
@mloskot proposed to hide the function as implementation detail,
https://lists.boost.org/boost-gil/2019/10/0316.php,
until it is ready and @stefanseefeld agreed on the proposal,
https://lists.boost.org/boost-gil/2019/10/0320.php.
2019-10-24 12:50:56 +02:00
MIRAL SHAH
8f1bd53fec
Implemented median_filter (#393)
tests for median_filter added
2019-10-15 10:12:54 +05:30
Mateusz Łoskot
96df5442bc
Move tests of extensions inside test/ directory (#302)
Split header tests accordingly i.e. test core headers as part of
core tests, numeric extension headers as part of numeric tests, etc.

It extends the convention of sub-directories already established in
`include/boost/gil` directory. It is sensible to follow it in other
areas of the source tree (i.e. `test/`, `doc/` and `benchmark/`).

Another important reason to move the tests is to enable removal of
the top-level `Jamfile` with all its definitions of test-specific
requirements.
The top-level `Jamfile` is not advised, especially if it specifies
build requirements like C++ language version.
Those affect non-tests builds e.g. documentation, causing failures
during generation of HTML documentation (leads to missing docs).

(cherry picked from develop branch commit 4ed7701b47)
2019-09-26 11:43:13 +02:00
Pranam Lashkari
6a1c99a33c Implement image boundary extension algorithm (#386) 2019-09-05 20:47:21 +02:00
MIRAL SHAH
124f621914
implemented box_filter (#383)
implemented `blur` function

tests added for `box_filter`

closes #382
2019-08-22 00:26:36 +05:30
Olzhas Zhumabek
5c52dff369
Hessian corner detector (#364)
* Hessian plain determinant

This commit partially implements
Hessian corner detector, but only
uses determinant as Hessian response

* Implement full Hessian corner detector

This commit complements last one
by summing in a window and applying
det - k * trace * trace formula to
final Hessian response

* Add docs and make code align with docs

This commit adds docs to new functions,
and makes function and variable names
align with docs to not confuse readers

* Use determinant as response function

A-KAZE uses only determinant in it's
response, and since for now Hessian
is only a mean to advance A-KAZE
implementation, response function is
adjusted to use only determinant

* Create simple test for Hessian detector

This commit adds an s at the end of
function name to make it uniform with
another detector, and adds a simple
test for sanity check

* Improve documentations for d params

dx and similar naming seems to be
confusing, improved documentation
to explain the naming convention

* Address minor comments about style

* Address type based issues

Mostly changes to constness and
integral types, with small cosmetic
changes mixed in

* Fix typo and address review comment

Fixes typo in call for Hessian and
addresses a review comment about
replacing multiple exact indexing
calls to one with a reference

* Reorder includes in Hessian example

* Address review comments

Add literature reference to luminosity
computation, and perform some cosmetic
changes.
2019-08-21 09:37:53 +03:00
Olzhas Zhumabek
65fda3cf7b
Harris response computation (#350)
* Restore previous state of Harris

This is a fresh start of branch
Harris with manual copying and
placement of code from previous
versions

* Use supplied weights in Harris

Weights passed as arguments were not
used prior to this commit

* Address review comments

Mostly moving brackets and adding
const, but also address MSVC's
max macro

* Make namespace qualification consistent

In file numeric.hpp, there is
full qualification, but harris.hpp
didn't have full qualification,
thus full qualification is added to
harris.hpp

* Add copyright and license notice
2019-08-21 06:06:29 +03:00
MIRAL SHAH
f6c502be02 Fix Boost guidelines violations (#378)
Add copyright notice.
Add protection from the min/max macro.

Closes #376
2019-08-09 17:36:37 +02:00
Mateusz Łoskot
9e76b8b5bf
Mark all non-simple build targets of extension/io as explicit (#370)
This addresses issues during the Boost regression runs, where builders
only provide popular third-party libraries (i.e. libraw is missing).
2019-08-09 10:50:58 +02:00
Olzhas Zhumabek
64ceb37b91 Fix inspection issues in image_processing sources and tests (#377)
Add copyright notice and license text
Add protection from the min/max macro.
Closes #374
Closes #375
2019-08-09 10:01:10 +02:00
MIRAL SHAH
ca696ce6d0
Added 2D convolution definitions to numeric extension (#367)
2D convolution tests added

`convolve` function renamed to `convolve_1d`

closes #356
2019-08-09 03:17:09 +05:30
Mateusz Łoskot
a895b5eb55
Add tests for extension/numeric/pixel_numeric_operations.hpp (#372)
Add new and update existing Doxygen comments describing interfaces in
`extension/numeric/pixel_numeric_operations.hpp`.
2019-08-08 11:10:20 +02:00
Mateusz Łoskot
2607795221
Add test for three color types of PNG with tRNS chunk (#125)
The tests cover issue #117 and pull request #118, extending the coverage
for all color types that may have tRNS chunks:

  - color type 0 (grayscale), the tRNS chunk contains a single gray level
  - color type 2 (truecolor), the tRNS chunk contains a single RGB color
  - color type 3 (indexed color), the tRNS chunk contains a series of
    one-byte alpha values

Add sample PNG files from the "official" test-suite for PNG
created by Willem van Schaik.

Add <define>BOOST_GIL_IO_TEST_ALLOW_READING_IMAGES to Jamfile for PNG tests.
NOTE: Deliberately not defined BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
as it seems to require some extra configuration, currently it causes
some tests to fail. So, Jamfile likely needs more updates and clean-up.

Closes #120
2019-08-07 22:33:21 +02:00
Mateusz Łoskot
bd12f3cc7d
[test] Split pixel_types fixture to integer and float pixel types (#365) 2019-08-06 08:16:11 +02:00
MIRAL SHAH
11c897bb07
2D kernel support added to numeric extension (#361)
Tests for 2D numeric kernel added
2019-08-04 19:46:47 +05:30
Mateusz Łoskot
5d69ccf987
Cast to int to avoid signed/unsignd mismatch 2019-08-01 01:23:18 +02:00
Mateusz Łoskot
67ac10d3ab
Rename test/extension/numeric/convolve_2d.cpp to convolve.cpp (#357)
Accommodate to @miralshah365 's plan in #356 to add `convolve` function.
2019-07-30 08:10:40 +02:00
Mateusz Łoskot
d0c474eb37
Remove test/extension/io/images/pnm/readme.txt [ci skip]
There is no value in it. Contributors will ask on list or GitHub anyway.
2019-07-27 00:18:12 +02:00
Mateusz Łoskot
5d3208ec57
Add tests for extension/numeric/channel_numeric_operations.hpp (#340)
Add static assertions to verify channel types are convertible to
expected result type.

Add new and update existing Doxygen comments describing interfaces in
`extension/numeric/channel_numeric_operations.hpp`.
2019-07-25 09:18:51 +02:00
Olzhas Zhumabek
01c39629f8
Filter generation (#342)
* Implement generation of simple kernels

This commits implements mean and
Gaussian kernel generators,
roughly documents them, and has
tests. But tests for Gaussian have
accuracy problem

* Use difference for testing Gaussian

This commit applies percentage based
difference check on generation of
Gaussian kernels, as exact values are
dependant on platform. The error margin
is set to 5% in this commit

* Remove debugging code

In simple_kernels.cpp, there was
some debugging code, mostly streams
related stuff and commented out code,
which is now removed.

* Address review comments

This commit adds inline to kernel
generator functions, uses
std::ptrdiff_t instead of long int,
resolves some conversion warnings
and does small cosmetic changes

* Remove useless iostream include

There was stray include from debugging
code, now removed

* Use \code and \endcode for formula

This commit applies formatting to
formula of normalized mean

* Change are_equal to is_equal

Change a function name in
simple_kernels.cpp test

* Remove redundant function

In simple_kernels.cpp test there was
a function that was not used at all,
now removed

* Cosmetic changes

Mostly opening brackets moved
2019-07-23 06:14:02 +06:00
Mateusz Łoskot
90e5e1738f
Add test for convolve function from Numeric extension (#349)
Minimal test for new function added in #347 (with identity kernel only).
2019-07-22 18:59:21 +02:00
MIRAL SHAH
6bdc48c615
Otsu threshold implemented (#314)
closes #311
2019-07-20 03:10:25 +05:30
Mateusz Łoskot
516ee84f1c
Include <iostream> only if BOOST_GIL_TEST_DEBUG defined [ci skip] 2019-07-18 23:01:20 +02:00
Mateusz Łoskot
584cdd4e23
Modify random_value fixture test to cope with repeated values (seeding issue) 2019-07-18 21:37:39 +02:00
Mateusz Łoskot
89436c9cdc
Include boost/core/typeinfo.hpp where used
Refines #338
2019-07-18 19:57:19 +02:00
Mateusz Łoskot
dafcaa169e
Extract GIL-specific Boost.Test utilities from test/unit_test.hpp (#338)
Add separate header `test/unit_test_utility.hpp` for printers and
other utilities for better integration of GIL types with Boost.Test.
2019-07-18 17:49:05 +02:00
MIRAL SHAH
8234329237
New threshold tests added for multi-channel views 2019-07-18 01:32:29 +05:30
Mateusz Łoskot
d7884ee1a6
Fix parameters type of subimage_view functions in core and dynamic_image (#337)
Align with `subsampled_view` overloads accepting `point_t` and `coord_t`
Both types are based on `std::ptrdiff_t`. Fixes compilation warnings.
Tidy up `subimage_view` and `subsampled_view` with trailing return.
Add tests for `subimage_view` in core and dynamic_image extension.
(First tests for the dynamic_image, hurray! :))

Add explicit cast to double in division operator for point<T> to
fix compilation warnings.
2019-07-16 13:05:48 +02:00
Mateusz Łoskot
73314b19a6
[numeric] Correct name of BOOST_TEST_MODULE [ci skip] 2019-07-14 23:00:47 +02:00
Mateusz Łoskot
9ce3f08a36
Add first tests for convolve functions from Numeric extension (#335)
First stab at convolution tests includes cases with the identity kernel.
Move `pixel`-s streaming facility used by Boost.Test (required  by
`BOOST_TEST` macro) to the common header for re-use in other tests.
2019-07-14 21:43:32 +01:00
Mateusz Łoskot
48679777d7
Fix error: RView identifier not found in planar_rgba_view (#332)
Add basic run-time test of `planar_rgba_view` function.
Add missing includes of `pixel.hpp` and `planar_pixel_reference.hpp`
also required for successful compilation.

Fixes #331
2019-07-12 12:32:17 +01:00
Mateusz Łoskot
0809f2de71
Add color_spaces_are_compatible requirement as static_assert to threshold (#329)
Since use of `gil_function_requires` check is optional, it can be
disabled by not defining `BOOST_GIL_USE_CONCEPT_CHECK`, we need
a mandatory form of the check.
Add compile-time test verifying the static assertion.
Closes #323
2019-07-10 11:20:41 +01:00
Mateusz Łoskot
bf8e0dd1cf
Add threshold_truncate.cpp missing from Jamfile 2019-07-10 09:44:18 +02:00
Mateusz Łoskot
ee169ef104
Unify names of files and targets of image processing tests [skip ci] 2019-07-05 00:20:38 +02:00
Mateusz Łoskot
ab4c686970
[numeric] std::extent not usable to obtain size of kernel_1d_fixed (#320)
Use of `std::extent` was introduced in PR #200 but it turns out as
not applicable for `std::array` or derived types (e.g. `kernel_1d_fixed`).
This led to obtaining invalid size of `kernel_1d_fixed` and erroneous
results of the rows and columns convolution.
This change replaces `std::extent` with new public constant member
`kernel_1d_fixed::static_size`.

Since `kernel_1d_fixed` is derived from `std::array`, the Alternative
could be to use `std::tuple_size` specialization for `std::array`.

Add static assertion to require that kernel size must be odd to
ensure validity at the center.
2019-07-04 20:45:33 +02:00
Mateusz Łoskot
7f23184076
Add basic test for color base algorithm: static_transform (#319)
The test also illustrates and verifies that the `static_transform` is
constrained by the size of destination color base. That is, it is
applicable if the source color base has number of elements equal-to or
greater-than the destination color base.
2019-07-03 07:40:48 +02:00
Mateusz Łoskot
c6cb094ce9
Clarify use of gray_layout_t in homogeneous_color_base tests for N>1 2019-07-02 20:21:53 +02:00
Mateusz Łoskot
67c3ac77c9
Add kernel test to numeric/Jamfile (#318)
Change missing from #317
2019-06-30 20:52:41 +02:00
Mateusz Łoskot
b4a69319bc
Add tests for kernel_1d and kernel_1d_fixed classes (#317)
Add FIXME and TODO comments about issues that needs to be clarified.
2019-06-29 10:38:24 +02:00
Olzhas Zhumabek
cf897c5969
Implementation of lanczos down scaling (#309)
* Simple implementation of lanczos scaling

* Simple implementation of lanczos scaling

* Refactor lanczos into separate header

This commit moves the algorithm
into its own header. It also provides
templated interface now, utilizing
a little bit of decltype and declval
to resolve types for lambdas and stuff

* Zero pixel at start of lanczos_at

This commit fixes a possible bug and
fixes some style incosistencies

* Improve documentation for Lanczos

This commit adds documentation which
describes when to use the algorithm,
a brief description of how it is
supposed to work, and some caution
on the quality of the output

* Address style issues and fix warnings

This commit fixes a style issue realted
to namespace declaration and
fixes a warning in added zeroing of
a pixel at start of lanczos

* text-realign function arguments

* fix formatting issues

* Implement handful of sanity tests

This commit introduces a couple of
sanity tests such as black image
scaling to black image, and lanczos
response being 0 at x = 0

* bracket on newline for for loops

* add lanczos scaling to tests

* more precision in lanczos calculation

This commit migrates integral values
to double precision and uses PI
provided by boost.Math. These changes
solve downscaled image being darker

* Simple implementation of lanczos scaling

* Refactor lanczos into separate header

This commit moves the algorithm
into its own header. It also provides
templated interface now, utilizing
a little bit of decltype and declval
to resolve types for lambdas and stuff

* Zero pixel at start of lanczos_at

This commit fixes a possible bug and
fixes some style incosistencies

* Improve documentation for Lanczos

This commit adds documentation which
describes when to use the algorithm,
a brief description of how it is
supposed to work, and some caution
on the quality of the output

* Address style issues and fix warnings

This commit fixes a style issue realted
to namespace declaration and
fixes a warning in added zeroing of
a pixel at start of lanczos

* text-realign function arguments

* fix formatting issues

* Implement handful of sanity tests

This commit introduces a couple of
sanity tests such as black image
scaling to black image, and lanczos
response being 0 at x = 0

* bracket on newline for for loops

* add lanczos scaling to tests

* more precision in lanczos calculation

This commit migrates integral values
to double precision and uses PI
provided by boost.Math. These changes
solve downscaled image being darker

* Add Jamfile for ip test directory

Add Jamfile for image_processing
test directory and build-project
from outer test directory

* Add IP test directory to ci build

This commit adds a line at the end
of .ci/build-and-test.sh to include
image processing tests in CI builds

* Remove redundant lines from Jamfile

Simplify Jamfile at
test/image_processing

* Rewrite range condition

x > -a && x < a exchange with
-a < x && x < a in lanczos

* Add newline at the end of files

* Add math and lexical_cast to get-boost

As math and lexical_cast are used
in lanczos scaling, both were added
to get-boost

* Revert "Add newline at the end of files"

Since Boost.Math.Constants is
overengineered for use case by
requiring Boost.lexical_cast or
a global define, it is removed

This reverts commit 0743ab072ff3455421853697f7f46aee7d22382c.

* Define pi and use in lanczos

Value of pi is moved out into detail
and used by lanczos

* Move image_processing to test/core

* formatting fixes

* Adjust CMakeLists for moved IP tests

This commit removes image_processing as
subdirectory from test/ and adds to
test/core's CMakeLists

* Remove unused from get-boost

Since lanczos scaling no longer uses
boost.math.constants, lexical_cast
has been removed as well

* Downgrade math to transitive dep

This is a stray change left from
my incorrect resetting of the HEAD
on lanczos branch

* Remove unnecessary includes

io includes are not used in lanczos
scaling test, and they break build

* Fix ambiguous overload issue for min

Since width() and height()  now return
std::ptrdiff_t, call to std::min needs
a cast. There was also shadowing of
pi declared in detail/math.hpp,
which is also fixed

* Apply mloskot's patch

The patch provided by Mateusz changes
all usages of long int into ptrdiff_t,
which is returned by width() and
height() functions of image_view

* Apply .editorconfig rules

This commit is a simple reformat of
affected files

* Use aliases x_coord_t and y_coord_t

The change converges integer handling
in arguments, using view' type aliases.
View arguments have to come first to
avoid non-deduced context problem.
Also replaced long int with ptrdiff_t
in lanczos, in numeric.hpp file

* Apply alias usage for rest of the code

Some places with ptrdiff_t were
left out from previous commit, so they
are changed in this one. Plus a fix for
max call being ambiguous.

* Replace all literals with casted vars

This commit takes extreme stance of
never using an integer literal due to
problems in ambiguity of deduction of
min and max functions

* Fix unenclosed foreach

During rebase of gsoc2019 onto develop,
I didn't enclose first foreach with
matching endforeach, hence tests failed
2019-06-23 13:14:23 +03:00
MIRAL SHAH
716fe9ad8c Implement algorithms for binary and binary inverse thresholding (#313)
Add public functions threshold_binary and threshold_truncate.
Add tests and example.
Closes #310
2019-06-18 21:42:43 +02:00
Mateusz Łoskot
baeac8ce87
Disable BOOST_GIL_USE_CONCEPT_CHECK when compiling tests with clang (#304)
Avoid Clang flooding with non-disableable warnings like:

   T does not declare any constructor to initialize its non-modifiable members

when compiling with concepts check enabled.

Bug 41759: `warn_no_constructor_for_refconst` can not be disabled (Boost.ConceptCheck)
https://bugs.llvm.org/show_bug.cgi?id=41759
2019-06-02 06:13:04 +02:00
Mateusz Łoskot
4ed7701b47
Move tests of extensions inside test/ directory (#302)
Split header tests accordingly i.e. test core headers as part of
core tests, numeric extension headers as part of numeric tests, etc.

It extends the convention of sub-directories already established in
`include/boost/gil` directory. It is sensible to follow it in other
areas of the source tree (i.e. `test/`, `doc/` and `benchmark/`).

Another important reason to move the tests is to enable removal of
the top-level `Jamfile` with all its definitions of test-specific
requirements.
The top-level `Jamfile` is not advised, especially if it specifies
build requirements like C++ language version.
Those affect non-tests builds e.g. documentation, causing failures
during generation of HTML documentation (leads to missing docs).
2019-05-28 18:58:22 +02:00
Mateusz Łoskot
4dc3836449
[cmake] Rationalise names of tests vs targets 2019-05-23 01:15:44 +02:00
Mateusz Łoskot
10f1efff5b
[cmake] Name targets of legacy tests with legacy_ prefix [ci skip] 2019-05-06 12:04:41 +02:00