| 197 | |
| 198 | template<typename T> |
| 199 | af_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 |
nothing calls this directly
no test coverage detected