#include <stdio.h>
#include <cstdlib>
}
static const float h_gauss[] = {
0.0318, 0.0375, 0.0397, 0.0375, 0.0318,
0.0375, 0.0443, 0.0469, 0.0443, 0.0375,
0.0397, 0.0469, 0.0495, 0.0469, 0.0397,
0.0375, 0.0443, 0.0469, 0.0443, 0.0375,
0.0318, 0.0375, 0.0397, 0.0375, 0.0318,
};
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);
array img_rgb =
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);
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");
}
}
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;
}