Detecting simple geometric shapes using OpenCV [Java]
问题 I'm programming a Java application that detects simple geometric shapes. The following Python code is used as a reference: How to detect simple geometric shapes using OpenCV This is some of the code [Python]: contours,h = cv2.findContours(thresholdedImage,1,2) for cnt in contours: approx = cv2.approxPolyDP(cnt,0.01*cv2.arcLength(cnt,True),True) print len(approx) if len(approx)==5: print "pentagon" cv2.drawContours(img,[cnt],0,255,-1) elif len(approx)==3: print "triangle" cv2.drawContours(img,