def threshold_image_for_tape(image):
"""
Thresholds image for reflective tape with light shined on it. This means it
looks for pixels that are almost white, makes them white, and makes
everything else black.
Parameters:
:param: `image` - the source image to threshold from
"""
orig_image = numpy.copy(image)
# print orig_image.size
orig_image = cv2.medianBlur(orig_image, 3)
# orig_image[orig_image > 100] = 255
# return orig_image[orig_image > 100]
height, width = orig_image.shape[0], orig_image.shape[1]
eight_bit_image = numpy.zeros((height, width, 1), numpy.uint8)
cv2.inRange(orig_image,
(B_RANGE[0], G_RANGE[0], R_RANGE[0], 0),
(B_RANGE[1], G_RANGE[1], R_RANGE[1], 100),
eight_bit_image)
# # eight_bit_image = cv2.adaptiveThreshold(orig_image,
# # 255,
# # cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
# # cv2.THRESH_BINARY,
# # 8,
# # 0)
# cv2.medianBlur(eight_bit_image, 9)
return eight_bit_image
vision_processing.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录