1

我在 opencv3.0 中实现了 ArUco 模块,它在检测 aruco 标记时工作得很好。

对于 aruco 标记检测,我正在使用此图像

在此处输入图像描述

但是是否可以使用 aruco 模块检测像下图这样的正常标记?

在此处输入图像描述

这是我的一些代码片段:

aruco::DetectorParameters detectorParams;
if (parser.has("dp")) {
bool readOk = readDetectorParameters(parser.get<string>("dp"), detectorParams);
    if (!readOk) {
        cerr << "Invalid detector parameters file" << endl;
        return 0;
    }
}

aruco::Dictionary dictionary =
    aruco::getPredefinedDictionary(aruco::PREDEFINED_DICTIONARY_NAME(dictionaryId));

Mat camMatrix, distCoeffs;
if (estimatePose) {
    bool readOk = readCameraParameters(parser.get<string>("c"), camMatrix, distCoeffs);
    if (!readOk) {
        cerr << "Invalid camera file" << endl;
        return 0;
    }
}

// detect markers and estimate pose
    aruco::detectMarkers(image, dictionary, corners, ids, detectorParams, rejected);
    if (estimatePose && ids.size() > 0)
        aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs,
            tvecs);

// draw results
    image.copyTo(imageCopy);
    if (ids.size() > 0) {
        aruco::drawDetectedMarkers(imageCopy, corners, ids);

        if (estimatePose) {
            for (unsigned int i = 0; i < ids.size(); i++)
                aruco::drawAxis(imageCopy, camMatrix, distCoeffs, rvecs[i], tvecs[i],
                    markerLength * 0.5f);
        }
    }

    if (showRejected && rejected.size() > 0)
        aruco::drawDetectedMarkers(imageCopy, rejected, noArray(), Scalar(100, 0, 255));

    imshow("out", imageCopy);
    char key = (char)waitKey(waitTime);
    if (key == 27) break;
}

我怎样才能使这个代码来检测正常的标记?

4

1 回答 1

1

常见问题解答中

Should I use a predefined dictionary or generate my own dictionary?

通常,使用预定义字典之一更容易。但是,如果您需要更大的字典(就标记数或位数而言),您应该生成自己的字典。如果您想最大化标记间距离以在识别步骤中实现更好的纠错,字典生成也很有用。

我认为这正是你的情况,你想使用标准 ArUco 词典中没有的东西。字典只是一个,您需要创建一个并用正确的数据填充它。

于 2016-01-16T21:11:20.613 回答