Skip to content

Commit

Permalink
Update 1.2_Detect_color.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ildaron authored Feb 19, 2021
1 parent 5e5ce38 commit 81bfacf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion 5.My_project/1.2_Detect_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def dac (channel, voltage):
(grabbed, frame) = camera.read()
cv2.imshow("Frame", frame)
key = cv2.waitKey(1) & 0xFF

frame = cv2.erode(frame, None, iterations=4)
frame = cv2.dilate(frame, None, iterations=4)
#frame = cv2.cvtColor(cv2.UMat(frame), cv2.COLOR_RGB2GRAY)
Expand All @@ -40,10 +41,16 @@ def dac (channel, voltage):

# dac (second, axi_z)
# dac (first, 2600)

(grabbed, frame) = camera.read()
cv2.imshow("Frame", frame)

frame = cv2.inRange(frame, colorLower, colorUpper)
cnts = cv2.findContours(frame.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[-2]
radius = 0




for c in cnts:
((x, y), radius) = cv2.minEnclosingCircle(cnts[0])

Expand Down

0 comments on commit 81bfacf

Please sign in to comment.