staghado commited on
Commit
365c88b
·
1 Parent(s): 26d12c4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -27,6 +27,20 @@ def fourier_transform_drawing(input_image, frames, coefficients):
27
  xs, ys = zip(*verts)
28
  xs = np.asarray(xs) - np.mean(xs)
29
  ys = - np.asarray(ys) + np.mean(ys)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  t_list = np.linspace(0, tau, len(xs))
31
 
32
  # Compute the Fourier coefficients
 
27
  xs, ys = zip(*verts)
28
  xs = np.asarray(xs) - np.mean(xs)
29
  ys = - np.asarray(ys) + np.mean(ys)
30
+
31
+ # Calculate the range of xs and ys
32
+ x_range = np.max(xs) - np.min(xs)
33
+ y_range = np.max(ys) - np.min(ys)
34
+
35
+ # Determine the scale factors
36
+ desired_range = 500
37
+ scale_factor_x = desired_range / x_range
38
+ scale_factor_y = desired_range / y_range
39
+
40
+ # Apply scaling
41
+ xs = (xs - np.mean(xs)) * scale_factor_x
42
+ ys = (ys - np.mean(ys)) * scale_factor_y
43
+
44
  t_list = np.linspace(0, tau, len(xs))
45
 
46
  # Compute the Fourier coefficients