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

Function prewitt

examples/image_processing/edge.cpp:17–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using namespace af;
16
17void prewitt(array &mag, array &dir, const array &in) {
18 static float h1[] = {1, 1, 1};
19 static float h2[] = {-1, 0, 1};
20 static array colf(3, 1, h1);
21 static array rowf(3, 1, h2);
22
23 // Find the gradients
24 array Gy = convolve(rowf, colf, in);
25 array Gx = convolve(colf, rowf, in);
26
27 // Find magnitude and direction
28 mag = hypot(Gx, Gy);
29 dir = atan2(Gy, Gx);
30}
31
32void sobelFilter(array &mag, array &dir, const array &in) {
33 array Gx, Gy;

Callers 1

edgeFunction · 0.70

Calls 3

hypotFunction · 0.85
atan2Function · 0.85
convolveFunction · 0.50

Tested by

no test coverage detected