itsyogesh commited on
Commit
cf689d2
·
verified ·
1 Parent(s): 1a602a0

Update smoothening

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -184,6 +184,10 @@ def smooth_and_denoise(mask):
184
  :param mask: The binary mask of the signature.
185
  :return: Processed mask.
186
  """
 
 
 
 
187
  # Apply Gaussian Blurring for smoothing
188
  smoothed_mask = cv2.GaussianBlur(mask, (5, 5), 0)
189
 
@@ -195,6 +199,7 @@ def smooth_and_denoise(mask):
195
  patch_size=5, patch_distance=3, channel_axis=None)
196
  return denoised_mask
197
 
 
198
 
199
  def predict(net, inputs_val, shapes_val, hypar, device):
200
  '''
 
184
  :param mask: The binary mask of the signature.
185
  :return: Processed mask.
186
  """
187
+ # Ensure the mask is a 2D array
188
+ if mask.ndim > 2:
189
+ mask = mask[..., 0]
190
+
191
  # Apply Gaussian Blurring for smoothing
192
  smoothed_mask = cv2.GaussianBlur(mask, (5, 5), 0)
193
 
 
199
  patch_size=5, patch_distance=3, channel_axis=None)
200
  return denoised_mask
201
 
202
+
203
 
204
  def predict(net, inputs_val, shapes_val, hypar, device):
205
  '''