fix incorrect cpds
diff --git a/fooocus_extras/preprocessors.py b/fooocus_extras/preprocessors.py
index ce31a7aff..b19a7cba9 100644
--- a/fooocus_extras/preprocessors.py
+++ b/fooocus_extras/preprocessors.py
@@ -37,6 +37,20 @@ def cpds(x):
     # See http://www.cse.cuhk.edu.hk/leojia/projects/color2gray/index.html
     # See https://docs.opencv.org/3.0-beta/modules/photo/doc/decolor.html
 
-    y = np.ascontiguousarray(x[:, :, ::-1].copy())
-    y = cv2.decolor(y)[0]
-    return y
+    raw = cv2.GaussianBlur(x, (0, 0), 1.0)
+    density, boost = cv2.decolor(raw)
+
+    raw = raw.astype(np.float32)
+    density = density.astype(np.float32)
+    boost = boost.astype(np.float32)
+
+    offset = np.sum((raw - boost) ** 2.0, axis=2) ** 0.5
+
+    result = density + offset
+
+    result -= np.min(result)
+    result /= np.max(result)
+
+    result *= 255.0
+
+    return result.clip(0, 255).astype(np.uint8)
diff --git a/fooocus_version.py b/fooocus_version.py
index e76c56518..07fbeef22 100644
--- a/fooocus_version.py
+++ b/fooocus_version.py
@@ -1 +1 @@
-version = '2.1.21'
+version = '2.1.22'
