tori29umai commited on
Commit
9c33ed5
1 Parent(s): 7cb3b05
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -43,7 +43,8 @@ def process_XDoG(image_path):
43
  def replace_color(image, color_1, blur_radius=2):
44
  data = np.array(image)
45
  original_shape = data.shape
46
- data = data.reshape(-1, 4)
 
47
  color_1 = np.array(color_1)
48
  matches = np.all(data[:, :3] == color_1, axis=1)
49
  nochange_count = 0
 
43
  def replace_color(image, color_1, blur_radius=2):
44
  data = np.array(image)
45
  original_shape = data.shape
46
+ channels = original_shape[2] if len(original_shape) > 2 else 1 # チャンネル数を確認
47
+ data = data.reshape(-1, channels)
48
  color_1 = np.array(color_1)
49
  matches = np.all(data[:, :3] == color_1, axis=1)
50
  nochange_count = 0