diff --git a/README.MD b/README.MD
index 9e04fc6..7cd00e9 100644
--- a/README.MD
+++ b/README.MD
@@ -585,7 +585,7 @@ You also can change the fonts folder in config.

> Anti-Aliasing of image artifacts.
-### SmoothMore
+### Smooth More

> Improved Anti-Aliasing of image artifacts.
@@ -593,7 +593,7 @@ You also can change the fonts folder in config.

> Blurring the image.
-### BoxBlur
+### Box Blur

> Blurring the image by box algorithm.
@@ -604,7 +604,7 @@ You also can change the fonts folder in config.
-### GaussianBlur
+### Gaussian Blur

> Blurring the image by gaussian algorithm.
@@ -615,6 +615,17 @@ You also can change the fonts folder in config.
+### Median Blur
+
+> Selects the average pixel value in a window of the specified size.
+
+
+ Params:
+
+* size `[0 - *]` - The size of the core in PX.
+
+
+
### Contour

> Find the contours of the image.
@@ -623,11 +634,11 @@ You also can change the fonts folder in config.

> Image detailing.
-### EdgeEnhance
+### Edge Enhance

> Clarity of the image boundaries.
-### EdgeEnhanceMore
+### Edge Enhance More

> Improved clarity of image boundaries.
@@ -635,7 +646,7 @@ You also can change the fonts folder in config.

> Embossed image.
-### FindEdges
+### Find Edges

> Identifies the boundaries of the image.
@@ -655,17 +666,6 @@ You also can change the fonts folder in config.
-### Median
-
-> Selects the average pixel value in a window of the specified size.
-
-
- Params:
-
-* size `[0 - *]` - The size of the core in PX.
-
-
-
### Min

> Selects the smallest pixel value in the window at the specified size.
diff --git a/modules/ImageFilter.py b/modules/ImageFilter.py
index 2de6970..5b50088 100644
--- a/modules/ImageFilter.py
+++ b/modules/ImageFilter.py
@@ -155,6 +155,34 @@ class ImageFilterBilateralBlur:
return (cv2_layer(images, lambda x: cv2.bilateralFilter(x, size, 100 - sigma_color * 100, sigma_intensity * 100)),)
+class ImageFilterMedianBlur:
+ def __init__(self):
+ pass
+
+ @classmethod
+ def INPUT_TYPES(cls):
+ return {
+ "required": {
+ "images": ("IMAGE",),
+ "size": ("INT", {
+ "default": 10
+ }),
+ },
+ }
+
+ RETURN_TYPES = ("IMAGE",)
+ FUNCTION = "image_filter_median_blur"
+ CATEGORY = "image/filter"
+
+ def image_filter_median_blur(self, images, size):
+ size -= 1
+
+ img = images.clone().detach()
+ img = (img * 255).to(torch.uint8)
+
+ return ((cv2_layer(img, lambda x: cv2.medianBlur(x, size)) / 255),)
+
+
class ImageFilterStackBlur:
def __init__(self):
pass
@@ -178,10 +206,10 @@ class ImageFilterStackBlur:
}
RETURN_TYPES = ("IMAGE",)
- FUNCTION = "image_filter_bilateral_blur"
+ FUNCTION = "image_filter_stack_blur"
CATEGORY = "image/filter"
- def image_filter_bilateral_blur(self, images, size_x, size_y):
+ def image_filter_stack_blur(self, images, size_x, size_y):
size_x -= 1
size_y -= 1
@@ -357,31 +385,6 @@ class ImageFilterRank:
return applyImageFilter(images, ImageFilter.RankFilter(int(size) + 1, rank))
-class ImageFilterMedian:
- def __init__(self):
- pass
-
- @classmethod
- def INPUT_TYPES(cls):
- return {
- "required": {
- "images": ("IMAGE",),
- "size": ("INT", {
- "default": 2,
- "min": 0,
- "step": 2
- }),
- },
- }
-
- RETURN_TYPES = ("IMAGE",)
- FUNCTION = "image_filter_median"
- CATEGORY = "image/filter"
-
- def image_filter_median(self, images, size):
- return applyImageFilter(images, ImageFilter.MedianFilter(int(size) + 1))
-
-
class ImageFilterMin:
def __init__(self):
pass
@@ -464,6 +467,7 @@ NODE_CLASS_MAPPINGS = {
"ImageFilterBoxBlur": ImageFilterBoxBlur,
"ImageFilterGaussianBlur": ImageFilterGaussianBlur,
"ImageFilterBilateralBlur": ImageFilterBilateralBlur,
+ "ImageFilterMedianBlur": ImageFilterMedianBlur,
"ImageFilterStackBlur": ImageFilterStackBlur,
"ImageFilterContour": ImageFilterContour,
"ImageFilterDetail": ImageFilterDetail,
@@ -473,7 +477,6 @@ NODE_CLASS_MAPPINGS = {
"ImageFilterFindEdges": ImageFilterFindEdges,
"ImageFilterSharpen": ImageFilterSharpen,
"ImageFilterRank": ImageFilterRank,
- "ImageFilterMedian": ImageFilterMedian,
"ImageFilterMin": ImageFilterMin,
"ImageFilterMax": ImageFilterMax,
"ImageFilterMode": ImageFilterMode