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