comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » MORPH_HITORMISS "Don't care" pixels?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
MORPH_HITORMISS "Don't care" pixels? [message #76775] Fri, 01 July 2011 18:23
Andre is currently offline  Andre
Messages: 4
Registered: June 2011
Junior Member
Hello,

I'm experimenting with structuring elements to enhance the
connectivity of linear networks extracted with image filtering. I read
somewhere in the posts that trying to implement series of asymmetric
structuring elements may yield series headaches. I can largely confirm
that and here is what came out of my headache so far...

The image is a binary array where 0s mark the extracted lines and 1s
mark the background, so I try to find 1-pixels that would serve to
connect 0-pixels using IDL MORPH_HITORMISS.

Below there are some pieces of the code to find gaps with horizontal,
vertical gaps and asymmetric neighbors but when it comes to the
diagonal case I really get confused. In the following case for example
I would like to to find the the connecting pixel in the middle.

0 1 1 0 1 1
1 1 1 -> 1 x 1
1 1 0 1 1 0
...easy it seems!
However, if for example one of the zeros already has diagonal
neighbors I would like to avoid the connection:

1 1 0 1 1
1 0 1 1 1
0 1 1 1 0
1 1 1 0 1

Only a few pixels are interesting here and ignoring the rest could
significantly reduce the number of possible combinations. I thought of
something like that:
. . 1 . . . . 1 . .
. 0 1 . . . 0 1 . .
1 1 1 1 1 -> 1 1 x 1 1
. . 1 0 . . . 1 0 .
. . 1 . . . . 1 . .

In some tutorials on hit or miss morphology the possibility to ignore
some positions ("Don't care" pixels) is given. Is there any
possibility to do so with the IDL morpholghy commands?

Thanks in advance for any suggestion
Best wishes
Andre

; horizontal gaps
miss = [[0b,0b,0b],$
[1b,0b,1b], $
[0b,0b,0b]]

hit = [[1b,1b,1b], $
[0b,1b,0b], $
[1b,1b,1b]]

matches = matches + (morph_hitormiss(binary, hit, miss))

; vertical gaps
miss = rotate(miss,1)
hit = rotate(hit,1)
matches = matches + (morph_hitormiss(binary, hit, miss))

; asymetric gaps
miss = [[1b,0b,0b],$
[0b,0b,1b], $
[0b,0b,0b]]

hit = [[0b,1b,1b], $
[1b,1b,0b], $
[1b,1b,1b]]

for i=0, 7 do begin
missi=rotate(miss, i)
hiti=rotate(hit, i)
matches= matches + (morph_hitormiss(binary, hiti, missi))

end
[Message index]
 
Read Message
Previous Topic: Re: Problems with using oplot and a for loop
Next Topic: Re: Problem in creating Postscript of "Transparent Histograms"

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:02:48 PDT 2025

Total time taken to generate the page: 0.02087 seconds