If the image is not type float, this will cause a copy and hence a massive slowdown just for inpainting a single point.  The image should be cast to float in the outer loop then.