def simple_feature_size_filter(img, minradius, maxradius):
feature_radius_min = minradius | 1 # play with these to see show they affect highlighting of structures of various sizes
feature_radius_max = maxradius | 1
if 0:
w = feature_radius_min*2 | 1
blurred = cv2.GaussianBlur(img, (w, w), feature_radius_min)
w = feature_radius_max*2 | 1
veryblurred = cv2.GaussianBlur(img, (w, w), feature_radius_max)
else:
s = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (feature_radius_min, feature_radius_min))
blurred = cv2.morphologyEx(img, cv2.MORPH_OPEN, s)
s = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (feature_radius_max, feature_radius_max))
veryblurred = cv2.morphologyEx(img, cv2.MORPH_OPEN, s)
bandfiltered = blurred - np.minimum(veryblurred, blurred)
return bandfiltered
pointextractorutil.py 文件源码
python
阅读 31
收藏 0
点赞 0
评论 0
评论列表
文章目录