1

I am trying to make a cylinder in Virtual Reality using Aruco Markers. I have made cube easily as there were just 8 points to be ploted and converted to proper frame. But in the case of a cylinder, its base is a circle which has no corners. Am I using the wrong method to do the same? I feel so because I won't be able to extract so many points of the circle of the base of the cylinder.

def drawCylinder(img, ar_list, ar_id, camera_matrix, dist_coeff):
    for x in ar_list:
        if ar_id == x[0]:
            centre = x[1]
            rvec, tvec = x[2], x[3]
    markerLength = 100
    radius = int(markerLength/2)
    height = markerLength*1.5 # Constraint on height of the Cylinder
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    aruco_dict = aruco.Dictionary_get(aruco.DICT_5X5_250)
    parameters = aruco.DetectorParameters_create()
    corners, ids, _ = aruco.detectMarkers(gray, aruco_dict, parameters=parameters)
    pts = np.float32()
    pt_dict = {}
    imgpts, _ = cv2.projectPoints(pts, rvec, tvec, camera_matrix, dist_coeff)
    imgpts = np.int32(imgpts).reshape(-1, 2)

    # Confusion1: Make a set of points for a circle
    points = [[x1,y1,z1],[x2,y2,z2]]
    for i in range(len(pts)):
        pt_dict[tuple(pts[i])] = tuple(imgpts[i].ravel())
        points.append(pt_dict[tuple(pts[i])])

    # Some code to convert points and plot them to Image which I know
    return img
Piyush Chauhan
  • 797
  • 1
  • 7
  • 20

0 Answers0