# Why does this edge detect show different results for the same color combinations?

I'm researching highlighting accessible color contrast via filter operations. I have a test screenshot of SRGB hex values compared with WCAG's official contrast algorithm:

I converted it to its luminosity:

Then an edge detect:

This no longer looks like a smooth progression; there's a noticeable reversal between, say, #f00 and #777. And after applying a threshold to remove insufficient contrast, it seems like one side is favored out of proportion.

I have a few leads, but not enough understanding of color theory to know which to attack:

• Is it a byproduct of how browsers antialias text?
• Am I in the wrong color space?
• I tried inverting the input and averaging its results together with the original's results, but I'm not seeing a difference other than which way the ringing travels.
• Similarly, switching the kernel matrix's signs doesn't change the progression.

These images are from The GIMP's filter operations, but ultimately I aim to create an SVG <filter> to dynamically highlight insufficient color contrast in web pages. I'm sure I'm not articulating with the right terminology, so please ask for more context if I'm unclear.

• How are you calculating the contrast ratio after you perform the edge detection? What results are you getting? Also did you leave out half a paragraph right below the images? There's a sentence fragment at the end. – user1118321 Apr 2 '17 at 2:20
• @user1118321 I moved it to the bulleted list at the end, nice catch. – Tigt Apr 2 '17 at 3:00
• How does your luminosity conversion work? It seems the contrast labelling does not match the actual luminosity output you have made (the red F00 is much darker than the grey 777, even though the label indicates that the F00 should have a higher contrast ratio).. – PaulHK Apr 3 '17 at 10:43
• @PaulHK I bet you're onto it. It's the browser's default luminanceToAlpha, which is probably fouling up somewhere along the line. – Tigt Apr 3 '17 at 12:37
• Indeed, it's typical for luminance to give green the most weight and blue the least. For example, BT.709 luma. – Olivier Apr 3 '17 at 15:38