Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sin city effect [closed]

As in the title, I am searching for an algorithm to produce the effect used in Sin City film, which is selecting a color from an image and desaturating the rest of it.

Image

like image 225
Wazery Avatar asked Sep 01 '26 21:09

Wazery


1 Answers

In theory, it should be simple enough:

  • Convert each pixel to HSL.
  • If the hue is within a given range, then increase the saturation by a certain amount.
  • Otherwise, set the saturation to 0.
  • Convert the HSL value back to RGB and go on to the next pixel.

You would need to experiment to figure out how big a hue range you needed, and how much to increase the saturation.

This probably wouldn't give you perfect results. Even if the input scene already had the guy in green and everything else in decidedly not-green colors (which you couldn't count on unless you had purposely staged it that way), you would probably get some less-than-ideal results around the boundaries between "green guy" and "background". Given the sort of budgets movies have to work with, I suspect they did a lot of manual touch-up where needed. But you can get close and try to tweak from there.

like image 76
Joe White Avatar answered Sep 03 '26 14:09

Joe White



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!