MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / pyramids_demo

Function pyramids_demo

examples/image_processing/pyramids.cpp:45–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void pyramids_demo() {
46 af::Window wnd_rgb("Image Pyramids - RGB Images");
47 af::Window wnd_gray("Image Pyramids - Grayscale Images");
48 wnd_rgb.setPos(25, 25);
49 wnd_gray.setPos(150, 150);
50
51 array img_rgb =
52 loadImage(ASSETS_DIR "/examples/images/atlantis.png", true) /
53 255.f; // 3 channel RGB [0-1]
54 array img_gray = colorSpace(img_rgb, AF_GRAY, AF_RGB);
55
56 array downc1 = pyramid(img_rgb, 1, true);
57 array downc2 = pyramid(img_rgb, 2, true);
58 array upc1 = pyramid(img_rgb, 1, false);
59 array upc2 = pyramid(img_rgb, 2, false);
60
61 array downg1 = pyramid(img_gray, 1, true);
62 array downg2 = pyramid(img_gray, 2, true);
63 array upg1 = pyramid(img_gray, 1, false);
64 array upg2 = pyramid(img_gray, 2, false);
65
66 while (!wnd_rgb.close() && !wnd_gray.close()) {
67 wnd_rgb.grid(2, 3);
68 wnd_rgb(0, 0).image(img_rgb, "color image");
69 wnd_rgb(1, 0).image(downc1, "downsample 1 level");
70 wnd_rgb(0, 1).image(downc2, "downsample 2 levels");
71 wnd_rgb(1, 1).image(upc1, "upsample 1 level");
72 wnd_rgb(0, 2).image(upc2, "upsample 2 level");
73 wnd_rgb.show();
74
75 wnd_gray.grid(2, 3);
76 wnd_gray(0, 0).image(img_gray, "grayscale image");
77 wnd_gray(1, 0).image(downg1, "downsample 1 level");
78 wnd_gray(0, 1).image(downg2, "downsample 2 levels");
79 wnd_gray(1, 1).image(upg1, "upsample 1 level");
80 wnd_gray(0, 2).image(upg2, "upsample 2 level");
81 wnd_gray.show();
82 }
83}
84
85int main(int argc, char** argv) {
86 int device = argc > 1 ? atoi(argv[1]) : 0;

Callers 1

mainFunction · 0.85

Calls 8

loadImageFunction · 0.85
colorSpaceFunction · 0.85
pyramidFunction · 0.85
setPosMethod · 0.80
closeMethod · 0.80
gridMethod · 0.80
imageMethod · 0.80
showMethod · 0.80

Tested by

no test coverage detected