Ich habe die hier http://download.p4c.philips.com/file...00_pss_deu.pdf
Der Code dort oben kommt auf 10 fps. Problem ist, das Durchlaufen durch die "contour" (Liste).
Code:while contour: bound_rect = cv.BoundingRect(list(contour)) contour = contour.h_next() pt1 = (bound_rect[0], bound_rect[1]) pt2 = (bound_rect[0] + bound_rect[2], bound_rect[1] + bound_rect[3]) points.append(pt1) points.append(pt2) centroidx=cv.Round((pt1[0]+pt2[0])/2) centroidy=cv.Round((pt1[1]+pt2[1])/2) centroid = (centroidx, centroidy) if len(points): radius = abs(pt1[0]-pt2[0])/2 if True: #radius > 2 and radius != 159: self.centroid = centroid self.radius = radius if self.gui is True: cv.Circle(color_image, centroid , radius , cv.CV_RGB(255,0,0), 1) cv.Rectangle(color_image, pt1, pt2, cv.CV_RGB(255,0,0), 1) cv.PutText(color_image, str(centroid)+" r="+str(radius), centroid, cv.InitFont(cv.CV_FONT_HERSHEY_SIMPLEX, 1, 1, 0, 2, 1), cv.CV_RGB(255,0,0)) # print str(centroid)+" r="+str(radius) else: self.centroid = None self.radius = None







Zitieren
Lesezeichen