1

I am using ENVI to perform a convolution,

With Median set, a kernel size of 5, and an Image Add Back value of 0%

The results in ENVI are really good,

When I try to do the same using CONVOL in IDL I can’t manage to get it to work the same way,

Here is my code:

fsize = 5
ext = [fsize, fsize]
kernel = REPLICATE(1, ext[0], ext[1])
B = BYTE(CONVOL(B, kernel, INVALID=255, MISSING=255, /CENTER, /EDGE_WRAP))

Can someone tell me what’s wrong?

Eric Brown
  • 13,774
  • 7
  • 30
  • 71
user2333346
  • 1,083
  • 4
  • 21
  • 40
  • Have you tried reversing your kernel? IDL does not do this prior to computing the convolution. So if you check out their [documentation](https://www.exelisvis.com/docs/CONVOL.html), you will notice that they suggest using the reverse of the kernel on input. – honeste_vivere Sep 28 '14 at 16:01

1 Answers1

0

I don't think you want to use CONVOL. You are actually doing a median filter, so you should use the MEDIAN function:

result = MEDIAN(array, 5)
Chris Torrence
  • 452
  • 3
  • 11