Commit Graph

328 Commits

Author SHA1 Message Date
Mateusz Łoskot
84b155630d
Remove include/boost/gil/version.hpp file as unused (#403)
Motivation:

  - GIL is part of Boost collection, so Boost version is sufficient
  - GIL version makes little sense unless GIL becomes independent
  - Two distinct version numbers, Boost's and GIL's, are confusing.
  - Role of GIL's version number is not documented thus not entirely clear

The removal was discussed and agreed upon in this thread
https://lists.boost.org/boost-gil/2019/11/0346.php
2019-11-09 23:09:09 +01: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
29208c7301
Fix void istream_device::read function returning a value (#399)
Tidy up istream_device::read function format
2019-10-29 08:56:54 +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
Mateusz Łoskot
7ff2730f45
Remove threshold_optimal_value::triangle enumerator as not implemented
This is part of planned work that has not been completed yet, see
@lpranam comments https://lists.boost.org/boost-gil/2019/10/0315.php
2019-10-23 21:49:14 +02:00
MIRAL SHAH
8f1bd53fec
Implemented median_filter (#393)
tests for median_filter added
2019-10-15 10:12:54 +05:30
Pranam Lashkari
90f6fc04ed convolve_boundary_option renamed to boundary_option (#390)
`boundary_option` moved to `numeric/algorithm.hpp`

Closes #387
2019-09-18 11:48:20 +02:00
Pranam Lashkari
6a1c99a33c Implement image boundary extension algorithm (#386) 2019-09-05 20:47:21 +02:00
Jean-David Gadina
bd00f91b07 Fix crash when reading PNG files with an invalid header (#385)
Removed assertions, as they prevent the expected
`std::ios_base::failure` exception to be caught in such a case.
2019-08-26 19:41:58 +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
5f612ccf7a
added definition of gaussian adaptive threshold (#379)
closes #316
2019-08-20 02:04:11 +05:30
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
Jan Houska
48e35c147f Removed asserts and replaced by exceptions for checking of runtime errors (#369)
The runtime errors such as zero-length file or disk full.
Unified error message wording.
2019-08-09 10:04:17 +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
8b58ef051d
Tidy up comma followed by whitespace 2019-08-08 00:09:37 +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
8815ab0554
Clarify correlation as cross-correlation and convolution as spatial convolution (#339) [ci skip]
Discussion at https://lists.boost.org/boost-gil/2019/07/0268.php

[ci skip]
2019-07-30 15:01:41 +02:00
MIRAL SHAH
5f005b0692
Add adaptive threshold algorithm using mean method (#341)
* Mean adaptive threshold implemented with the example
Implements #315
2019-07-26 01:36:43 +05:30
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
Mateusz Łoskot
c2b406d907
Update docs for threshold_binary function and enums [ci skip] (#333)
Prefer C++ style comments for Doxygen.
2019-07-23 07:46:58 +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
f2d0958e26
Fix implicitly-declared copy constructor is deprecated in planar_pixel_reference.hpp
Add TODO comment on: What is the purpose of returning via const reference?
2019-07-22 23:24:38 +02:00
Mateusz Łoskot
f0278957e7
Fix implicitly-declared assignment operator is deprecated in planar_pixel_reference.hpp
Rename abbreviated template parameters to more self-descriptive names.
Tidy up formatting and code flow for readability.
2019-07-22 23:12:37 +02:00
Mateusz Łoskot
1bbd9bed37
Fix implicitly-declared assignment operator is deprecated in virtual_locator.hpp
Avoid discouraged naming with leading underscore for class member variables.

Rename cryptic `_p` member variable as `y_pos_` to clearly indicate its
purpose as current position of `y_iterator`.
Rename abbreviated template parameters to more self-descriptive names (e.g.
Deref to DerefFn to indicate it is type of a function object).

Remove superfluous `public` keywords from base types fo struct-s.
Tidy up formatting and code flow for readability.
2019-07-22 23:08:39 +02:00
Mateusz Łoskot
ee7e4b1a5e
Fix implicitly-declared assignment operator is deprecated in channel.hpp 2019-07-22 23:04:36 +02:00
Mateusz Łoskot
793fbbd28d
Fix implicitly-declared assignment operator is deprecated in extension/numeric/kernel.hpp
Avoid discouraged naming with leading underscore for class member variables.
Avoid abbreviations in names.
Add assertions checks for non-empty kernel.
2019-07-22 23:02:39 +02:00
Mateusz Łoskot
ddea00494e
Ignore -Wconversion from Boost.Iterator headers
Fixes annoying warnings from third-party Boost headers.
2019-07-22 22:03:45 +02:00
Mateusz Łoskot
ff82646802
Remove unused result_channel_t type alias from threshold.hpp
Fixes compiler warning:

  typedef `using result_channel_t = typename boost::gil::channel_type<XIt>::type`
    locally defined but not used [-Wunused-local-typedefs]
2019-07-22 21:44:44 +02:00
Mateusz Łoskot
e0f2787312
Prefer x_coord_t and y_coord_t aliases for values of image_view dimensions
Fixes annoying compiler warnings that implicit conversion from `y_coord_t`
`{aka long int}` to `int` may change value `[-Wconversion]`.
Add missing #include <type_traits>.

Rename `rr` to `y` to clarify it is vertical indexing of pixel lines,
it also indicates the correspondence with y_coord_t  better.
Rename CamelCase, incorrectly introduced in 055ee947a0,
for using-declared type aliases to `lower_case_t` convention.

Add Doxygen comments and placeholders for documentation content to fill.
Tidy up formatting and code flow for readability.
2019-07-22 21:12:18 +02:00
Mateusz Łoskot
1d4267d520
Assert user-specified positions within image or image_view are in range (#344)
These assertions validating user-specified x and y values for pixel
positions at run-time should help GIL users to catch basic mistakes
as early as possible, especially during complex processing algorithms.
(Easy to make a mistake calling `view(y, x)` instead of `view(x, y)`!)

The checks are deliberately implemented using assertions as debug-only
tools disabled in `NDEBUG` builds, and not as exceptions to avoid
potentially significant performance hit at run-time in optimised builds.

Add `TODO` comments where certain assumptions are not immediately
obvious and may require further testing to clarify and documenting.
For example, what are constraints on requesting locators with
negative offsets using `image_view::xy_at`?

Tidy up image.hpp and image_view.hpp formatting vertically rather than
horizontally with very long lines, align return statements to left for
immediate display what is calculated and returned, instead of hiding it
behind the right margin.
2019-07-22 19:26:36 +02:00
Mateusz Łoskot
055ee947a0
Clean up and refactor extension/numeric/convolve.hpp
- Tidy up formatting and code flow for readability
- Rename parameters for clarify, avoiding abbreviations
- Rename typedefs in CamelCase style instead of UPPER_CASE
- Add Doxygen comments and placeholders for documentation content to fill
2019-07-22 13:23:24 +02:00
Pranam Lashkari
2c4529ed95 Add convolve function in Numeric extension (#347)
This function combines both `convolve_rows` and `convolve_cols` into
single call for user convenience
2019-07-22 11:20:57 +02:00
MIRAL SHAH
6bdc48c615
Otsu threshold implemented (#314)
closes #311
2019-07-20 03:10:25 +05:30
Mateusz Łoskot
69adf0e8a5
Fix ENABLE_GRAY_ALPHA macro name to BOOST_GIL_IO_ENABLE_GRAY_ALPHA 2019-07-17 22:05:13 +02:00
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
b1a382c45b
Compare float-pointing value to zero using <= operator (#336) 2019-07-16 02:33:19 +02:00
Mateusz Łoskot
da2e4722bf
threshold.hpp: Remove unused type alias 2019-07-14 17:24:47 +02: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
MIRAL SHAH
3f42ff847d
comparison operator changed to > from >= for threshold value comparison 2019-07-11 04:18:12 +05:30
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
35a5bdc190
Add image_processing/scaling.hpp to boost/gil.hpp (#330) 2019-07-10 09:59:42 +02:00
Mateusz Łoskot
266bf414aa
Tidy up headers in gil/image_processing/ directory (#326)
Add missing `inline` specifier for tiny functions.
Add missing include guards.
Add missing copyright notice.
Remove superfluous `boost::gil::` namespace qualifiers.
Make use of 100 characters line length limit:
 - Remove superfluous newlines to avoid too much of vertical stretch.
 - Tidy up Doxygen comments.
2019-07-09 10:01:43 +02:00
Tyler Deuty
92c8cc72e4 Add suppressive parentheses for function-like macro (#328)
Work around clash between min/max macros defined in Windows SDK
headers and C++ functions like std::min/max, std::numeric_min/max,
without requiring users to #define NOMINMAX.
2019-07-09 10:01:01 +02:00
Mateusz Łoskot
74c497c36f
Apply the rule of three in memory_based_2d_locator and iterator_from_2d (#324)
Add copy assignment operator to memory_based_2d_locator and iterator_from_2d.
Add copy constructor to image_view which already has copy assignment operator.

Fix GCC 9 warning -Wdeprecated-copy that:

  "implicit declaration of a copy constructor or copy assignment operator
  is deprecated if the class has a user-provided copy constructor or
  copy assignment operator, in C++11 and up."
2019-07-07 13:58:04 +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