48

In convolution, two mathematical functions are combined to produce a third function. In image processing functions are usually called kernels. A kernel is nothing more than a (square) array of pixels (a small image so to speak). Usually, the values in the kernel add up to one. This is to make sure no energy is added or removed from the image after the ...


16

Here is the best article I've read on the topic: Efficient Gaussian blur with linear sampling. It addresses all your questions and is really accessible. For the layman very short explanation: Gaussian is a function with the nice property of being separable, which means that a 2D Gaussian function can be computed by combining two 1D Gaussian functions. So ...


13

There are two cases I can think of where multiple blurs would be performed in succession on a single image. First, when performing a large-radius blur, it may reduce the total computation if you first downsample the image (which is a blur) and then perform a smaller-radius blur on the downsampled image. For example, downsampling an image by 4x and then ...


13

In general, a convolution is performed by taking the integral of the product of two functions in a sliding window, but if you're not from a math background, that's not a very helpful explanation, and certainly won't give you a useful intuition for it. More intuitively, a convolution allows multiple points in an input signal to affect a single point on an ...


11

The most important thing to consider when implementing the Gaussian blur is, as others have pointed out, to separate the 2D convolution filter into two 1D convolutions because it brings the complexity down from $O(n^2)$ to $O(n)$. But there are two more tricks you might want to consider in an actual implementation: The filter has a certain radius and ...


9

Yes, applying two Gaussian blurs is equivalent to doing one Gaussian blur, but with a slightly different size calculation. Applying a Gaussian blur to an image means doing a convolution of the Gaussian with the image. Convolution is associative: Applying two Gaussian blurs to an image is equivalent to convolving the two Gaussians with each other, and ...


6

A few different approaches I'll consider a few variations on your specific request, since you mention efficiency and I suspect your specific request may be the least efficient. I'll also suggest ways of improving the efficiency without varying from your intended approach, so you can weigh up the alternatives. Blurring the volume instead of the surface If ...


5

The blog post that you talked about, is not about generating bokeh for a computer generated image. It is instead about generating a believable depth of field effect from an image captured by a smartphone camera, as the effect is desired for portraits to make the subject stand out. It generally works by splitting the image in to two parts. One part is the ...


5

In order to achieve the "white" glow effect for amassed particles, you should probably switch to HDR rendering and have your tone mapping operator desaturate the "overbright" pixels. So you'll need a higher-precision, floating point render target (e.g. RGBA1010102, or RGBA16F) and a post-process step to bring that down to the LDR system back-buffer. Then ...


5

From the GIMP docs: IIR IIR stands for “infinite impulse response”. This blur works best for large radius values and for images which are not computer generated. RLE RLE stands for “run-length encoding”. RLE Gaussian Blur is best used on computer-generated images or those with large areas of constant intensity. and also They both ...


4

If I understand your question, you are asking how to actually perform said directional blur in code? A Gaussian blur is typically done by sampling your image in all directions around your current point (or if in 2 passes, one vertical and one horizontal which equates to the same thing), with a specific set of weights for the falloff. For a directional blur ...


4

In short: You should not gamma correct your glow map. In fact, you should do everything in a linear color space. At the very end, when doing any color grading (which is the very last step), you convert the final image to the right color space. The color space include that gamma correction. In long: Gamma correction is a step in the encoding of images. It ...


4

At CEDEC and GDC in the early 2000s, Masaki Kawase has presented a series of fast post-processing based lens effects, including large bloom. This presentation from GDC 2003, Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless) (see slides 15 and upwards: "Bloom"), gives a first version of the bloom. It consists in doing a Gaussian blur by ...


4

It depends. On a desktop, if the Gaussian function is always called with the same arguments, the shader compiler will probably optimize it so it's evaluated only once. On a mobile platform though, the compiler has less time to do optimizations and might miss it. Either way, you can confirm by looking at the generated assembly. Note that Aras Pranckevičius ...


3

Blurring an image depends on being able to read from the image. If you don’t have access to the pixel data, or external information about the image contents (e.g. average hue / luminance), there’s no way to find an overlay color that will look like you’ve blurred what it’s on top of.


3

One way to represent a complex-valued function in a bitmap is to use one color channel for the real component and one for the imaginary component. For example, rendering a complex plane wave (your equation) with R = real, G = imaginary looks like this (click for shadertoy):


2

You can get fancy with individual weighting on the blur maps if you want to adjust the look, but an equally weighted mix (and yes, it should be additive) will work too. I’m not sure about whether you need to gamma-correct the blurred image before adding it to the source one, but you should definitely get it into linear space before doing the blur; this ...


2

If I blur the whole image and apply the result on the sphere, the white background will bleed onto the sphere shape and I want to avoid that. I also don't want that the blue (3) and yellow (4) sphere merges with the red (1) and green (2) ones. But I would like that the green and red ones merges. Again This could be done using the depth but if you have more ...


2

One way to speed things up if you're doing this on a mobile GPU is to avoid indirect texture look-ups. This is where you calculate the texture coordinates then use the results of that calculation in the call to sample the texture. So it might be natural to write a 3-tap blur fragment shader doing something like this: sample1 = texture2D(inputTexture, ...


2

The shader compiler will very likely perform common-subexpression consolidation, and compute that function once, and reuse it each time it appears in the shader. You might think that, since deviationScale and all the other args are constants, it is possible it gets constant-folded entirely and never executes at runtime at all. But this is incorrect, as ...


1

While you can't do what you're asking, you might be able to use a compromise. It turns out that all human skin tones have the same hue. They vary only in saturation and brightness. You can see this on the scopes that television engineers use to calibrate their signals. There's a line where skin tones should be if everything's set correctly. You could ...


1

Since you know vaguely what the pixels you're covering up look like (they are faces), your best bet to get the appearance of a blur is to really blur an image of a face in a standard image editing tool, then use the colour picker to choose a representative colour from that region. That's the closest you can get, but it still won't look blurred: as Noah ...


1

It would be helpful if you posted some more information about what you're trying to do (rather than problem links) and some screenshots of what is actually happening. Being here I basically see "My code doesn't work, fix it.", which is not motivating to answer your question... That being said, you calculate an offset for reading out from your texture. ...


Only top voted, non community-wiki answers of a minimum length are eligible