All_of, any_of, none_of

  • Include <mln/core/algorithm/all_of.hpp>

  • Include <mln/core/algorithm/any_of.hpp>

  • Include <mln/core/algorithm/none_of.hpp>

  1. bool all_of(InputImage ima, std::UnaryPredicate p)
  2. bool all_of(InputImage ima)
  3. bool any_of(InputImage ima, std::UnaryPredicate p)
  4. bool any_of(InputImage ima)
  5. bool none_of(InputImage ima, std::UnaryPredicate p)
  6. bool none_of(InputImage ima)
    • 1,3,5) Checks that all, any or none of the image values verify the preficate

    • 2,4,6) Checks that all, any or none of the image values evaluate to true

    Parameters:
    • ima – The image to test

    • p – The unary predicate that will be applied on values

    Template Parameters:
    • InputImage – A model of InputImage

    • std::UnaryPredicate – A model of std::UnaryPredicate

    Returns:

    True or false

Examples

  1. Check that all values are non-negative:

    mln::image2d<uint8_t> f = ...;
    bool res1 = mln::all_of(f, [](uint8_t x) { x > 0; }); // Version 1
    bool res2 = mln::all_of(f > 0);
    

Complexity

Linear in the number of pixels.