網頁

2016年10月26日 星期三

findContours, drawContours

findContours
Non-zero pixels are treated as 1's. Zero pixels remain 0's, so the image is treated as binary.
0: 黑, 255(白)
以黑為背景,尋找灰白的前景邊界

hierarchy
the elements hierarchy[i][0] , hiearchy[i][1] , hiearchy[i][2] , and hiearchy[i][3] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively.
0: 下一個
1: 上一個
2: 第一個兒子
3: 父親
If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
沒有就是 -1

RETR_EXTERNAL
It sets hierarchy[i][2]=hierarchy[i][3]=-1 for all the contours.

RETR_CCOMP
所有邊界分為兩層, 白的外圈, 和內圈
hierarchy[i][3]=-1 for all the contours.

drawContours


沒有留言:

張貼留言