GPU-based Laplacian pyramid

I implemented an image blending method for seamless blending using simple C ++. Now I want to convert this code to GPU (using OpenGL ES 2 Shaders for mobile devices). Basically, the method creates Gaussian and Laplacian pyramids for each image, which are then combined from a low resolution to the top (see also the article "Laplacian pyramid as a compact image code" from Burt et al., 1983).

My problem is that the levels of the Laplace pyramid may have negative values, but my devices do not support floating or integer type textures (using the ORB_texture_float extension, for example.).

I have already searched for documents on GPU-based pyramids, but not finding anything really useful.

  • How to effectively implement such a pyramid for the GPU?
  • Is it possible to calculate the level of the Gauss / Laplace pyramid without iterating through previous levels?

Hello,

EDIT There seems to be no โ€œgoodโ€ way to fully compute the Laplacian pyramids on the GPU, except for two passes (one for characters, one for values) that have no support for signed types (like ARB_texture_float), or for types, large bytes when the range of image data is between [0..255]. My Laplacian pyramid works fine on GPUs with the extension ARB_texture_float, but without the extension (and some settings for compressing the range), the pyramid becomes โ€œwrongโ€ due to the compression of the range.

+4
source share
1 answer
  • The safest way to implement the Laplace pyramid, if your textures are unsigned integers, is to store two pyramids - one pyramid that contains the Laplacian gradient and another pyramid that stores the pixel sign at the same time.

  • Yes. Any level in the Gaussian or Laplacian pyramid has a closed solution based on the sigma value you want to calculate. Consider the basic case of the LoG pyramid calculated with the intervals sigma = (2/3). The first level of the pyramid has a 2/3 sigma and is simply done by convolution using a Lox 5x5 filter with a 2/3 sigma. The second convolution with the same filter creates a LoG image with 4/3 sigma, and finally, the third has a 6/3 or 2 sigma, so we select the image to get the next integer level of the pyramid. If you want to calculate the LoG of an image in sigma-2, the levels in sigma 2/3 and 4/3 are not needed - just sum the image once and collapse it using the LoG filter with sigma 1.

If you want to calculate LoG at sigma = 20, a quad-subample image (16 pixel blocks will become 1 pixel) to give you a sigma 16 image, and then collapse once using the Loig sigma 4/3 filter.

+5
source

Source: https://habr.com/ru/post/1435966/


All Articles