Hi all,
I am trying to enlarge (satellite) pixels to be displayed using e.g. TV
by using DILATE. My problem is that at the image boundaries DILATE
seems to refuse to do its job :-)
I'll illustrate it with a simplified example.
Let's say I have a vector with elements either being zero or different
from zero. Now I'd like to "draw a border" around each pixel different
from zero. With DILATE, it looks like this:
IDL> v = [0,0,0,1,0,0,0]
IDL> s = replicate(1,3)
IDL> print, dilate(v, s, /gray, /constrained)
0 0 1 1 1 0 0
Everything fine so far, the center pixel is no bordered by two more
pixels with the same value.
Now, if I am going to the edge of the vector, it looks like this:
IDL> v = [0,1,0,0,0,0,0]
IDL> s = replicate(1,3)
IDL> print, dilate(v, s, /gray, /constrained)
1 1 1 0 0 0 0
Still o.k., the structuring element s just extends to the first element
of v.
But now, if s gets larger, it's again no problem in the center:
DL> v = [0,0,0,1,0,0,0]
IDL> s = replicate(1,5)
IDL> print, dilate(v, s, /gray, /constrained)
0 1 1 1 1 1 0
But alas, at the image border things don't work any more:
IDL> v = [0,1,0,0,0,0,0]
IDL> s = replicate(1,5)
IDL> print, dilate(v, s, /gray, /constrained)
0 0 0 0 0 0 0
So the problem seems to be the structuring element extending outside
the vector. Is this a bug or a feature? I don't know.
Best regards,
Peter
|