Re: using convol with 2D image and 1D kernel [message #37199 is a reply to message #37198] |
Sat, 29 November 2003 11:17   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Bruce writes:
> Hello, I was wondering what the convol(array,kernel) function does
> when it is given a 2D array and a 1D kernel ?
>
> I have run through "Example 2" for the digital_filter() function,
> in which the 2D array "mandril" is convolved with the 1D array
> "filter" (in Reference Volume 1):
>
> mandril = bytarr(512,512)
> ...
> mandril = float(mandril)
> filter = digital_filter(0.0,0.1,50,10)
> filt_image = convol(mandril,filter)
>
> I can see that the image is smoothed, but did convol()
> 1) take the 1D kernel of size 1x21 and run it over the image, where
> the result at each point is only influenced by points in the
> horizontal direction,
> OR
> 2) take the 1D kernel and transform it into some 2D kernel of
> dimension 21x21, and run that over the image, where the result is
> now influenced by points in both the horizontal and vertical
> directions ?
If you do a "Help, filter" after the DIGITAL_FILTER step,
you see that the filter is a 21-element 1D array. So
the convolution is performed as in 1 above.
You can also see this because there will be black
bands on the left and right edge of the image, since
the example did not use the EDGE_TRUNCATE keyword.
Had the filter been applied two-dimensionally, you
would have seen a band around the entire image.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|