Python Forum
Rotate 2D Gaussian given parameters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotate 2D Gaussian given parameters
#1
I have a Gaussian function of the form:

def f(x,y):
  a=some number
  b=...
  c=...
  return 3*np.exp(-a*(-0.5 + x)**2+b*(x-0.5)*(y-0.5)-c*(-0.5 + y)**2)
This is a Gaussian function symmetric around y=x, and I'd like to rotate it 45 degrees (counter)clockwise. Wikipedia gives an overdetermined system of equations for the variances of x and y respectively, but it looks cumbersome. Is there a simple way to do this?

Gaussian parameters
Reply
#2
Can't you make use of a rotation matrix? For each point (x, y) the rotation matrix would give you new points (x', y') and then you simply compute f at those new points.
Reply
#3
(Dec-10-2020, 06:37 PM)ndc85430 Wrote: Can't you make use of a rotation matrix? For each point (x, y) the rotation matrix would give you new points (x', y') and then you simply compute f at those new points.

True. So then one would probably first need to normalize f. How would one then generate the points (x,y) using f as a density?
Reply
#4
(Dec-10-2020, 06:44 PM)schniefen Wrote:
(Dec-10-2020, 06:37 PM)ndc85430 Wrote: Can't you make use of a rotation matrix? For each point (x, y) the rotation matrix would give you new points (x', y') and then you simply compute f at those new points.

True. So then one would probably first need to normalize f. How would one then generate the points (x,y) using f as a density?

I would like to find the new parameters a,b and c of the rotated version as well.
Reply
#5
A rotation by 45 degrees, with the means (0.5,0.5) fixed, gives a’=(a-b+c)/2, b’=a-c=0 and c’=(a+b+c)/2 for a counterclockwise rotation and a’=(a+b+c)/2, b’=a-c=0 and c’=(a-b+c)/2 for a clockwise rotation.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to rotate bits ? korenron 2 1,564 Mar-23-2022, 04:05 PM
Last Post: Larz60+
  Returning values from Gaussian fitting Laplace12 0 1,549 Aug-05-2021, 08:09 AM
Last Post: Laplace12
  Fitting Gaussian curve to data file Laplace12 0 2,672 Jun-09-2021, 10:45 AM
Last Post: Laplace12
  How to rotate log and limit the size maiya 0 1,725 Aug-29-2020, 12:41 AM
Last Post: maiya
  Multi-gaussian function Laplace12 5 3,925 Jul-21-2020, 11:38 PM
Last Post: scidam
  How do I apply a Gaussian blur to a particular edge of geometry in Matplotlib? hbolandi 0 1,950 Feb-02-2020, 06:08 PM
Last Post: hbolandi
  gaussian quadrature mohammadrezamofidi 4 4,049 Jun-18-2019, 04:06 PM
Last Post: michalmonday

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020