When applying threshold on a picture, it's often difficult to set it correctly to keep most details (so that darker/lighter parts of the image don't get entirely black/white).
I experimented a bit with the idea of an optimized threshold.
The best approach so far was to compare each pixel to an average value of the neighboring pixels (within a radius of around 200 pixels), rather than to a fixed value.
I used only a few pixels (just for performance, because it isn't gpu-based yet) and applied a different ratio based on the distance.
Then, just for fun I tried with one threshold on each RGB layer to get 8 colors pics.
I suppose this is in some way a cheap version of some kernel-based filters or dithering techniques, and there is probably a name for it that I don't know about.



Here is a standart threshold applied to a picture :

And now an "optimized" threshold with various settings :

The color of the dress seems to change dependin on the threshold bias.
This one with a very narrow range :

One with colors :


the source

My appoligies to you, the woman on the picture, I don't know who you are and just picked a random photo to make tests on it.