[英]Python: Image preprocessing - Thresholding and binarizing low contrast images for Blob Detection
[英]Thresholding an image with a low and high threshold in Python
我想用低阈值和高阈值对图像进行阈值处理。 我已经对 HSV 图片的色调通道进行了阈值处理,但我想在两个数字之间对其进行阈值处理。 有没有办法将两个阈值操作合二为一?
rgb = io.imread("image.jpg")
hsv = rgb2hsv(rgb)
hue = hsv[:, :, 0] > 0.5
您可以使用布尔索引
hsv[(hsv[:,:,0] > upper_thresh) | (hsv[:,:,0] < lower_thresh)] = value
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.