2
0
mirror of https://github.com/boostorg/gil.git synced 2026-01-28 07:12:14 +00:00
Commit Graph

173 Commits

Author SHA1 Message Date
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
Mateusz Łoskot
6832ad6ac6 Ignore -Wsign-conversion warning from Boost.Test 2019-05-02 10:05:09 +02:00
Mateusz Łoskot
e0c27a337a Disable free operator* of point<T> for non-arithmetic operand (#295)
Add Boost.Build-only test to verify compilation failure.

Fixes #289 as much better solution than #294 workaround.
Closes #294
2019-04-29 20:59:51 +02:00
Mateusz Łoskot
c9ccc83551 Officially drop support for GCC <= 4.8 (#296)
Although GCC 4.8 is labelled as C++11 compatible, the reasons are:

* GCC 4.8 is buggy enough to prevent reasonable use of Boost.MP11
* GCC 4.8 is dying

Closes #282
2019-04-28 15:50:56 +02:00
Mateusz Łoskot
5611bd5807 Replace Boost.MPL with Boost.MP11 (#274)
Use type traits and features of C++11, then use Boost.MP11.
Remove unused and unnecessary metafunctions in `detail` namespace.
Remove explicit access to ::type as no longer necessary with MP11.
Clean up and reformat code according to the current guidelines.

Legacy tests have been updated where necessary to accommodate
switch to MP11.

Replace std::is_integral with gil::detail::is_channel_integral
Replacing boost::is_integral with std::is_integral is C++ UB:

    C++11 / 20.11.2 Header <type_traits> synopsis
    1 The behavior of a program that adds specializations for any
    of the class templates defined in this subclause is undefined
    unless otherwise specified.


Implements also proposal in #93
Closes #229
2019-04-14 22:13:45 +02:00
Mateusz Łoskot
a0c5eb3d35 [test] Fix CMake status message [ci skip] 2019-04-13 19:10:09 +02:00
Mateusz Łoskot
7db51faff3 Cast scoped_channel_value to integer prior comparin to an integer 2019-04-09 22:09:34 +02:00
Mateusz Łoskot
8d2a90bf1b Add missing #include <iostream> in test 2019-04-02 22:08:51 +02:00
Mateusz Łoskot
c6c5336cc0 Value-initialize channel and pixel value members (#273)
Add tests to ensure member values of channel and pixel classes are
determined, zero-initialized.
Fixes #270

Tidy up formatting.
2019-04-01 17:19:22 +01:00
Mateusz Łoskot
715d760be8 Add build-project color missing from test/Jamfile 2019-03-25 20:38:17 +01:00
Mateusz Łoskot
35d7e57a41 Update test of packed_pixel with run-time checks (#269)
Test additional packed_pixel variants for 3-bit gray and 535-bits rgb.
2019-03-25 08:02:19 +01:00
Mateusz Łoskot
0f9b6c4ddf Add test for packed_channel_value and is_integral specialization (#268) 2019-03-25 07:54:29 +01:00
Mateusz Łoskot
d381474813 Fix warnings about unused variables in tests [ci skip] 2019-03-21 19:33:11 +01:00
Mateusz Łoskot
b4a7fda6d6 Fix warning: no return statement in function returning non-void 2019-03-21 18:33:54 +01:00
Mateusz Łoskot
11e8fee5d4 Fix warning about unreferenced local variable 2019-03-21 09:43:28 +01:00
Nikita Kniazev
33d4ac05ae Use just ::value where is possible (#262)
The ::value member is common convention of all MPL and TypeTraits metafunctions.

Fixes VS2015 failures (#261)
2019-03-19 20:34:11 +01:00
Mateusz Łoskot
d3c1a2eff4 Add test for some bit-aligned pixel types and metafunctions (#257)
Test bit_aligned_pixel_reference and packed_pixel as well as
some of related metafunctions generating types of their
members and intermediate specializations.
2019-03-13 19:15:33 +01:00
Mateusz Łoskot
a0f3bb7659 Use class for template template parameter (#251)
The current definition using `typename` fails when compiling
with GCC 4.8 and 4.9, because `typename` is allowed since C++17.
2019-03-05 07:54:14 +01:00
Mateusz Łoskot
b1998d9a74 Add pixel test fixture with all core pixel types (#248)
Add test for pixel_reference_is_mutable metafunction.

From the legacy tests
- port value_core and reference_core fixtures, see
  https://lists.boost.org/boost-gil/2019/02/0138.php
- port representative pixel types and verify with tests of some
  metafunctions.

Clean up test names for CTest in the CMake configuration.
Disable some GCC/clang warnings in tests to avoid CI build
termination due to too long logs.
2019-03-02 23:18:54 +01:00
Mateusz Łoskot
5323eb7c5a Remove repeated gray16_pixel_t from test list 2019-03-01 00:44:36 +01:00
Mateusz Łoskot
d73e6415c8 Rename channel_test_fixture.hpp to test_fixture.hpp
* It lives in channel/ directory, so the prefix is superfluous
* New name makes a convention for fixture headers for other test topics

Add missing and rename existing include guards.
2019-02-28 21:40:44 +01:00
Mateusz Łoskot
61c23b0529 Add test for some channel, color and pixel metafunctions (#247) 2019-02-27 08:19:44 +01:00
Mateusz Łoskot
1541d5cf8a Add test for pixels_are_compatible metafunction (#245) 2019-02-26 22:14:34 +01:00
Mateusz Łoskot
998d1b1bbe Add tests for dynamic_{x,y}_step_type specializations (#243)
Basic verification expected specializations of `dynamic_x_step_type`
and `dynamic_y_step_type` are in place.
2019-02-25 07:11:46 +00:00
Mateusz Łoskot
213b55c6ad Add test for iterator concepts (#242) 2019-02-24 18:15:06 +00:00
Mateusz Łoskot
48db4f51a3 Add test for locator concepts (#241) 2019-02-23 11:16:57 +00:00
Mateusz Łoskot
cf6627389f Update test/channel/concepts.cpp name in build config
Change missing from SHA-1:3d8469eafe59bc3fef3052bad375704614023e9d
2019-02-22 22:09:23 +01:00