##############################
##################################
#####################################
##################################
##########################
###### ##############
########################
#######################
########################
###### ##############
###### ##############
##########################
##################################
######## #####################################
###########################################
########################################
Produz a saída thinned: # ########## ####### ## # #### # # # ## # # # # # # # # # ############ # # # # # # # # # # # # # # ## # ############ ### ### </pre>Algoritmo
Suponha que os pixels pretos sejam um e que os pixels brancos sejam zero, e que a imagem de entrada seja uma matriz N retangular por M de uns e zeros. O algoritmo opera em todos os pixels pretos P1 que podem ter oito vizinhos. Os vizinhos são, em ordem, organizados como:
| P9 | P2 | P3 |
| P8 | P1 | P4 |
| P7 | P6 | P5 |
Define $A(P1)$ = the number of transitions from white to black, (0 -> 1) in the sequence P2,P3,P4,P5,P6,P7,P8,P9,P2. (Note the extra P2 at the end - it is circular). Define $B(P1)$ = the number of black pixel neighbours of P1. ( = sum(P2 .. P9) )
Tarefa: Escreva uma rotina para realizar o desbaste de Zhang-Suen em uma matriz de imagem de uns e zeros.
thinImage deve ser uma função
testString: 'assert.equal(typeof thinImage, "function", "thinImage must be a function");'
- text: thinImage deve retornar um array
testString: 'assert(Array.isArray(result), "thinImage must return an array");'
- text: thinImage deve retornar um array de strings
testString: 'assert.equal(typeof result[0], "string", "thinImage must return an array of strings");'
- text: thinImage deve retornar um array de strings
testString: 'assert.deepEqual(result, expected, "thinImage must return an array of strings");'
```