cathoderaydude / Babel

A simple translation tool for on-screen text using Google Cloud Vision and Translate. Intended for translating emulated videogames and similar things.
MIT License
2 stars 0 forks source link

Implement image filters #30

Open cathoderaydude opened 4 years ago

cathoderaydude commented 4 years ago

Various simple filters may help Google Cloud Vision identify characters. The most basic is threshold, which should be as simple (off the top of my head) as walking the image and for every pixel, Pixel = Pixel.R + Pixel.G + Pixel.B / 3 > 128 ? 255 : 0;

That's a very naive algorithm; there are absolutely simple and better ways to do this online, but the point is we should be able to implement this in a one-liner. Also consider monochrome (with color channel selection) and brightness/contrast, all very easy to implement with stackexchange snippets.

We'll probably need to switch the picturebox back to using the 'edit' instance of the snap if that hasn't already been done, so that we can re-copy from the original if the user wants to disable or change filters.