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

Function get_pixel

src/backend/cpu/kernel/orb.hpp:219–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217
218template<typename T>
219inline T get_pixel(unsigned x, unsigned y, const float ori, const unsigned size,
220 const int dist_x, const int dist_y, CParam<T> image,
221 const unsigned patch_size) {
222 const af::dim4 idims = image.dims();
223 const T* image_ptr = image.get();
224 float ori_sin = sin(ori);
225 float ori_cos = cos(ori);
226 float patch_scl = (float)size / (float)patch_size;
227
228 // Calculate point coordinates based on orientation and size
229 x += round(dist_x * patch_scl * ori_cos - dist_y * patch_scl * ori_sin);
230 y += round(dist_x * patch_scl * ori_sin + dist_y * patch_scl * ori_cos);
231
232 return image_ptr[x * idims[0] + y];
233}
234
235template<typename T>
236void extract_orb(unsigned* desc_out, const unsigned n_feat, float* x_in_out,

Callers 1

extract_orbFunction · 0.70

Calls 5

sinFunction · 0.85
cosFunction · 0.85
roundFunction · 0.85
dimsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected