繁花如伊
你是这个意思?:import cv2import numpy as npimg = cv2.imread("image.jpg")hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)mask = cv2.inRange(hsv, (0, 0, 0), (75, 255, 255))imask = mask > 0green = np.zeros_like(img, np.uint8)green[imask] = img[imask]cv2.imwrite("result.png", green)输出