[Pekka Väänänen] has a Panasonic TV with a broken backlight that creates an uneven pink-green color. While not a big deal with most movies, black and white movies show the greatest impact. So, by modeling the distortion as a function, [Pekka] decided to find an inverse function that corrects distortions before they reach the TV.
However, the backlight does not emit enough light for some colors, meaning the blue and green channels must be dimmed. As mentioned before, the distortion is not even, so the distortion needs to be captured and then calculated.
He took a few photos with the phone, corrected the perspective and applied the blur. The camera has some distortion as well, but it works as a first approximation, but that’s not something we’ve covered here. He then set up the webcam and pointed it at the TV, trying to find good gain and offset values with a bit of Python.
Now it just becomes a problem of minimizing the difference per pixel. Ultimately he chose a random approach rather than an annealed or climbing approach. Now that he had the feature to apply, all he had to do was add a custom shader to his video player that includes a live shader editor. Had to hack into external texture handling, but is kind enough to include shader code and patch in the article.
The result is perfect, and it’s great for your old TV. But perhaps in some cases it is worth replacing the backlight completely.