]> git.sesse.net Git - nageru/commitdiff
Fix normalization in the Sobel calculation.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 5 Jul 2018 19:13:29 +0000 (21:13 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 5 Jul 2018 19:13:29 +0000 (21:13 +0200)
sobel.frag

index 9feab1ee6b26ba5c614fd5f0ad2cc920e31f58eb..c4dabd519712465a9d2a5495617ac9c1e2708c5b 100644 (file)
@@ -47,4 +47,8 @@ void main()
 
        gradients.x = (top_right + 2.0f * right + bottom_right) - (top_left + 2.0f * left + bottom_left);
        gradients.y = (top_left + 2.0 * top + top_right) - (bottom_left + 2.0f * bottom + bottom_right);
+
+       // Normalize so that we have a normalized unit of intensity levels per pixel.
+       gradients.x *= 0.125;
+       gradients.y *= 0.125;
 }