especially, but not only, Marshall, Markus, and Ben

Regarding closures, I am not seeing their benefit unless the calculation of
closures is more efficient, because in my case the need is to compare the
results of various image closures (or various image contigmds) not for
producing the closure itself or the contigmd itself. In other words for my
application, I am seeking the image with the fewest holes in the diamond or
other suit icon, not trying to draw a better image.

(So is the calculation of closures much more efficient than contigmd ?)

But I may be missing something else here in your fine answers, so please
straighten me out because I don't exactly see how to use the result of the
closures except perhaps to count the frequency of 1s in Markus' result for

show im1 + clos22 im1
or for
show im1 + closc4 im1

shown below, and then select the threshold that produced the result with
fewest 1s.

Thanks, folks,


On Tue, Jun 27, 2017 at 8:42 AM, Ben Gorte - CITG <[email protected]>
wrote:

> I was thinking about closing too, but a little bit slower than Markus,
>
>    show =: (-.&' ')"1 @: ":
>    expand =: 3 : '(,.~{."1)(,.{:"1)(,~{.)(,{:) y'
>    minf =: 3 : '3 3 <./@:, ;. _3 expand y'
>    maxf =: 3 : '3 3 >./@:, ;. _3 expand y'
>    (show im1);show minf maxf im1
> +--------------------------+--------------------------+
> |00000000000000000000000000|00000000000000000000000000|
> |00000000000000000000000000|00000000000000000000000000|
> |00000000000000000000000000|00000000000000000000000000|
> |00000000000000000000000000|00000000000000000000000000|
> |00000000000000100000000000|00000000000000100000000000|
> |00000000000001110000000000|00000000000001110000000000|
> |00000000000001110000000000|00000000000001110000000000|
> |00000000000011111000000000|00000000000011111000000000|
> |00000000000111111100000000|00000000000111111100000000|
> |00000000000111101100000000|00000000000111111100000000|
> |00000000001111111110000000|00000000001111111110000000|
> |00000000011111111100000000|00000000011111111110000000|
> |00000000111111111111100000|00000000111111111111100000|
> |00000001111111111111010000|00000001111111111111110000|
> |00000011111111111111010000|00000011111111111111110000|
> |00000101111111111110011100|00000111111111111111111100|
> |00001111011110110101011100|00001111111111111111111100|
> |00000111111111111111110000|00000111111111111111110000|
> |00000011110011100101100000|00000011111111111111100000|
> |00000001111111111101100000|00000001111111111111100000|
> |00000001111111110100000000|00000001111111111110000000|
> |00000000011111110110000000|00000000011111111110000000|
> |00000000010101010000000000|00000000011111111000000000|
> |00000000000010110000000000|00000000000111111000000000|
> |00000000000110111000000000|00000000000111111000000000|
> |00000000000110110000000000|00000000000111110000000000|
> |00000000000010100000000000|00000000000011100000000000|
> |00000000000000000000000000|00000000000000000000000000|
> |00000000000000000000000000|00000000000000000000000000|
> |00000000000000000000000000|00000000000000000000000000|
> +--------------------------+--------------------------+
>
> Greetings,
> Ben
>
> ________________________________________
> From: Programming [[email protected]] on behalf of
> Schmidt-Gröttrup, Markus [[email protected]]
> Sent: Tuesday, June 27, 2017 13:38
> To: [email protected]
> Subject: Re: [Jprogramming] cleanest diamond
>
> A morphological closure is the reasonable treating.
>
> With these definitions:
> im1 =:  _48+ (, ;._2) a. i. 0 : 0
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000100000000000
> 00000000000001110000000000
> 00000000000001110000000000
> 00000000000011111000000000
> 00000000000111111100000000
> 00000000000111101100000000
> 00000000001111111110000000
> 00000000011111111100000000
> 00000000111111111111100000
> 00000001111111111111010000
> 00000011111111111111010000
> 00000101111111111110011100
> 00001111011110110101011100
> 00000111111111111111110000
> 00000011110011100101100000
> 00000001111111111101100000
> 00000001111111110100000000
> 00000000011111110110000000
> 00000000010101010000000000
> 00000000000010110000000000
> 00000000000110111000000000
> 00000000000110110000000000
> 00000000000010100000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
> )  show =: (-.&' ')"1 @: ":
>    expand =: 3 : '(,.~{."1)(,.{:"1)(,~{.)(,{:) y'
>    minf =: 3 : '3 3 <./@:, ;. _3 expand y'
>    maxf =: 3 : '3 3 >./@:, ;. _3 expand y'
>
>
​[snip]
​


>  ushift =: 0 ,~ }.
>    dshift =: 0 , }:
>    lshift =: 0 ,"1~ }."1
>    rshift =: 0 ,"1 }:"1
>    ulshift =: ushift@lshift
>    urshift =: ushift@rshift
>    dlshift =: dshift@lshift
>    drshift =: dshift@rshift
>    clos22 =: (]*.rshift)@:(]*.dshift)@:(]+.lshift)@:(]+.ushift)
>    closc4 =: (]*.urshift)@:(]*.drshift)@:(]*.rshift)@:(]*.dshift)@:(]+.
> dlshift)@:(]+.ulshift)@:(]+.lshift)@:(]+.ushift)
>    show =: (-.&' ')"1 @: ":
>
> closures with a 2*2 square or a circle with diameter 4 are shown with:
>
>    show im1 + clos22 im1
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000200000000000
> 00000000000002220000000000
> 00000000000002220000000000
> 00000000000022222000000000
> 00000000000222222200000000
> 00000000000222212200000000
> 00000000002222222220000000
> 00000000022222222210000000
> 00000000222222222222200000
> 00000002222222222222120000
> 00000022222222222222120000
> 00000212222222222221122200
> 00002222122221221212122200
> 00000222222222222222220000
> 00000022221122211212200000
> 00000002222222222212200000
> 00000002222222221210000000
> 00000000022222221220000000
> 00000000021212120000000000
> 00000000000121220000000000
> 00000000000221222000000000
> 00000000000221220000000000
> 00000000000021200000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
>    show im1 + closc4 im1
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000200000000000
> 00000000000002220000000000
> 00000000000002220000000000
> 00000000000022222000000000
> 00000000000222222200000000
> 00000000000222212200000000
> 00000000002222222220000000
> 00000000022222222211000000
> 00000000222222222222200000
> 00000002222222222222120000
> 00000022222222222222121000
> 00000212222222222221122200
> 00002222122221221212122200
> 00000222222222222222220000
> 00000022221122211212200000
> 00000002222222222212200000
> 00000002222222221211000000
> 00000000122222221220000000
> 00000000021212121100000000
> 00000000001121221000000000
> 00000000000221222000000000
> 00000000000221220000000000
> 00000000000021200000000000
> 00000000000000000000000000
> 00000000000000000000000000
> 00000000000000000000000000
>
> Best regards,
>
> Markus
>
>
> -----Ursprüngliche Nachricht-----
> Von: Programming [mailto:[email protected]] Im
> Auftrag von Marshall Lochbaum
> Gesendet: Dienstag, 27. Juni 2017 10:20
> An: [email protected]
> Betreff: Re: [Jprogramming] cleanest diamond
>
> ​[snip]
>


> However, it should be possibly to either penalize values at the edges
> (say, by adding a multiple of (*:128-~i.256) or select a local minimum near
> the middle to obtain a threshold.
>
> One other note is that performing a morphological closure on the ones will
> remove any small gaps left by thresholding while preserving the diamond
> shape.
>
> Marshall
>
> --
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to