def binary_thresh( img, boundaries, filter):
if filter == 'RGB':
frame_to_thresh = img.copy()
else:
frame_to_thresh = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
for (lower, upper) in boundaries:
# create numpy arrays from the boundaries
lower = np.array(lower, dtype = "uint8")
upper = np.array(upper, dtype = "uint8")
# find the colors within the specified boundaries and apply the mask
mask = cv2.inRange(frame_to_thresh, lower, upper)
output = cv2.bitwise_and(frame_to_thresh, frame_to_thresh, mask = mask) #Returns an RGB image
return mask
lane_detection_module.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录