Edit 1: Rewrote question so it is clearer to understand.
This one really split my mind.
I would like to apply a filter to an image such that values over a certain threshold are displayed as completely white, and all the values that are equal or less than the threshold are completely black.
here's a map representing RGB values of a 3x3 pixel image:
|(255,255,255)|(220,220,220)|(100,100,100)|
|(254,254,254)|(12 ,12 ,12 )|(38 ,38 ,38 )|
|(201,201,201)|(105,105,105)|(60 ,60 ,60 )|
After applying my filter I wish to receive an image where all values greater than 200 are converted to (255,255,255) and all values equal or less than 200 are converted to (0,0,0) such:
|(255,255,255)|(255,255,255)|(0 ,0 ,0 )|
|(255,255,255)|(0 ,0 ,0 )|(0 ,0 ,0 )|
|(255,255,255)|(0 ,0 ,0 )|(0 ,0 ,0 )|
Any ideas for where I should start? Is that even possible in svg? I know I can create matrix multiplications in filters in svg but I don't know how to approach this issue.
thank you!
Edit 1: Related question I posted in math exchange: https://math.stackexchange.com/questions/2087482/creating-binary-matrix-for-threshold-as-a-result-of-matrix-multiplcation
Edit 2:: Extracted from the Snap.svg code: this matrix will transform a color image to a grayscale:
<feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"/>
Instead of getting grayscale, I would like to modify the values here to get Black and White. And I would like to choose the threshold above which values are returned as white, and below are returned as black
Additional Info: According to MSDN, this is how the multiplication occurs:
Resulting vector my coveted matrix original vector
| R' | | a00 a01 a02 a03 a04 | | R |
| G' | | a10 a11 a12 a13 a14 | | G |
| B' | = | a20 a21 a22 a23 a24 | * | B |
| A' | | a30 a31 a32 a33 a34 | | A |
| 1 | | 0 0 0 0 1 | | 1 |
This in turn is applied to every pixel of the inputed image.