mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-03-09 06:59:48 +00:00
i
This commit is contained in:
10
README.md
10
README.md
@@ -428,15 +428,11 @@ class ControlNetExampleForge(scripts.Script):
|
||||
|
||||
# Below are two methods to preprocess images.
|
||||
# Method 1: do it in your own way
|
||||
canny_image_1 = cv2.cvtColor(cv2.Canny(input_image, 100, 200), cv2.COLOR_GRAY2RGB)
|
||||
canny_image = cv2.cvtColor(cv2.Canny(input_image, 100, 200), cv2.COLOR_GRAY2RGB)
|
||||
|
||||
# Method 2: use built-in preprocessor
|
||||
from modules_forge.shared import shared_preprocessors
|
||||
canny_image_2 = shared_preprocessors['canny'](input_image, 100, 200)
|
||||
|
||||
# The two methods will give your same result
|
||||
assert np.allclose(canny_image_1, canny_image_2)
|
||||
canny_image = canny_image_1
|
||||
# from modules_forge.shared import shared_preprocessors
|
||||
# canny_image = shared_preprocessors['canny'](input_image, 100, 200)
|
||||
|
||||
# Output preprocessor result. Now called every sampling. Cache in your own way.
|
||||
p.extra_result_images.append(canny_image)
|
||||
|
||||
@@ -80,15 +80,11 @@ class ControlNetExampleForge(scripts.Script):
|
||||
|
||||
# Below are two methods to preprocess images.
|
||||
# Method 1: do it in your own way
|
||||
canny_image_1 = cv2.cvtColor(cv2.Canny(input_image, 100, 200), cv2.COLOR_GRAY2RGB)
|
||||
canny_image = cv2.cvtColor(cv2.Canny(input_image, 100, 200), cv2.COLOR_GRAY2RGB)
|
||||
|
||||
# Method 2: use built-in preprocessor
|
||||
from modules_forge.shared import shared_preprocessors
|
||||
canny_image_2 = shared_preprocessors['canny'](input_image, 100, 200)
|
||||
|
||||
# The two methods will give your same result
|
||||
assert np.allclose(canny_image_1, canny_image_2)
|
||||
canny_image = canny_image_1
|
||||
# from modules_forge.shared import shared_preprocessors
|
||||
# canny_image = shared_preprocessors['canny'](input_image, 100, 200)
|
||||
|
||||
# Output preprocessor result. Now called every sampling. Cache in your own way.
|
||||
p.extra_result_images.append(canny_image)
|
||||
|
||||
Reference in New Issue
Block a user