#include <stdio.h>
#include <cstdlib>
 
 
}
 
static const float h_gauss[] = {
    0.0318f, 0.0375f, 0.0397f, 0.0375f, 0.0318f, 0.0375f, 0.0443f,
    0.0469f, 0.0443f, 0.0375f, 0.0397f, 0.0469f, 0.0495f, 0.0469f,
    0.0397f, 0.0375f, 0.0443f, 0.0469f, 0.0443f, 0.0375f, 0.0318f,
    0.0375f, 0.0397f, 0.0375f, 0.0318f,
};
 
static const float h_sobel[] = {-2.0, -1.0, 0.0, -1.0, 0.0, 1.0, 0.0, 1.0, 2.0};
 
static void img_test_demo() {
 
    
 
    
    array img_gray = 
loadImage(ASSETS_DIR 
"/examples/images/trees_ctm.jpg",
 
                               false);  
        loadImage(ASSETS_DIR 
"/examples/images/sunset_emp.jpg", 
true) /
 
        255.f;  
 
    
    array thrs_img = (img_gray < 130.f).as(
f32);
 
 
    
    channel_split(img_rgb, rr, gg, bb);
 
    
    channel_split(hsv, hh, ss, vv);
 
    
 
 
    while (!wnd.close()) {
        wnd.grid(2, 4);
 
        
        wnd(0, 0).image(img_rgb, "Input Image");
        wnd(1, 0).image(rotatedImg, "Rotate");
 
        wnd(0, 1).image(ss, "Saturation");
        wnd(1, 1).image(bb, "Blue Channel");
 
        wnd(0, 2).image(smt, "Smoothing");
        wnd(1, 2).image(thrs_img, "Binary Thresholding");
 
        wnd(0, 3).image(inorm, "Histogram Equalization");
        wnd(1, 3).image(edge_det, "Edge Detection");
 
        wnd.show();
    }
}
 
int main(int argc, char** argv) {
    int device = argc > 1 ? atoi(argv[1]) : 0;
 
    try {
        printf("** ArrayFire Image Demo **\n\n");
        img_test_demo();
 
        fprintf(stderr, 
"%s\n", e.
what());
        throw;
    }
 
    return 0;
}
Window object to render af::arrays.
A multi dimensional data container.
An ArrayFire exception class.
virtual const char * what() const
Returns an error message for the exception in a string format.
@ f32
32-bit floating point values
array abs(const array &in)
C++ Interface to calculate the absolute value.
void setDevice(const int device)
Sets the current device.
array colorSpace(const array &image, const CSpace to, const CSpace from)
C++ Interface wrapper for colorspace conversion.
array histEqual(const array &in, const array &hist)
C++ Interface for histogram equalization.
array histogram(const array &in, const unsigned nbins, const double minval, const double maxval)
C++ Interface for histogram.
array loadImage(const char *filename, const bool is_color=false)
C++ Interface for loading an image.
array convolve(const array &signal, const array &filter, const convMode mode=AF_CONV_DEFAULT, const convDomain domain=AF_CONV_AUTO)
C++ Interface for convolution any(one through three) dimensional signals.
seq span
A special value representing the entire axis of an af::array.