diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/ArUcoMarkers/ArUcoMarkersDictionary.py | 11 |
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) |