def locate(self, all = False, show = False, outimg = None):
for (transition, mask) in self.transitions:
if transition == 1:
sfv3 = SquareFinderV3(mask, cos_limit = 0.5)
squares = sfv3.find(self.mode)
if show:
SquaresOverlayV4(mask, squares, all = all)
SquaresOverlayV4(mask, squares, all = False)
else:
square_contours = [square.contour for square in squares]
best_contours_tuples = classify_multi_monitors_contour_set(square_contours)
found = mask.copy()
self.best_contours = [contour.astype('int32') for (contour, index) in best_contours_tuples]
cv2.drawContours( found, self.best_contours, -1, (0,0,255),3)
if outimg:
cv2.imwrite(outimg, found)
return self.best_contours
评论列表
文章目录