| 52 | } |
| 53 | |
| 54 | af_err af_fast(af_features *out, const af_array in, const float thr, |
| 55 | const unsigned arc_length, const bool non_max, |
| 56 | const float feature_ratio, const unsigned edge) { |
| 57 | try { |
| 58 | const ArrayInfo &info = getInfo(in); |
| 59 | af::dim4 dims = info.dims(); |
| 60 | |
| 61 | ARG_ASSERT(2, (dims[0] >= (dim_t)(2 * edge + 1) || |
| 62 | dims[1] >= (dim_t)(2 * edge + 1))); |
| 63 | ARG_ASSERT(3, thr > 0.0f); |
| 64 | ARG_ASSERT(4, (arc_length >= 9 && arc_length <= 16)); |
| 65 | ARG_ASSERT(6, (feature_ratio > 0.0f && feature_ratio <= 1.0f)); |
| 66 | |
| 67 | dim_t in_ndims = dims.ndims(); |
| 68 | DIM_ASSERT(1, (in_ndims == 2)); |
| 69 | |
| 70 | af_dtype type = info.getType(); |
| 71 | switch (type) { |
| 72 | case f32: |
| 73 | *out = fast<float>(in, thr, arc_length, non_max, feature_ratio, |
| 74 | edge); |
| 75 | break; |
| 76 | case f64: |
| 77 | *out = fast<double>(in, thr, arc_length, non_max, feature_ratio, |
| 78 | edge); |
| 79 | break; |
| 80 | case b8: |
| 81 | *out = fast<char>(in, thr, arc_length, non_max, feature_ratio, |
| 82 | edge); |
| 83 | break; |
| 84 | case s32: |
| 85 | *out = fast<int>(in, thr, arc_length, non_max, feature_ratio, |
| 86 | edge); |
| 87 | break; |
| 88 | case u32: |
| 89 | *out = fast<uint>(in, thr, arc_length, non_max, feature_ratio, |
| 90 | edge); |
| 91 | break; |
| 92 | case s16: |
| 93 | *out = fast<short>(in, thr, arc_length, non_max, feature_ratio, |
| 94 | edge); |
| 95 | break; |
| 96 | case u16: |
| 97 | *out = fast<ushort>(in, thr, arc_length, non_max, feature_ratio, |
| 98 | edge); |
| 99 | break; |
| 100 | case s8: |
| 101 | *out = fast<schar>(in, thr, arc_length, non_max, feature_ratio, |
| 102 | edge); |
| 103 | break; |
| 104 | case u8: |
| 105 | *out = fast<uchar>(in, thr, arc_length, non_max, feature_ratio, |
| 106 | edge); |
| 107 | break; |
| 108 | default: TYPE_ERROR(1, type); |
| 109 | } |
| 110 | } |
| 111 | CATCHALL; |