Fastest way to access pixel in circle shape

asked 2017-05-24 23:16:48 -0500

Hello everyone, I'm trying to improve the processing time of my algorithm. The bottle neck is the time I access the value of pixel. In this case, for each pixel of image I will access N pixels around that pixel. The time consume take me around 300 ms to finish an image (using pointer access). Could you guys recommend me other ways to improve it. I'm open for GPU implementation as well.

Many thanks.

edit retag flag offensive close merge delete


  • what are you trying to achieve ? what is the "context" ?
  • show us, what you've tried so far.
  • anything done "per pixel" is expensive (and there's no random access on the GPU at all)
berak gravatar imageberak ( 2017-05-24 23:30:48 -0500 )edit

Hi berak,

  • I try to make my algorithm realtime. The context is for given an image, for each pixel I calculate N outputs of one "simple" function for N pixels around it.

  • What i tried so far is iterating with pointer for each pixel. From that I calculate the position of N pixel and use .at() to get its value. With this method I got the time as I show above. Which is about 3 FPS. So I would like to improve the FPS as much as possible.

    What do you recommend? Many thanks.

peterpans01 gravatar imagepeterpans01 ( 2017-05-27 13:03:37 -0500 )edit