From 7e7d17ce3a5540836b9f14b20a83125e483a6c3a Mon Sep 17 00:00:00 2001
From: Christopher Kelter <Christopher.Kelter@student.uibk.ac.at>
Date: Sun, 5 Mar 2023 20:28:37 +0100
Subject: [PATCH] this might work with newer version of opencv

---
 minibot_vision/scripts/ShapeDetector.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/minibot_vision/scripts/ShapeDetector.py b/minibot_vision/scripts/ShapeDetector.py
index 5653289..c2c3df9 100644
--- a/minibot_vision/scripts/ShapeDetector.py
+++ b/minibot_vision/scripts/ShapeDetector.py
@@ -93,7 +93,7 @@ def do_shape_detection(img_rgb, img_depth):
     if VISUALIZE:
         cv2.imshow('thresh img', thresh1)
 
-    contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
+    contours, hierarchy = cv2.findContours(thresh1, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[-2:]
     keypoints = []
     for cnt in contours:
         approx = cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True)
@@ -142,4 +142,4 @@ if __name__=="__main__":
         #cv2.imshow("Shape", img_processed)
 
 
-        rate.sleep()
\ No newline at end of file
+        rate.sleep()
-- 
GitLab