Example of basic Image and View functions.
#include <iostream>
using namespace std;
int main(void)
{
    
    
    
    y({ 0,0,0 }) = 15; y({ 1,0,0 }) = 16; y({ 2,0,0 }) = 17; y({ 3,0,0 }) = 18; y({ 4,0,0 }) = 19;
    y({ 0,1,0 }) = 25; y({ 1,1,0 }) = 26; y({ 2,1,0 }) = 27; y({ 3,1,0 }) = 28; y({ 4,1,0 }) = 29;
    y({ 0,2,0 }) = 35; y({ 1,2,0 }) = 36; y({ 2,2,0 }) = 37; y({ 3,2,0 }) = 38; y({ 4,2,0 }) = 39;
    y({ 0,3,0 }) = 45; y({ 1,3,0 }) = 46; y({ 2,3,0 }) = 47; y({ 3,3,0 }) = 48; y({ 4,3,0 }) = 49;
    y({ 0,0,1 }) = 17; y({ 1,0,1 }) = 16; y({ 2,0,1 }) = 10; y({ 3,0,1 }) = 17; y({ 4,0,1 }) = 19;
    y({ 0,1,1 }) = 27; y({ 1,1,1 }) = 26; y({ 2,1,1 }) = 20; y({ 3,1,1 }) = 27; y({ 4,1,1 }) = 29;
    y({ 0,2,1 }) = 37; y({ 1,2,1 }) = 36; y({ 2,2,1 }) = 30; y({ 3,2,1 }) = 37; y({ 4,2,1 }) = 39;
    y({ 0,3,1 }) = 47; y({ 1,3,1 }) = 46; y({ 2,3,1 }) = 40; y({ 3,3,1 }) = 47; y({ 4,3,1 }) = 49;
    y({ 0,0,2 }) = 15; y({ 1,0,2 }) = 17; y({ 2,0,2 }) = 17; y({ 3,0,2 }) = 18; y({ 4,0,2 }) = 17;
    y({ 0,1,2 }) = 25; y({ 1,1,2 }) = 27; y({ 2,1,2 }) = 27; y({ 3,1,2 }) = 28; y({ 4,1,2 }) = 27;
    y({ 0,2,2 }) = 35; y({ 1,2,2 }) = 37; y({ 2,2,2 }) = 37; y({ 3,2,2 }) = 38; y({ 4,2,2 }) = 37;
    y({ 0,3,2 }) = 45; y({ 1,3,2 }) = 47; y({ 2,3,2 }) = 47; y({ 3,3,2 }) = 48; y({ 4,3,2 }) = 47;
    
    cout << "Executing RearrangeChannels" << endl;
    
    cout << "Executing CopyImage" << endl;
    
    if (!
ImRead(
"../examples/data/test.jpg", img)) {
         return EXIT_FAILURE;
    }
    
    
    
    cout << "Executing ChangeColorSpace" << endl;
    
    
    Image img1, img2, img3, img4;
     ImRead(
"../examples/data/img0003.png", img1);
     cout << "Create a thumbnail 32x32 from an Image" << endl;
    std::vector<uint32_t> accum(32);
    std::vector<uint32_t> count(32);
    uint32_t* paccum, *pcount;
    for (
int dr = 0, sr = 0, w = v3.
width(), h = v3.
height(); sr < h; ++dr) {
         memset(paccum = accum.data(), 0, 32 * 4);
        memset(pcount = count.data(), 0, 32 * 4);
        while (sr * 32 / h == dr) {
            paccum = accum.data();
            pcount = count.data();
            for (int dc = 0, sc = 0; sc < w; ++sc) {
                *paccum += *i;
                *pcount += 1;
                ++i;
                if (sc * 32 / w > dc) {
                    ++dc;
                    ++paccum;
                    ++pcount;
                }
            }
            sr++;
        }
        std::transform(begin(accum), end(accum), begin(count), pout, std::divides<uint32_t>());
        pout += 32;
    }
    
    cout << "Create an empty Image" << endl;
    ImRead(
"../examples/data/img0015.png", img2);
     Image dst1, dst2, dst3, dst4, dst5;
     cout << "Executing arithmetic functions" << endl;
    
    
    
    Mul(img4, 256 * 256 * 128, dst3);
     
    
    cout << "Create a mask" << endl;
    auto radius = float(std::min(vmask.
width() / 2, vmask.
height() / 2));
     int cx = vmask.
width() / 2;
     for (
int y = 0; y < vmask.
height(); ++y) {
         int ry = y - cy;
        for (
int x = 0; x < vmask.
width(); ++x) {
             int rx = x - cx;
            auto rd = static_cast<float>(sqrt(rx * rx + ry * ry) / radius);
            vmask(x, y, 0) = vmask(x, y, 1) = vmask(x, y, 2) = std::max(0.f, 1 - rd);
        }
    }
    return EXIT_SUCCESS;
}