Count If
Include <mln/core/algorithm/count.hpp>
-
std::ptrdiff_t count(InputImage ima, const Value &v)
Count the number of pixel whose value is v in ima.
- Parameters:
ima – The image to be traversed
v – The value to be counted
- Template Parameters:
InputImage – A model of
InputImage
Value – A model of
Value
- Returns:
number of v in ima
Examples
Count the number of v in an image:
mln::image2d<mln::rgb8> ima = ...; mln::rgb8 v = ...; std::ptrdiff_t nb_v = mln::count(ima, v);
Complexity
Linear in the number of pixels.