Commit 112f37b8 authored by Ivan Tyagov's avatar Ivan Tyagov

Cleanup.

Show number of points.
parent 6a71e5e5
......@@ -42,7 +42,7 @@ async def main():
cv2.namedWindow("Trackbars")
cv2.createTrackbar("L-H", "Trackbars", 0, 180, nothing)
cv2.createTrackbar("L-S", "Trackbars", 0, 255, nothing)
cv2.createTrackbar("L-V", "Trackbars", 3, 255, nothing)
cv2.createTrackbar("L-V", "Trackbars", 0, 255, nothing)
cv2.createTrackbar("U-H", "Trackbars", 135, 180, nothing)
cv2.createTrackbar("U-S", "Trackbars", 190, 255, nothing)
cv2.createTrackbar("U-V", "Trackbars", 190, 255, nothing)
......@@ -79,18 +79,16 @@ async def main():
if area > 400:
cv2.drawContours(frame, [approx], 0, (0, 0, 0), 5)
if len(approx) == 3:
number_of_points = len(approx)
if number_of_points == 3:
cv2.putText(frame, "Triangle", (x, y), font, 1, (0, 0, 0))
await myvar.write_value(1.0)
#_logger.info("Triangle")
elif len(approx) == 4:
elif number_of_points == 4:
cv2.putText(frame, "Rectangle", (x, y), font, 1, (0, 0, 0))
await myvar.write_value(2.0)
#_logger.info("Rectangle")
elif 7 < len(approx) < 20:
cv2.putText(frame, "Circle", (x, y), font, 1, (0, 0, 0))
elif 7 < number_of_points < 20:
cv2.putText(frame, "Circle (%s)" %number_of_points, (x, y), font, 1, (0, 0, 0))
await myvar.write_value(3.0)
#_logger.info("Circle")
else:
await myvar.write_value(0.0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment