[Solved] How can we evaluate a Gaussian in an intensity of an Image? [closed]


Not quite. Basically you are manually coding formula (9) from here. Then:

    ...
    exponent = ((x-rho).^2 + (y-theta).^2)./(2*sigma^2); % sigma is also squared
    val = exp(-exponent); % superfluous bracket removed
    val = val./(2*pi*sigma^2); % you also forgot the denominator part
end

Of course you could write the whole thing a bit more efficient. But unless you actually want to use this formula on a lot of data I would keep it like this (it’s very readable).

If you value performance, just use the built in function:

val = normpdf(pI,dS,sigma)

For new readers of this question: The OP reopened this questions after editing it heavily, completely changing the nature of the question. Therefore this answer now seems a bit off.

8

solved How can we evaluate a Gaussian in an intensity of an Image? [closed]