Best way to describe what I mean is with an example; I know how to generate a "Gaussian along a line":
$$e^{-h_2^2((x-h_5)\cos(h_3)+(y-h_6)\sin(h_3)).^2}$$
Some example matlab code:
h1 = 0.025;
h2 = 0.5;
h3 = pi/16;
h4 = pi/2.25;
h5 = 50;
h6 = 60;
[y,x] = ndgrid(1:120,1:120);
figure;
imshow(exp(-h2^2*((x-h5).*cos(h3)+(y-h6).*sin(h3)).^2),[])
This is a "Gaussian along a line". How would I go about doing the same thing, but for an ellipse instead? Preferably where the function is equal to 1 along the ellipse boundary like it is for this equation of the line:
$$(x-h_5)\cos(h_3)+(y-h_6)\sin(h_3)$$
and also has a parameter like $h_2$ where I can control the spread (i.e. variance).
EDIT:
When using:
h = 30;
k = 40;
a = 5;
b = 6;
h2 = 4;
figure;
imshow(exp(-h2^2*( (x-h).^2/a^2 + (y-k).^2/b^2 - 1).^2),[])
h = 30;
k = 40;
a = 25;
b = 30;
h2 = 4;
figure;
imshow(exp(-h2^2*( (x-h).^2/a^2 + (y-k).^2/b^2 - 1).^2),[])
Even though $h_2$ is the same the variance seems to increase:





The trick is to build a function that cancels along the curve and is nonzero elsewhere.
In the case of a line,
$$f(x,y)=ax+by+c$$ is a perfect candidate.
For an axis aligned, centered ellipse,
$$f(x,y)=\frac{x^2}{a^2}+\frac{y^2}{b^2}-1.$$
In both cases, the Gaussian takes the form
$$e^{-h^2f^2(x,y)}$$ giving, for the ellipse
$$e^{-h^2\left(\frac{x^2}{a^2}+\frac{y^2}{b^2}-1\right)^2}.$$