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

Function af_sift

src/api/c/sift.cpp:54–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54af_err af_sift(af_features* feat, af_array* desc, const af_array in,
55 const unsigned n_layers, const float contrast_thr,
56 const float edge_thr, const float init_sigma,
57 const bool double_input, const float img_scale,
58 const float feature_ratio) {
59 try {
60 const ArrayInfo& info = getInfo(in);
61 af::dim4 dims = info.dims();
62
63 ARG_ASSERT(2, (dims[0] >= 15 && dims[1] >= 15 && dims[2] == 1 &&
64 dims[3] == 1));
65 ARG_ASSERT(3, n_layers > 0);
66 ARG_ASSERT(4, contrast_thr > 0.0f);
67 ARG_ASSERT(5, edge_thr >= 1.0f);
68 ARG_ASSERT(6, init_sigma > 0.5f);
69 ARG_ASSERT(8, img_scale > 0.0f);
70 ARG_ASSERT(9, feature_ratio > 0.0f);
71
72 dim_t in_ndims = dims.ndims();
73 DIM_ASSERT(1, (in_ndims <= 3 && in_ndims >= 2));
74
75 af_array tmp_desc;
76 af_dtype type = info.getType();
77 switch (type) {
78 case f32:
79 sift<float, float>(*feat, tmp_desc, in, n_layers, contrast_thr,
80 edge_thr, init_sigma, double_input,
81 img_scale, feature_ratio, false);
82 break;
83 case f64:
84 sift<double, double>(
85 *feat, tmp_desc, in, n_layers, contrast_thr, edge_thr,
86 init_sigma, double_input, img_scale, feature_ratio, false);
87 break;
88 default: TYPE_ERROR(1, type);
89 }
90 std::swap(*desc, tmp_desc);
91 }
92 CATCHALL;
93
94 return AF_SUCCESS;
95}
96
97af_err af_gloh(af_features* feat, af_array* desc, const af_array in,
98 const unsigned n_layers, const float contrast_thr,

Callers 2

siftTestFunction · 0.50
siftFunction · 0.50

Calls 4

swapFunction · 0.85
dimsMethod · 0.45
ndimsMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected