##############################
##################################
#####################################
##################################
###### ####### ####### ######
###### ####### #######
########################
#######################
########################
###### ####### #######
###### ####### #######
###### ####### ####### ######
##################################
######## #####################################
######## ###################################
######## ####### ###### ###################
它产生稀疏的输出: # ########## ####### ## # #### # # # ## # # # # # # # # # ############ # # # # # # # # # # # # # # ## # ############ ### ### </pre>算法
假设黑色像素是一个并且白色像素为零,并且输入图像是矩形N乘M的1和0阵列。 该算法对可以具有八个邻居的所有黑色像素P1进行操作。邻居按顺序安排为:
| 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) )
任务: 编写一个例程,在1和0的图像矩阵上执行Zhang-Suen细化。
thinImage必须是一个函数
testString: 'assert.equal(typeof thinImage, "function", "thinImage must be a function");'
- text: thinImage必须返回一个数组
testString: 'assert(Array.isArray(result), "thinImage must return an array");'
- text: thinImage必须返回一个字符串数组
testString: 'assert.equal(typeof result[0], "string", "thinImage must return an array of strings");'
- text: thinImage必须返回一个字符串数组
testString: 'assert.deepEqual(result, expected, "thinImage must return an array of strings");'
```