How it works...
At step 2, we are describing the types of images we wish to work with. These images are gray images with 8 and 16 bits per pixel and RGB pictures with 8 bits per pixel.
The boost::gil::any_image<img_types> class is a kind of Boost.Variant that may hold an image of one of the img_types variables. As you may have already guessed, boost::gil::png_read_image reads images into image variables.
The boost::gil::apply_operation function at step 4 is almost equal to boost::apply_visitor from the Boost.Variant library. Note the usage of view(source). The boost::gil::view function constructs a light wrapper around the image that interprets it as a two-dimensional array of pixels.
Do you remember that for Boost.Variant we were deriving ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access