In article <3EFA918D.2010108@gsf.de>,
Karsten Rodenacker <Karsten.Rodenacker@gsf.de> wrote:
> Hi, I have slightly changed your Morphtest example into Morphtest1 with
> two parameters, extension and type. You should play around with
> extension and gen_sphere type. You will see, that the flat value
> structuring element (STE) does not show considerable differences to the
> simple STE. However the last example shows some influences of value STE.
>
> Flat STE controls local extension, value STE controls value extension
> (and function shape).
>
> To learn to understand morphological operations morph_tophat is IMHO not
> the best routine. Since it is simply the differenc between original and
> opened array, I have replaced it by open and close, the ingredients for
> bright and dark tophat.
>
> Simply run Morphtest1 will open 4 windows with different parameters
> showing opening and closing.
>
Hi,
I posted a message earlier today - but the pesky server is having a bad
hair day. Thanks so much - the fog is a bit less dense now. The
lower level routines do give a heck of a lot more control, as you show
it.
I modified the code, yet again, to show how the various TOPHAT filter
work. On each plot is shown the data (thin line), the opening (thick
line) and the tophat (dashed.) On each plot, RSI's MORPH_TOPHAT is
shown in the top plot, in the subsequent ones show
tophatResult = original - openedOriginal
using the various VALUES provided by your GEN_SPHERE routine.
Thanks again,
Ben
*****begin code
Pro MorphTest, n, t
x = [19,19,21,23,24,23,22,21,20,19,20,20,19,17,15,$
13,11,11,12,14,17,21,24,25,24,23,21,21,23,26,29,30,27,$
22,17,12,10,10,12,14,16,19,20,21,20,17,12,8,$
4,3,3,6,10,14,19,23,26,27,28,29,29,29,29,27,$
23,19,16,14,14,16,18,19,19,18,15,13,11,7,$
4,1,0,0,3,6,10,12,12,11,8,5,2,1,1,4,7,11,14,17,20,23,27]
if n_params() eq 0 then n = 10
if n_params() le 1 then t = 1
old_p = !P
!P.CharSize = 2
!P.Multi = [0,1,3]
Dim = get_Screen_Size()
Window, /Free, ys = dim[1]*0.9
plot, x, title = "orig with simple open/close"
oplot, thick = 2, $
morph_open(x, [0b,replicate(1b,n-1),0b],/gray)
;oplot, thick = 1, linest=1, $
; morph_close(x, [0b,replicate(1b,n-1),0b],/gray)
oplot, thick = 2, linest = 2, $
morph_Tophat(x,[0b,replicate(1b,n-1),0b])
plot, x, title = 'orig with open/close values set flat top'
values = [0b, replicate(byte(n-1),n-1),0b]
op = morph_open(x, [0b, replicate(1b,n-1), 0b], values = values )
oplot, thick = 2, op
;oplot, thick = 1,linest=1, $
; morph_close(x, [0b, replicate(1b,n-1), 0b], values = values )
oplot, thick = 2, linestyle = 2, x-op
oplot, Indgen(n+1) + 80, values + 10, thick = 2
plot, x, title = 'orig with open/close values set with gen_sphere'
values = gen_sphere(n/2, typ=t)
op = morph_open(x, [0b, replicate(1b,n-1), 0b], values = values )
oplot, thick =2, $
morph_open(x, [0b, replicate(1b,n-1), 0b],values =values )
;oplot, thick =1, linest=1, $
; morph_close(x, [0b, replicate(1b,n-1), 0b],values =values )
oplot, thick = 2, linestyle = 2, x-op
oplot, Indgen(n+1) + 80, values + 10, thick = 2
!P = old_p
End
PRO morphtest1
for i=6,12,2 do morphtest,i,1
end
*****end code
--
Ben Tupper
Bigelow Laboratory for Ocean Sciences
btupper@bigelow.org
|