News for hackers. Stuff that matters.
Re:Image color replacement with numerical optimization by maurits on Thursday July 01, 2021 @10:07AM (#27699164)
Pretty clever. Somewhat related, if you want to match the colours of an entire image to an other, you can use optimal transport [1]

Unrelated, the author has a very nice take on generating the organic grid from Oskar Stålberg’s Townscaper game [2].

[1]: https://codimd.math.cnrs.fr/s/2eRBqV9zl

[2]: https://andersource.dev/2020/11/06/organic-grid.html

Re:Image color replacement with numerical optimization by vanderZwan on Thursday July 01, 2021 @10:09AM (#27699192)
Here is a JavaScript implementation by Fil:

https://observablehq.com/@fil/sliced-optimal-transport

Re:Image color replacement with numerical optimization by Doxin on Friday July 02, 2021 @09:32AM (#27711277)
re: link #2

While that is a much simpler solution and quite a nice writeup, it doesn't quite solve the problem that townscaper poses. For that it needs to be infinitely expandable, which is quite a different feat.

Re:Image color replacement with numerical optimization by lostinthefield on Thursday July 01, 2021 @11:05AM (#27699780)
As someone who's not trained in math, what does "optimal transport" mean?
Re:Image color replacement with numerical optimization by dandelany on Thursday July 01, 2021 @01:27PM (#27701749)
Let’s say we have 12 iron mines with known amounts of iron ore supply, and 10 steel foundries with known amounts of demand. For each (mine, foundry) pair, there is a known cost of shipping the ore from point A to B. Which mines should send how much ore to which foundries?

AIUI, that is the general “optimal transport problem”. Now replace ore with colors and it applies to the problem above :)

Re:Image color replacement with numerical optimization by andersource on Thursday July 01, 2021 @10:31AM (#27699391)
Thanks! The optimal transport is really cool!