Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aruco marker Detection #593

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
50 changes: 50 additions & 0 deletions Arucomarker_detection/Model/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@



**Aruco Marker Detection**


**GOAL**

To Detect Aruco markers and their id from the dataset.


**DATASET**
Images taken from google


**DESCRIPTION**

The main aim of the project is to detect aruco markers in the images.


**WHAT I HAD DONE**

1. Loaded images from the dataset folder.

2. Preprocessing
* Resized image for better accuracy.

3. Marker Detection
* Detected Aruco markers present in the image

4. Finding IDs
* Printed the IDs of the detected markers


**Libraries Used**

* cv2
* cv2.aruco
* os
* numpy


**CONCLUSION**
Using Open CV's Aruco Maker library, we have detected, drawn the auroco markers in the images.

**NAME**
Jayesh Deotalu



104 changes: 104 additions & 0 deletions Arucomarker_detection/Model/aruco_detection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# importing libraries
import cv2 as cv
import os
import numpy as np
import cv2.aruco as aruco
# import matplotlib.pyplot as plt

# Creating list of all dictionary to make sure all the markers get detected
dic_list = [
aruco.DICT_4X4_50,
aruco.DICT_4X4_100,
aruco.DICT_4X4_250,
aruco.DICT_4X4_1000,
aruco.DICT_4X4_100,
aruco.DICT_4X4_250,
aruco.DICT_4X4_1000,
aruco.DICT_4X4_100,
aruco.DICT_4X4_250,
aruco.DICT_4X4_1000,
aruco.DICT_4X4_100,
aruco.DICT_4X4_250,
aruco.DICT_4X4_1000,
aruco.DICT_4X4_100,
aruco.DICT_4X4_250,
aruco.DICT_4X4_1000,
aruco.DICT_5X5_50,
aruco.DICT_5X5_100,
aruco.DICT_5X5_250,
aruco.DICT_5X5_1000,
aruco.DICT_6X6_50,
aruco.DICT_6X6_100,
aruco.DICT_6X6_250,
aruco.DICT_6X6_1000,
aruco.DICT_7X7_50,
aruco.DICT_7X7_100,
aruco.DICT_7X7_250,
aruco.DICT_7X7_1000,
aruco.DICT_ARUCO_ORIGINAL,
aruco.DICT_APRILTAG_16h5,
aruco.DICT_APRILTAG_25h9,
aruco.DICT_APRILTAG_36h10,
aruco.DICT_APRILTAG_36h11,
]


# Path to the folder
folder_path = "Dataset"

# Initializing aruco dictionary
aruco_dict = aruco.Dictionary_get(aruco.DICT_4X4_250)

# Initializing detector parameters
parameters = aruco.DetectorParameters_create()


# Accessing each image
for image_item in os.listdir(path= folder_path):


img_path = os.path.join(folder_path, image_item)
img = cv.imread(str(img_path))

img = cv.resize(img, (250, 250), interpolation=cv.INTER_AREA)

#Creating copy of the image
img_copy = img

cv.waitKey(0)

# Got the image now converting it to grayscale
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)

aruco_ids = set()

for dic in dic_list:
aruco_dict = aruco.Dictionary_get(dic)
corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, aruco_dict, parameters=parameters)

if ids is not None:
aruco.drawDetectedMarkers(img, corners, ids)

# Adding ids to the set
ids = np.ravel(ids)
for id in ids:
aruco_ids.add(id)

# print(f"""
# corners = {corners}
# ids = {ids}
# rejected = {rejectedImgPoints}
# """)

if not aruco_ids:
print("Not able to detect.")
else:
print(f"Detected Ids: {aruco_ids}")

# Displaying the marked image
cv.imshow("Original Image", img_copy)
cv.imshow('ArUco Marked Image', img)
# cv.waitKey(0)
# Break the loop when 'q' key is pressed
if cv.waitKey(0) & 0xFF == ord('q'):
break
2 changes: 2 additions & 0 deletions Arucomarker_detection/Model/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
opencv-python==4.5.3.56
numpy==1.21.5