From 900fdd997b41488420426e0454285e6871171999 Mon Sep 17 00:00:00 2001 From: Andrew Barrett-Sprot Date: Mon, 4 Jun 2018 19:43:05 +0100 Subject: [PATCH 1/5] Rearrange corner locations to match Apriltags The Previous API had marker corners ordered Clockwise from the bottom left. Apriltags orders them clockwise from the top left. This change converts the API to match Apriltags' output to reduce code complexity. --- sb_vision/tokens.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sb_vision/tokens.py b/sb_vision/tokens.py index f8b003c..e204115 100644 --- a/sb_vision/tokens.py +++ b/sb_vision/tokens.py @@ -89,11 +89,7 @@ def update_pixel_coords( self.homography_matrix = homography_matrix - # The pixel_corners value we expose is in clockwise order starting with - # the bottom left corner of the marker (if it weren't rotated). - # AprilTags returns an array with the first being the top left. thus we need to - # shift the ordering of the values by one to match our output. - self.pixel_corners = [pixel_corners[3]] + pixel_corners[:3] + self.pixel_corners = pixel_corners # centre of marker: average the corners self.pixel_centre = PixelCoordinate(*np.average(pixel_corners, axis=0)) From d3c66b02b5fed9b70e011b1e3dc2c81f3954d287 Mon Sep 17 00:00:00 2001 From: Andrew Barrett-Sprot Date: Mon, 4 Jun 2018 20:05:05 +0100 Subject: [PATCH 2/5] add comment to pixel_corners --- sb_vision/tokens.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sb_vision/tokens.py b/sb_vision/tokens.py index e204115..6b464f2 100644 --- a/sb_vision/tokens.py +++ b/sb_vision/tokens.py @@ -89,6 +89,7 @@ def update_pixel_coords( self.homography_matrix = homography_matrix + # pixel corners: clockwise from the top left self.pixel_corners = pixel_corners # centre of marker: average the corners From 8e7e3a6df61ab81f70321f80679235a31c74b957 Mon Sep 17 00:00:00 2001 From: Andrew Barrett-Sprot Date: Tue, 12 Jun 2018 20:27:04 +0100 Subject: [PATCH 3/5] mention the top left is relative to the marker --- sb_vision/tokens.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sb_vision/tokens.py b/sb_vision/tokens.py index 6b464f2..65b3e1f 100644 --- a/sb_vision/tokens.py +++ b/sb_vision/tokens.py @@ -89,7 +89,7 @@ def update_pixel_coords( self.homography_matrix = homography_matrix - # pixel corners: clockwise from the top left + # pixel corners: clockwise from the top left corner (relative to the marker) of the marker self.pixel_corners = pixel_corners # centre of marker: average the corners From 888c848563720daa564f7e2dfe6bfb83e72764f4 Mon Sep 17 00:00:00 2001 From: Andrew Barrett-Sprot Date: Tue, 12 Jun 2018 22:03:13 +0100 Subject: [PATCH 4/5] Fix pixel corner co-ordinates ordering Turns out the pixel corner co-ordinates ordering was incorrect this fixes that. --- sb_vision/tokens.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sb_vision/tokens.py b/sb_vision/tokens.py index 65b3e1f..fedba26 100644 --- a/sb_vision/tokens.py +++ b/sb_vision/tokens.py @@ -89,7 +89,7 @@ def update_pixel_coords( self.homography_matrix = homography_matrix - # pixel corners: clockwise from the top left corner (relative to the marker) of the marker + # pixel corners: counter-clockwise from the bottom-left corner (relative to the marker) of the marker. self.pixel_corners = pixel_corners # centre of marker: average the corners From 83f4061e8d11aa637cb1e70080e61ba65b4583ea Mon Sep 17 00:00:00 2001 From: Andrew Barrett-Sprot Date: Tue, 12 Jun 2018 22:03:42 +0100 Subject: [PATCH 5/5] Add example for the first pixel corner value --- sb_vision/tokens.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sb_vision/tokens.py b/sb_vision/tokens.py index fedba26..9ecd635 100644 --- a/sb_vision/tokens.py +++ b/sb_vision/tokens.py @@ -90,6 +90,7 @@ def update_pixel_coords( self.homography_matrix = homography_matrix # pixel corners: counter-clockwise from the bottom-left corner (relative to the marker) of the marker. + # For example, if the marker is upside down, the first corner coordinate will be the in the top right. self.pixel_corners = pixel_corners # centre of marker: average the corners