这是我使用的代码。最后,我不得不重新调整我的数据帧,但只是为了更好地阅读。我认为我的代码有很多可能的改进,但是我很高兴我的代码行为足够好地满足我的需要。在import cv2
import numpy as np
import pandas as pd
img = cv2.imread('full_snap.png')
"""
some of my blue pixels
R: between 98 and 128
G: between 176 and 211
B: between 255
h: between 210 and 200
s: between 100 and 48
v: between 68 and 100
hsv/2 in opencv and opencv uses BGR not RGB
"""
blue_MIN = np.array([255, 176, 98])
blue_MAX = np.array([255, 211, 128])
"""
https://pythonprogramming.net/color-filter-python-opencv-tutorial/
"""
# find the blue pixels and save it in frame_threshed
frame_threshed = cv2.inRange(img, blue_MIN, blue_MAX)
# find contours in the thresholded image
cnts = cv2.