I want to implement a gradient operator on an image in Matlab. Should I have to pad the image before its implementation? How do I decide which padding to use e.g. whether to use zero-padding or Symmetric padding? How are they differ from each other? I am new to this field of image processing, Can you provide some references to learn this stuff?
Gradients enhances differences. Hence, highly non-smooth padding (like zero-padding) yields higher gradients, as they don't ensure continuity. Symmetric extensions preserve continuity, and anti-symmetric ones are likely to better preserve derivatives. There is a lot of literature on that, for instance in the filter bank domain. Suppose that the edge sample is $x$, you can have whole-sample anti-symmetry or half-sample anti-symmetry:
- $x[-1] = -x+2x $
- $x[-1] = x $ and $x[-2] = -x+2x $
This is illustrated in the picture, from the first paper mentioned below. One can find whole-sample (WS) and half-sample (HS) symmetries and anti-symmetries. A lot of image processing operators combine symmetry or anti-symmetry, so those can be useful.
A couple of pointers:
- Lifted linear phase filter banks and the polyphase-with-advance representation (JPEG 2000 image coding applications)
- Classification of Nonexpansive Symmetric Extension Transforms for Multirate Filter Banks
- Unitary FIR filter banks and symmetry
Recently, unitary FIR filter banks with linear-phase have been completely parameterized by exploiting the eigenstructure of the exchange matrix. This correspondence gives new characterizations of polyphase matrices of filter banks with various types of symmetry on the filters. Using matrix extensions of the well-known hyperbolic and orthogonal lattices, we give a alternative proof for the parameterization of linear-phase unitary filter banks. A complete parameterization of FIR unitary filter banks with each of the different types of symmetries considered (not just linear-phase) is also given. These results can also be used to generate non-unitary filter banks with symmetries, though no completeness results can be obtained. In some cases implicit, and in others explicit parameterization of wavelet tight frames associated with these filter banks are also given. This paper only considers filter banks with an even number of channels. A similar theory can be developed if the number of channels is an odd integer.
Aside, there are many other possible extensions, using constant continuation (or pixel replication), or higher-order (eg linear, polynomial) extrapolations: