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

Function prewitt

examples/image_processing/filters.cpp:90–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void prewitt(array &mag, array &dir, const array &in) {
91 static float h1[] = {1, 1, 1};
92 static float h2[] = {-1, 0, 1};
93 static array h1d(3, h1);
94 static array h2d(3, h2);
95
96 // Find the gradients
97 array Gy = af::convolve(h2d, h1d, in) / 6;
98 array Gx = af::convolve(h1d, h2d, in) / 6;
99
100 // Find magnitude and direction
101 mag = hypot(Gx, Gy);
102 dir = atan2(Gy, Gx);
103}
104
105void sobelFilter(array &mag, array &dir, const array &in) {
106 // Find the gradients

Callers 1

mainFunction · 0.70

Calls 3

hypotFunction · 0.85
atan2Function · 0.85
convolveFunction · 0.50

Tested by

no test coverage detected