[英]Thresholding an image with a low and high threshold in Python
I want to threshold an image with a low and high threshold.我想用低阈值和高阈值对图像进行阈值处理。 I already performed thresholding on a hue channel of a HSV picture, but I want to threshold it between two numbers.
我已经对 HSV 图片的色调通道进行了阈值处理,但我想在两个数字之间对其进行阈值处理。 Is there a way to do two thresholding operations in one?
有没有办法将两个阈值操作合二为一?
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.