Hack SmartDeblur 2.2

    We will mock Mr. YUVladimir’s wonderful program called SmartDeblur , which is designed to correct blurry images. Of course, this cannot be called a full-fledged hack. So, a little exercise with pictures.

    Take a spoiled image with a shake.

    Run through the demo version of SmartDeblur and get

    We notice watermarks that we don’t like. If you repeat the experiment several times with the same source image, you can see that the signs are very static: neither the text nor the position of the inscriptions changes. So, for applying watermarks SmartDeblur just applies some kind of mask. Which one? Very easy to find out! We palm off the program a white field the same size as the original picture. We switch to the Gaussian blur correction mode with a radius of 0.1 and we get

    This is the desired mask. The space between the inscriptions, by the way, is not completely white, hmm, okay ... We will calculate in the RGB system with integer values ​​from 0 to 255, in general, without exotics. It was experimentally possible to determine that the mask is superimposed according to the formula R out = R in * Rmask ÷ 255 , where R in is the value of the red channel before masking, R mask is the value of the red channel of the mask itself, R out is the value of the red channel obtained as a result of masking, ÷ is integer division. For green and blue channels the same. In graphic editors, this method is usually called simply "multiplication."

    Against the "multiplication" we will use the "division". True, with a loss of accuracy. We calculate by the inverse formula R in = R out * 255 ÷ R mask and see

    Some traces still remained. Either the loss of accuracy is to blame, or I was a little mistaken in the formulas. But now watermarks are not so striking, which is quite enough for our purposes. And we will be grateful to the author of the SmartDeblur program for comments.

    Also popular now: