feat generate 修改中心点判断
This commit is contained in:
@@ -167,7 +167,7 @@ def stain_detection(image, spot_size=100):
|
|||||||
# 寻找轮廓
|
# 寻找轮廓
|
||||||
contours, _ = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
contours, _ = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
||||||
# 过滤非连续的纯白区域
|
# 过滤非连续的纯白区域
|
||||||
filtered_contours = [cnt for cnt in contours if cv2.contourArea(cnt) >= 50] # 根据面积进行过滤,这里假设面积大于50的为连续区域
|
filtered_contours = [cnt for cnt in contours if cv2.contourArea(cnt) >= 30] # 根据面积进行过滤,这里假设面积大于30的为连续区域
|
||||||
# 如果有连续的纯白区域存在
|
# 如果有连续的纯白区域存在
|
||||||
if filtered_contours:
|
if filtered_contours:
|
||||||
# 将纯白区域替换为灰色
|
# 将纯白区域替换为灰色
|
||||||
|
|||||||
Reference in New Issue
Block a user