gaur3009 commited on
Commit
ffc60dc
·
verified ·
1 Parent(s): abbc0fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -21,11 +21,13 @@ def estimate_normal_map(image):
21
  return (normal_map * 255).astype(np.uint8)
22
 
23
 
24
- # Function to apply Thin Plate Spline (TPS) warping
25
  def apply_tps_warping(design, normal_map):
 
 
 
26
  h, w = design.shape[:2]
27
  x, y = np.meshgrid(np.arange(w), np.arange(h))
28
-
29
  # Generate warp offsets from normal map
30
  control_x = x + (normal_map[:, :, 0] - 128) * 0.5
31
  control_y = y + (normal_map[:, :, 1] - 128) * 0.5
 
21
  return (normal_map * 255).astype(np.uint8)
22
 
23
 
 
24
  def apply_tps_warping(design, normal_map):
25
+ # Resize normal map to match the design size
26
+ normal_map = cv2.resize(normal_map, (design.shape[1], design.shape[0]))
27
+
28
  h, w = design.shape[:2]
29
  x, y = np.meshgrid(np.arange(w), np.arange(h))
30
+
31
  # Generate warp offsets from normal map
32
  control_x = x + (normal_map[:, :, 0] - 128) * 0.5
33
  control_y = y + (normal_map[:, :, 1] - 128) * 0.5