Image Padding Techniques: Replication vs.
Wrap Around
In image processing, when applying filters (like convolution) to edge pixels, the filter kernel may extend
beyond the boundary of the image.
To handle this, we use padding techniques. Two common methods are:
1. Replication Padding (Edge Padding)
Definition:
Replicates (repeats) the values at the edge of the image to fill the padding.
Example:
Original 3x3 image:
[123]
[456]
[789]
With replication padding (1-pixel padding):
[11233]
[11233]
[44566]
[77899]
[77899]
Use Case:
Preserves edges well; reduces artificial boundaries.
2. Wrap Around Padding (Circular Padding)
Definition:
Wraps around the image, pulling pixel values from the opposite edge.
Example:
Original 3x3 image:
[123]
[456]
[789]
With wrap around padding (1-pixel padding):
[97897]
[31231]
[64564]
[97897]
[31231]
Use Case:
Suitable for periodic data or frequency domain operations.
Summary Table:
| Feature | Replication Padding | Wrap Around Padding |
|-----------------------|-----------------------------|-----------------------------|
| Padding Source | Edge values replicated | Opposite edge values |
| Preserves Edges | Yes | No |
| Introduces Artifacts | Minimal | Possible (due to wrap effect) |
| Use Case | Image smoothing, edge processing | Frequency-based filters |