简体   繁体   English

在 Python 中使用低阈值和高阈值对图像进行阈值处理

[英]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.

相关问题 Python:图像预处理 - 对低对比度图像进行阈值化和二值化以进行斑点检测 - Python: Image preprocessing - Thresholding and binarizing low contrast images for Blob Detection Scikit 图像 otsu 阈值处理产生零阈值 - Scikit image otsu thresholding producing zero threshold 使用Python / NumPy对图像阈值进行矢量化 - Vectorizing image thresholding with Python/NumPy 如何使用OTSU阈值取阈值仅图像的一部分? - How to take a threshold of only a part of the image with OTSU thresholding? 如何在 python 中的小波阈值中设置要处理的信号的阈值 - How to set a threshold value from signal to be processed in wavelet thresholding in python 是否可以使用 Python 将低质量图像转换为高质量图像? - Is it possible to turn a low quality image into a high quality one with Python? 使用 Python API 对 GEE 图像集合进行阈值处理 - Thresholding a GEE Image Collection with Python API 选择排序(从低到高)python - Selection Sort (low to high) python cv2.Canny 中的低阈值参数和高阈值参数有什么区别? - What is the difference between low threshold parameter and high threshold parameter in cv2.Canny? Python-以低分辨率显示实时视频供稿,以高分辨率记录静止图像 - Python - Display live video feed at low resolution, record a still image at a high resolution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM