✨
This commit is contained in:
@ -1,20 +1,29 @@
|
|||||||
import cv2
|
import cv2
|
||||||
import robot
|
import robot
|
||||||
|
|
||||||
def main():
|
def find_aruco(arlo):
|
||||||
arlo = robot.Robot()
|
|
||||||
image = arlo.take_photo()
|
image = arlo.take_photo()
|
||||||
|
|
||||||
aruco_dict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_6X6_250)
|
aruco_dict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_6X6_250)
|
||||||
aruco_params = cv2.aruco.DetectorParameters_create()
|
aruco_params = cv2.aruco.DetectorParameters_create()
|
||||||
detected = cv2.aruco.detectMarkers(
|
corners, ids = cv2.aruco.detectMarkers(
|
||||||
image,
|
image,
|
||||||
aruco_dict,
|
aruco_dict,
|
||||||
parameters=aruco_params
|
parameters=aruco_params
|
||||||
)
|
)
|
||||||
print("Corners: ", detected[0])
|
print("Corners: ", detected[0])
|
||||||
print("Ids: ", detected[1])
|
print("Ids: ", detected[1])
|
||||||
print("Rejected: ", detected[0])
|
print("Rejected: ", detected[2])
|
||||||
|
|
||||||
|
for bounding, n in zip(corners, ids):
|
||||||
|
cv2.line(image, bounding[0], bounding[1], (0,255,0))
|
||||||
|
|
||||||
|
return image
|
||||||
|
|
||||||
|
def main():
|
||||||
|
arlo = robot.Robot()
|
||||||
|
image = find_aruco(arlo)
|
||||||
|
cv2.imwrite("test.png", image)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Reference in New Issue
Block a user