slight refactoring of existing nodes
This commit is contained in:
@@ -15,13 +15,13 @@ class CannyEdgeDetection:
|
||||
"default": 100,
|
||||
"min": 0,
|
||||
"max": 500,
|
||||
"step": 1
|
||||
"step": 10
|
||||
}),
|
||||
"upper_threshold": ("INT", {
|
||||
"default": 200,
|
||||
"min": 0,
|
||||
"max": 500,
|
||||
"step": 1
|
||||
"step": 10
|
||||
}),
|
||||
},
|
||||
}
|
||||
@@ -31,10 +31,10 @@ class CannyEdgeDetection:
|
||||
|
||||
CATEGORY = "postprocessing"
|
||||
|
||||
def canny(self, image, lower_threshold, upper_threshold):
|
||||
tensor_img = image.numpy()[0]
|
||||
tensor_img = (cv2.cvtColor(tensor_img, cv2.COLOR_BGR2GRAY) * 255).astype(np.uint8)
|
||||
canny = cv2.Canny(tensor_img, lower_threshold, upper_threshold)
|
||||
def canny(self, image: torch.Tensor, lower_threshold: int, upper_threshold: int):
|
||||
tensor_image = image.numpy()[0]
|
||||
gray_image = (cv2.cvtColor(tensor_image, cv2.COLOR_BGR2GRAY) * 255).astype(np.uint8)
|
||||
canny = cv2.Canny(gray_image, lower_threshold, upper_threshold)
|
||||
tensor = torch.from_numpy(canny).unsqueeze(0)
|
||||
return (tensor,)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user