Re: Low pass filter - Problem with kernel [message #50402] |
Tue, 03 October 2006 07:41  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Vidhya wrote:
> Dear All,
>
> Stuck with the error message:
>
> "% CONVOL: Incompatible dimensions for Array and Kernel.
> % Execution halted at: $MAIN$"
>
> while trying to apply a low pass filter to one of my image data.
>
> The array dimensions for kernel is
> IDL> help, kernel
> KERNEL FLOAT = Array[3, 3]
> IDL> help, column_log
> COLUMN_LOG FLOAT = Array[1, 374]
It would help a great deal if you showed us a simplified version of the
code that actually failed. As it is, we can can't be sure what you're
doing. For instance, what is column_log? If it's the array that you're
trying to convolve with that kernel, you've got a serious problem:
column_log has a length of only 1 in the first dimension, which is
insufficient to make use of a kernel whose first dimension has a length
of 3. If you're talking about an image, the data you're convolving
shouldn't be a 1x374 array. What is the shape of the image that you're
trying to convolve?
|
|
|
Re: Low pass filter - Problem with kernel [message #50403 is a reply to message #50402] |
Tue, 03 October 2006 05:52   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Vidhya writes:
> Stuck with the error message:
>
> "% CONVOL: Incompatible dimensions for Array and Kernel.
> % Execution halted at: $MAIN$"
>
> while trying to apply a low pass filter to one of my image data.
>
> The array dimensions for kernel is
> IDL> help, kernel
> KERNEL FLOAT = Array[3, 3]
> IDL> help, column_log
> COLUMN_LOG FLOAT = Array[1, 374]
>
> Since i am new to IDL, your help is appreciated.
>
> Is it that the array size for kernel should be less than the image
> size?
>
> Also, I have serious troubles in redirecting the results to HDF format.
>
> Unfortunately, I am able to create a HDF file but to see only a noisy
> data without any image.
Humm, well, I don't see any image either. Perhaps you
could give us a little more detail about what you
are trying to do here.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Low pass filter - Problem with kernel [message #50534 is a reply to message #50402] |
Wed, 04 October 2006 02:44  |
Vidhya
Messages: 6 Registered: October 2006
|
Junior Member |
|
|
Dear All,
Sorry for not giving a detailed description of the program. The
following is the program, which tries to apply a low pass filter to an
image of size, 766*374 with 62 bands.
PRO vnoise
filename='image.hdf'
hdfid=hdf_sd_start(filename, /READ)
varid=hdf_sd_select(hdfid, 0)
hdf_sd_getdata, varid, image
varid=hdf_sd_select(hdfid, 1)
hdf_sd_getdata, varid, mask
hdf_sd_end_access, varid
hdf_sd_end, hdfid
column_average=rebin(image, 1, 374, 62)
;applying the log to the average radiance of the image
column_log = alog10(column_average)
ksize = [3,3]
kernel = replicate((1.0/(ksize[0]*ksize[1])), ksize[0], ksize[1])
filtered_image = convol(float(column_log), kernel, /CENTER,
/EDGE_TRUNCATE)
;filtered_image = convol(float(column_log), kernel, /CENTER,
/EDGE_TRUNCATE)
;% CONVOL: Incompatible dimensions for Array and Kernel.
;% Execution halted at: $MAIN$
And this is where I get the error message about the dimensions.
What I am trying to do is to rebin the image column-wise, apply a log
to the average, and then apply the kernel to the image.
Let me know where I go wrong!
Thank you
Vidhya
|
|
|