xinsir commited on
Commit
818da1a
1 Parent(s): fe9add9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +1 -20
README.md CHANGED
@@ -65,25 +65,6 @@ import cv2
65
  import os
66
 
67
 
68
-
69
- def HWC3(x):
70
- assert x.dtype == np.uint8
71
- if x.ndim == 2:
72
- x = x[:, :, None]
73
- assert x.ndim == 3
74
- H, W, C = x.shape
75
- assert C == 1 or C == 3 or C == 4
76
- if C == 3:
77
- return x
78
- if C == 1:
79
- return np.concatenate([x, x, x], axis=2)
80
- if C == 4:
81
- color = x[:, :, 0:3].astype(np.float32)
82
- alpha = x[:, :, 3:4].astype(np.float32) / 255.0
83
- y = color * alpha + 255.0 * (1.0 - alpha)
84
- y = y.clip(0, 255).astype(np.uint8)
85
- return y
86
-
87
  def nms(x, t, s):
88
  x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
89
 
@@ -137,7 +118,7 @@ if random.random() > 0.5:
137
 
138
  image_path = Image.open("your image path, the image can be real or anime, HED detector will extract its edge boundery")
139
  processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
140
- controlnet_img = processor(image_path, scribble=True)
141
  controlnet_img.save("a hed detect path for an image")
142
 
143
  # following is some processing to simulate human sketch draw, different threshold can generate different width of lines
 
65
  import os
66
 
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  def nms(x, t, s):
69
  x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
70
 
 
118
 
119
  image_path = Image.open("your image path, the image can be real or anime, HED detector will extract its edge boundery")
120
  processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
121
+ controlnet_img = processor(image_path, scribble=False)
122
  controlnet_img.save("a hed detect path for an image")
123
 
124
  # following is some processing to simulate human sketch draw, different threshold can generate different width of lines