Zhang-Suen thinning algorithm: Difference between revisions
Content added Content deleted
(→{{header|J}}: Add J) |
(→{{header|J}}: Improve clarity of phrasing) |
||
Line 326: | Line 326: | ||
frameImg=: 0 ,. 0 , >:@$ {. ] NB. adds border of 0's to image |
frameImg=: 0 ,. 0 , >:@$ {. ] NB. adds border of 0's to image |
||
neighbrs=: adverb define NB. applies verb u to neighbourhoods |
|||
(1 1 ,: 3 3) u;._3 y |
(1 1 ,: 3 3) u;._3 y |
||
) |
) |
||
Line 347: | Line 347: | ||
whiten=: [ * -.@:*. NB. make black pixels white |
whiten=: [ * -.@:*. NB. make black pixels white |
||
zhangSuen=: [: toImage [: (whiten |
zhangSuen=: [: toImage [: (whiten frameImg@(step2 neighbrs))@(whiten frameImg@(step1 neighbrs))^:_ isBlackPx |
||
zhangSuenX=: verb define NB. alternative Explicit representation of verb above |
zhangSuenX=: verb define NB. alternative Explicit representation of verb above |