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

Function cannyHelper

src/api/c/canny.cpp:199–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198template<typename T>
199af_array cannyHelper(const Array<T>& in, const float t1,
200 const af_canny_threshold ct, const float t2,
201 const unsigned sw, const bool isf) {
202 static const vector<float> v{-0.11021f, -0.23691f, -0.30576f, -0.23691f,
203 -0.11021f};
204 Array<float> cFilter = createHostDataArray<float>(dim4(5, 1), v.data());
205 Array<float> rFilter = createHostDataArray<float>(dim4(1, 5), v.data());
206
207 // Run separable convolution to smooth the input image
208 Array<float> smt =
209 convolve2<float, float>(cast<float, T>(in), cFilter, rFilter, false);
210
211 auto g = sobelDerivatives<float, float>(smt, sw);
212 Array<float> gx = g.first;
213 Array<float> gy = g.second;
214
215 Array<float> gmag = gradientMagnitude(gx, gy, isf);
216
217 Array<float> supEdges = nonMaximumSuppression(gmag, gx, gy);
218
219 auto swpair = computeCandidates(supEdges, t1, ct, t2);
220
221 return getHandle(edgeTrackingByHysteresis(swpair.first, swpair.second));
222}
223
224} // namespace
225

Callers

nothing calls this directly

Calls 6

gradientMagnitudeFunction · 0.85
computeCandidatesFunction · 0.85
getHandleFunction · 0.70
dim4Class · 0.50
nonMaximumSuppressionFunction · 0.50
edgeTrackingByHysteresisFunction · 0.50

Tested by

no test coverage detected