| 44 | /// Index corner points of given seed points |
| 45 | template<typename T> |
| 46 | Array<T> pointList(const Array<T>& in, const Array<uint>& x, |
| 47 | const Array<uint>& y) { |
| 48 | |
| 49 | // TODO: Temporary Fix, must fix handling subarrays upstream |
| 50 | // Array<T> has to be a basic array, to be accepted as af_index |
| 51 | Array<uint> x_ = (x.getOffset() == 0 && x.isLinear()) ? x : copyArray(x); |
| 52 | Array<uint> y_ = (y.getOffset() == 0 && y.isLinear()) ? y : copyArray(y); |
| 53 | |
| 54 | af_array xcoords = getHandle<uint>(x_); |
| 55 | af_array ycoords = getHandle<uint>(y_); |
| 56 | |
| 57 | std::array<af_index_t, AF_MAX_DIMS> idxrs = {{{{xcoords}, false, false}, |
| 58 | {{ycoords}, false, false}, |
| 59 | createSpanIndex(), |
| 60 | createSpanIndex()}}; |
| 61 | |
| 62 | Array<T> retVal = detail::index(in, idxrs.data()); |
| 63 | |
| 64 | // detail::index fn keeps a reference to detail::Array |
| 65 | // created from the xcoords/ycoords passed via idxrs. |
| 66 | // Hence, it is safe to release xcoords, ycoords |
| 67 | releaseHandle<uint>(xcoords); |
| 68 | releaseHandle<uint>(ycoords); |
| 69 | |
| 70 | return retVal; |
| 71 | } |
| 72 | |
| 73 | /// Returns the sum of all values given the four corner points of the region of |
| 74 | /// interest in the integral-image/summed-area-table of an input image. |