diff --git a/minibot_vision/scripts/ShapeDetector.py b/minibot_vision/scripts/ShapeDetector.py
index 565328962c1b2f810ec269de8b28d01dc52fac6b..c2c3df93bac3fa6cc41dccb586c95cfc9169188a 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()