Beispiel #1
0
    def centroid_within_bounds(self, centroid, objects, thresh=0.2):
        # check if new centroid is within bounds of previously noted ones
        for object in objects:
            if  Util.within_threshold(centroid.x, object.centroid.x) and Util.within_threshold(centroid.y, object.centroid.y):
                    return True

        return False
Beispiel #2
0
    def dimensions_within_bounds(self, object, filtered_object, threshold=0.2):
        # check if object dimensions in new frame is within bounds of previously recorded dimensions in a diff frame
        print('checking for dimensions : ')
        if Util.within_threshold(
                object.width, filtered_object.width,
                threshold=threshold) and Util.within_threshold(
                    object.height, filtered_object.height,
                    threshold=threshold) and Util.within_threshold(
                        object.depth,
                        filtered_object.depth,
                        threshold=threshold):
            print(object)
            print(filtered_object)
            return True

        return False