You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Included 20 pixel x and y minimum for blimp like objects so only those
meeting these conditions will be 1) appended to centroid coordinate
lists which are used to calculate 3D position, and 2) surrounding by
the red bounding rectangle in the video being analyzed.
# definitely works with Mac OSX, Python 2.7, and OpenCV library
22
+
23
+
# to modify color thresholds, change the cv.Scalar values in the InRange method in the gettresholdedimg function below
24
+
25
+
defgetthresholdedimg(im):
26
+
27
+
# this function take RGB image.Then convert it into HSV for easy colour detection
28
+
# and threshold it with yellow and blue part as white and all other regions as black.Then return that image
29
+
30
+
globalimghsv
31
+
imghsv=cv.CreateImage(cv.GetSize(im),8,3)
32
+
33
+
# Convert image from RGB to HSV
34
+
cv.CvtColor(im,imghsv,cv.CV_BGR2HSV)
35
+
36
+
# creates images for blue
37
+
imgblue=cv.CreateImage(cv.GetSize(im),8,1)
38
+
39
+
# creates blank image to which color images are added
40
+
imgthreshold=cv.CreateImage(cv.GetSize(im),8,1)
41
+
42
+
# determine HSV color thresholds for yellow, blue, and green
43
+
# cv.InRange(src, lowerbound, upperbound, dst)
44
+
# for imgblue, lowerbound is 95, and upperbound is 115
45
+
cv.InRangeS(imghsv, cv.Scalar(55,100,100), cv.Scalar(155,255,255), imgblue) #55/155 original, 105 seems to be lower threshold needed to eliminate flag detection
0 commit comments