织梦wap网站模版站长工具的使用seo综合查询运营
文章目录
- shreshoding阈值化
- 1 simple thresholding简单阈值化
- 2 adaptive shresholding自适应阈值
- 3 Otsu and Riddler-Calvard
shreshoding阈值化
阈值化就是图像的二值化,我们通常选择把一幅灰度图转换成二值图,里面的像素值要么是0,要么是255。
一个简单地方法就是选择一个数值p,当像素值小于这个数的时候,就变成0,大于这个数的时候就变成了255。
通常我们使用阈值化,来聚焦一幅图形中的物体或感兴趣的区域。
1 simple thresholding简单阈值化
# 简单二值化
# 155是一个阈值,高于这个值得变成白色(前景),低于这个值得变成黑色(背景)
(T, thersh) = cv2.threshold(blurred, 155, 255, cv2.THRESH_BINARY)
cv2.imshow("Threshold Binary", thresh)
# 反向二值化
(T, thershInv) = cv2.threshold(blurred,