Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Aruco Detection - OpenCV Error: Incorrect size of input array

Hi There,

I try to detect my ArUco markers with this posted code (only part of it) and get on the last line the OpenCV Error: Incorrect size of input array ... in cvRodrigues2, file C:...

It worked if I only have one marker in the picture. I think more marker are the problem? But how to solve it (as a beginner I am not sure, what to look for. I have searched the whole day but did not find anything :-( )

    while (true)
{



    if (playVideo == true)
    {
        if (!vid.read(frame))
            break;

        aruco::detectMarkers(frame, markerDictionary, markerCorners, markerIds);
        aruco::estimatePoseSingleMarkers(markerCorners, arucoSquareDimension, cameraMatrix, distortionCoefficients, rotationVectors, translationVectors);



        for (int i = 0; i < markerIds.size(); i++)
        {
            aruco::drawDetectedMarkers(frame, markerCorners, markerIds);    //Zeichnet die Umrandung und die ID auf die Marker
            aruco::drawAxis(frame, cameraMatrix, distortionCoefficients, rotationVectors[i], translationVectors[i], arucoSquareDimension*0.5f); //Zeichnet die Koordinatensysteme, die Zahl gibt die Größe der Vektoren in Meter an




            //Hier wird die Marker ID in der Konsole ausgegeben
            std::cout << "Die ID des Markers lautet:";
            for (std::vector<int>::iterator it = markerIds.begin(); it != markerIds.end(); ++it)
                std::cout << ' ' << *it;
            std::cout << '\n';

            //Hier wird die Rotation in der Konsole ausgegeben  *180)/(3.14159265359)
            std::cout << "Die Rotation des Markers ist:";
            for (std::vector<Vec3d>::iterator it = rotationVectors.begin(); it != rotationVectors.end(); ++it)
                std::cout << ' ' << (*it * 180) / (3.14159265359) << " grad";
            std::cout << '\n';


            //Rotationsmatrix
            Mat R;


            cv::Rodrigues(rotationVectors, R);

Thank you! Sarah