OpenCV aruco marker detection not working

351 views Asked by At

I want to detect aruco marker in an image in OpenCV . My OpenCV version is 4.8.0. It looks like it has been replaced by some other function which I can't find any guide to. Thanks for you help!

# program to detect aruco markers with opencv2 4.8.0 version
import cv2 
import numpy as np
# dictionary of aruco markers
aruco_dict = cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_6X6_250)

# create a video capture object from ip webcam
import cv2

videoURL = "http://192.168.1.200:8080/video"
cap = cv2.VideoCapture(videoURL)

while(True):
    ret, frame = cap.read()
    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    # detect markers in the input image
# Create the detector with the dictionary and parameters
    detector = cv2.aruco.ArucoDetector(aruco_dict)

    # Now use the detectMarkers method on the detector instance
    corners, ids, rejectedImgPoints = detector.detectMarkers(gray)
    print(corners)
    # show the output image with the markers

    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

I was using above code but it is not detecting any corner

I tried old function but it seems like it has been removed

0

There are 0 answers