def main():
    a = 6
    s = 1  # change for person number
    e = 1
    # data = np.array(Dataset(a, s, e, crop=False).uncropped)[61:62]
    # sk_data = SkeletonDataset(a, s, e)
    # current_main.main(data)
    for s in range(8, 10):
        print("\n\n\n---------", s, "---------")
        data = np.array(Dataset(a, s, e, crop=False).uncropped)
        sk_data = SkeletonDataset(a, s, e)
        print("\nStarting current")
        centroids, boxes = current_main.main(data)
        print("current", bounding_accuracy(boxes, sk_data.boxes))
        print("current point", point_accuracy(centroids, sk_data.skeletons))
        print("\nStarting SWL.1")
        centroids, boxes = swl1_main.main(data)
        print("SWL.1", bounding_accuracy(boxes, sk_data.boxes))
        print("SWL.1 point", point_accuracy(centroids, sk_data.skeletons))
        print("\nStarting SWL.2")
        centroids, boxes = swl2_main.main(data)
        print("SWL.2", bounding_accuracy(boxes, sk_data.boxes))
        print("SWL.2 point", point_accuracy(centroids, sk_data.skeletons))
        print("\nStarting SAE.1")
        centroids, boxes = sae1_main.main(data)
        print("SAE.1", bounding_accuracy(boxes, sk_data.boxes))
        print("SAE.1 point", point_accuracy(centroids, sk_data.skeletons))
        print("\nStarting SAE.2")
        centroids, boxes = sae2_main.main(data)
        print("SAE.2", bounding_accuracy(boxes, sk_data.boxes))
        print("SAE.2 point", point_accuracy(centroids, sk_data.skeletons))
        print("\nStarting SAE.3")
        centroids, boxes = sae3_main.main(data)
        print("SAE.3", bounding_accuracy(boxes, sk_data.boxes))
        print("SAE.3 point", point_accuracy(centroids, sk_data.skeletons))
    @staticmethod
    def depth_to_gray(image):
        """
        Converts crazy depth image format to grayscale.
        :param image: a depth image numpy array
        :return: a grayscale numpy array
        """
        high, low = np.amax(image), np.amin(image)
        val_range = high - low
        for y in range(len(image)):
            for x in range(len(image[y])):
                image[y][x] = float(255.0 * (float(image[y][x]) / val_range))
        return image

    def calc_centroid(self, contour):
        """
        Calculates centroid of given contour
        :param contour: OpenCV contour object
        :return: [centroid_x, centroid_y]
        """
        M = cv2.moments(contour)
        cx = int(M['m10'] / (M['m00'] + 1e-5))
        cy = int(M['m01'] / (M['m00'] + 1e-5))
        return [cx, cy]


if __name__ == "__main__":
    from versions.current import main

    main.main()
def main():
    from versions.current import main
    main.main()