Is ArrayFire suitable for Image Coordinate Re-Projection

24 views
Skip to first unread message

Erlend Powell

unread,
Dec 4, 2022, 11:36:43 PM12/4/22
to ArrayFire Users
I'm trying to wrap my head around how I might use ArrayFire for converting from a fish-eye to equirectangular coordinate space. Some immediate problems I've run into:

  • The calculations need access to the image coordinates. In a Cuda kernel, I would do something like:
            int ix = (blockIdx.x * blockDim.x + threadIdx.x);
            int iy = (blockIdx.y * blockDim.y + threadIdx.y);
  • Presumably to do something similar in ArrayFire, I would need to create a new array with the same dimensions containing these coordinates? If so, can this be done without the overhead of materialising this data in physical memory, etc?
  • When writing the kernel in Cuda, it's possible to use textures objects, which make it easy to do things like clamping, normalisation and interpolation. Is there any  equivalent paradigm in ArrayFire, or would I need to manually implement bilinear interpolation.
  • What are the rules around which functions become part of the same underlying kernel versus a new kernel? I'm worried that if I concatenate a bunch of individual functions, that this will result in lots of little kernels with a big overhead.
Would I be better off to just write the whole thing as a Cuda kernel, rather than trying to force it into a paradigm that it's maybe not best suited to? If so, are there any criteria by which to determine when to encapsulate an algorithm in a new function, versus trying to recreate it with existing functions?

John Melonakos

unread,
Jan 25, 2023, 12:01:18 PM1/25/23
to ArrayFire Users
ArrayFire's JIT runtime handles much of what you are describing. Check out this post to understand more:  https://arrayfire.com/blog/performance-of-arrayfire-jit-code-generation/

Feel free to let us know if there is anything else we can do to help answer your question. We will respond more quickly in the future.

Reply all
Reply to author
Forward
0 new messages