Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 4615

Keeping count of duration a specific contour is identified

$
0
0
Dear all, I am currently working on a shape identification snippet and need to keep track of the duration of which the particular shape is identified on my screen - i.e. a pseudo confidence level of an object to filter out possible sources of noises that 'pops' in and out every now and then. I found out that a simple if-else would not work as the count gets reset every loop. white_canny, contours, hierarchy = cv2.findContours(white_mask,cv2.RETR_CCOMP,cv2.CHAIN_APPROX_SIMPLE) for i in range(0,len(contours)): approx = cv2.approxPolyDP(contours[i],cv2.arcLength(contours[i],True)*0.02,True) if(len(approx) == 12): self.certainty += 1 else: self.certainty = 0 May I know if there is a better way for me to keep count of the duration, but that it resets every time it loses track of the object? Thank you.

Viewing all articles
Browse latest Browse all 4615

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>