Is there any reverse operation to (image) gradient?

Suppose I have calculated gradient (of a grayscale image).

Gradient is a difference between neighboring pixels in X and Y directions.

Can I calculate image back, having this gradient information?

Can I filter gradient data somehow so that reverse operation give some reasonable results?


Gradient is the difference between the color of two neighboring pixels. To get back the image you need one piece of information: the initial color of the boundary pixels.

Like in math, a derivation can be reversed by integration as far as a constant term is involved. Or, if you have d = a - b you can get back a only if you also know b .

Without the boundary values you can still recover the image but not at the same saturation & contrast. There will be a constant term missing from the entire image.

Example

Consider an image which has only 3 pixels: 42, 142, 100 . The gradient will be 0, 100, -42 (computing it as the difference between the current pixel and the previous one). To get back the initial image we assume that the first pixel had been 0 and then do addition instead of subtraction: the recovered image will be 0, 100, (100-42) . As you see, adding 42 to all of them will give us back the initial image.


Yes, there is. As stated in Mihai's answer, it is basically integration.

A well-known work for this task is Poisson Image Editing by Pérez et al. You should have a look at the pixtures in the paper, maybe try to implement it (it is a classical assignment in Image Processing courses).


Integrating the gradient field is a routine operation is Shape from Shading and Photometric Stereo, where the surface normals are obtained and then integrated. To ensure you get a reasonable result you have to enforce the integrability constraint. There are several papers on this subject. You can try this one titled An Algebraic Approach to Surface Reconstruction from Gradient Fields. The author provides MATLAB code.

链接地址: http://www.djcxy.com/p/64032.html

上一篇: Canny边缘检测中的梯度方向

下一篇: 是否有任何逆向操作(图像)渐变?