Amould commited on
Commit
ae94caa
·
verified ·
1 Parent(s): 6c73196

Update codes.py

Browse files
Files changed (1) hide show
  1. codes.py +5 -4
codes.py CHANGED
@@ -150,10 +150,11 @@ def transform_standard_points(Affine_mat, x,y):
150
 
151
  def wrap_points(img, x_source, y_source, l=1):
152
  for i in range(len(y_source)):
153
- x0 = x_source[i].int()
154
- y0 = y_source[i].int()
155
- img[:,:,x0-l:x0+l,y0-l:y0+l] = 0
156
- return img
 
157
 
158
 
159
  def wrap_imge_cropped(Affine_mtrx, source_img, dim1=224, dim2=128):
 
150
 
151
  def wrap_points(img, x_source, y_source, l=1):
152
  for i in range(len(y_source)):
153
+ x0 = x_source[i].int()
154
+ y0 = y_source[i].int()
155
+ if (x0<dim) and (x0>0) and (y0<dim) and (y0>0):
156
+ img[:,:,x0-l:x0+l,y0-l:y0+l] = 0
157
+ return img
158
 
159
 
160
  def wrap_imge_cropped(Affine_mtrx, source_img, dim1=224, dim2=128):