I do not know the detail steps of hq2x algorithm. Although I have downloaded the source code from website, I still cannot understand the steps from the source code. Can anyone help me to explain how to do the algorithm step by step? Thank you!
It looks at several pixels at once (a central pixel and its neighbors). Uses contrast to divide the group into light and dark pixels (think of it as 1-bit bitmap). Then it uses this to recognize a pattern that these pixels form (e.g. a diagonal line) and outputs a predefined, enlarged version of that pattern, colorized with source pixels.
e.g. if you notice that neighboring pixels form that shape:
X . .
. X .
. . X
then you can output higher-res version of it:
xXXx......
..xXXx....
....xXXx..
......xXXx
The areas for recognizing patterns are overlapping for continuity (or another way to think about it that it looks at more pixels for context, e.g. to distinguish diagonal line from rounded corner).
Because of pattern recognition, hq2x works well only on high-contrast cartoony images. With natural images, with lots of blurry edges and anti-aliased lines the algorithm fails to notice patterns and ends up simply interpolating the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With