Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Dostoyewski committed Apr 25, 2022
0 parents commit afeed54
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
11 changes: 11 additions & 0 deletions generate_marker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import cv2 as cv
import numpy as np

# Load the predefined dictionary
dictionary = cv.aruco.Dictionary_get(cv.aruco.DICT_6X6_250)

# Generate the marker
markerImage = np.zeros((200, 200), dtype=np.uint8)
markerImage = cv.aruco.drawMarker(dictionary, 33, 200, markerImage, 1)

cv.imwrite("./markers/marker33.png", markerImage)
25 changes: 25 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import cv2 as cv
import numpy as np
import pandas as pd

if __name__ == '__main__':
cap = cv.VideoCapture('./test.mp4')
while True:
success, image = cap.read()
if image is None:
break
key = cv.waitKey(1) & 0xFF
if (key == 27) or (key == ord('q')):
break
if success:
dictionary = cv.aruco.Dictionary_get(cv.aruco.DICT_6X6_250)
parameters = cv.aruco.DetectorParameters_create()
markerCorners, markerIds, rejectedCandidates = cv.aruco.detectMarkers(image,
dictionary,
parameters=parameters)
if markerIds is not None:
coords = list(np.mean(markerCorners[0], axis=1)[0].astype('int'))
image = cv.circle(image, coords, 20, (255, 0, 0), -1)
cv.imshow("original", image)
else:
continue
Binary file added markers/marker31.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added markers/marker32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added markers/marker33.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit afeed54

Please sign in to comment.