comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: using convol with 2D image and 1D kernel

Re: using convol with 2D image and 1D kernel
type: item
description: lunde@nrlssc.navy.mil (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): > ... > > 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, Why not check it out for yourself, by convolving each scan line of the original image one at a time, and seeing which output you get? Experimentally yours, Craig -- ------------------------------------------------------------ -------------- Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response ------------------------------------------------------------ --------------
creator: Craig Markwardt
date: 2003-11-29T19:07:56-00:00

Re: using convol with 2D image and 1D kernel
type: item
description: 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
creator: David Fanning
date: 2003-11-29T19:17:41-00:00

Re: using convol with 2D image and 1D kernel
type: item
description: Just a little note - the easiest way to see what a filter is doing is to give it a single impulse point in a field of zeros, and look at the result. For example, for Bruce's question, just set all of the 'mandrill's array to zero, and then set the central point to 1 (or 256, or whatever). then look at the output. The value in each cell after the filtering can be considered as the contribution that a specific cell makes at that distance to another, through the filter. Cheers; Chris "David Fanning" <david@dfanning.com> wrote in message news:MPG.1a329ebbb9da263a989760@news.frii.com... > 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…
creator: Chris[1]
date: 2003-11-29T22:23:17-00:00

Re: using convol with 2D image and 1D kernel
type: item
description: Thanks for all of your insights and ideas. They helped me understand this problem, and other related problems. Bruce
creator: lunde
date: 2003-11-30T05:04:47-00:00