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

Function edge

examples/image_processing/edge.cpp:46–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46array edge(const array &in, int method = 0) {
47 int w = 5;
48 if (in.dims(0) < 512) w = 3;
49 if (in.dims(0) > 2048) w = 7;
50
51 int h = 5;
52 if (in.dims(0) < 512) h = 3;
53 if (in.dims(0) > 2048) h = 7;
54
55 array ker = gaussianKernel(w, h);
56 array smooth = convolve(in, ker);
57 array mag, dir;
58
59 switch (method) {
60 case 1: prewitt(mag, dir, smooth); break;
61 case 2: sobelFilter(mag, dir, smooth); break;
62 case 3:
63 mag = canny(in, AF_CANNY_THRESHOLD_AUTO_OTSU, 0.18, 0.54).as(f32);
64 break;
65 default: throw af::exception("Unsupported type");
66 }
67
68 return normalize(mag);
69}
70
71void edge() {
72 af::Window myWindow("Edge Dectectors");

Callers 1

mainFunction · 0.85

Calls 15

cannyFunction · 0.85
loadImageFunction · 0.85
asMethod · 0.80
setAxesTitlesMethod · 0.80
closeMethod · 0.80
gridMethod · 0.80
imageMethod · 0.80
showMethod · 0.80
histMethod · 0.80
prewittFunction · 0.70
sobelFilterFunction · 0.70
normalizeFunction · 0.70

Tested by

no test coverage detected