Re: image edges with convolution
- From: Martin Leese <please@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Jul 2005 09:47:59 -0600
Oof wrote:
Hi there,
I'm fiddling with simple convolution filters, and i was wondering how to treat the edges of the image. now i'm just ignoring the first row and column of the image, aswell as the bottom row and last column. ( with a 3x3 kernel )
Q: how can i apply the filter on the whole image incl the outermost boundries of the image
What you are doing now is the only correct way. However, has you are discovering, producing an output image which is a different size from the input image is inconvenient.
There are several ways you can handle the boundaries; they are all wrong. They include:
1. Mirror the edge pixels beyond the edge.
2. Replicate the edge pixel beyond the edge.
3. Assume the data is cyclical, and so
encroach into the opposite edge.
4. Pad with zeros (or some other constant
value).
5. Pad with data values that are statistically
the same has those close to the edge.Method 1. seems to be the most popular. I use 2. because it happens to be convenient for me.
-- Regards, Martin Leese E-mail: please@xxxxxxxxxxxxxxxxxxxxxxxxxx Web: http://members.tripod.com/martin_leese/ .
- References:
- image edges with convolution
- From: Oof
- image edges with convolution
- Prev by Date: image edges with convolution
- Next by Date: FFT pseudo code or VC++.net
- Previous by thread: image edges with convolution
- Next by thread: Re: image edges with convolution
- Index(es):