aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2022-05-09 15:36:55 +0200
committerThéo de la Hogue2022-05-09 15:36:55 +0200
commitac014fa73e9fc9ecb85e90268524fe4314ad6cd3 (patch)
treeb54db1d11a14eec05d5a230f12532445d35b972b
parent931e282654cee682c2f54694a52364e4e3599be9 (diff)
downloadargaze-ac014fa73e9fc9ecb85e90268524fe4314ad6cd3.zip
argaze-ac014fa73e9fc9ecb85e90268524fe4314ad6cd3.tar.gz
argaze-ac014fa73e9fc9ecb85e90268524fe4314ad6cd3.tar.bz2
argaze-ac014fa73e9fc9ecb85e90268524fe4314ad6cd3.tar.xz
Adding create_marker method.
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py b/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py
index f8060f3..93c59b8 100644
--- a/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py
+++ b/src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py
@@ -79,6 +79,14 @@ class ArUcoMarkersDictionary():
self.__aruco_dict = aruco.Dictionary_get(all_aruco_markers_dictionaries[aruco_dictionary_name])
+ def create_marker(self, i, dpi=300):
+ """Create a marker image."""
+
+ marker = numpy.zeros((dpi, dpi, 1), dtype="uint8")
+ aruco.drawMarker(self.__aruco_dict, i, dpi, marker, 1)
+
+ return numpy.repeat(marker, 3).reshape(dpi, dpi, 3)
+
def get_markers(self):
return self.__aruco_dict
@@ -98,8 +106,7 @@ class ArUcoMarkersDictionary():
print(destination_folder, output_filename)
# create marker
- marker = numpy.zeros((dpi, dpi, 1), dtype="uint8")
- aruco.drawMarker(self.__aruco_dict, i, dpi, marker, 1)
+ marker = self.create_marker(i, dpi)
# save marker into destination folder
cv.imwrite(f'{destination_folder}/{output_filename}', marker)