Added first controlnet preprocessor node for canny edge detection.

This commit is contained in:
user1 2023-04-29 19:40:22 -07:00 committed by Kent Keirsey
parent 901a277959
commit 10b7a58887

View File

@ -1,9 +1,10 @@
# InvokeAI nodes for ControlNet image preprocessors # InvokeAI nodes for ControlNet image preprocessors
# initial implementation by Gregg Helt, 2023 # initial implementation by Gregg Helt, 2023
# heavily leverages controlnet_aux package: https://github.com/patrickvonplaten/controlnet_aux # heavily leverages controlnet_aux package: https://github.com/patrickvonplaten/controlnet_aux
import numpy as np
import numpy as np
from typing import Literal, Optional, Union, List from typing import Literal, Optional, Union, List
from PIL import Image, ImageFilter, ImageOps
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from ..models.image import ImageField, ImageType from ..models.image import ImageField, ImageType
@ -125,7 +126,7 @@ class ImageProcessorInvocation(BaseInvocation, PILInvocationConfig):
width=processed_image.width, width=processed_image.width,
height=processed_image.height, height=processed_image.height,
mode=processed_image.mode, mode=processed_image.mode,
) )
class CannyImageProcessorInvocation(ImageProcessorInvocation, PILInvocationConfig): class CannyImageProcessorInvocation(ImageProcessorInvocation, PILInvocationConfig):
@ -334,3 +335,4 @@ class ZoeDepthImageProcessorInvocation(ImageProcessorInvocation, PILInvocationCo
zoe_depth_processor = ZoeDetector.from_pretrained("lllyasviel/Annotators") zoe_depth_processor = ZoeDetector.from_pretrained("lllyasviel/Annotators")
processed_image = zoe_depth_processor(image) processed_image = zoe_depth_processor(image)
return processed_image return processed_image