工业相机无法识别 OpenCV Aruco 标记

OpenCV Aruco Markers are not recognized on industrial cameras

我正在研究工业自动化技术 C2 相机上的 ARUCO 标记检测,该相机旨在检测三角测量扫描仪中的激光条纹,但它们也可以捕获图像。 我的问题是,除了我之前提到的相机之外,无论我使用什么相机,都会检测到相同的标记。 我的代码的最小工作示例如下:

#include <opencv2/highgui.hpp>
#include <opencv2/aruco/charuco.hpp>

using namespace std;
using namespace cv;

int main(int argc, char *argv[]) {

int squaresX = 10;
int squaresY = 7;
float squareLength = 28;
float markerLength = 19;
int dictionaryId = 6;
bool showRejected = true;
bool refindStrategy = true;

Ptr<aruco::DetectorParameters> detectorParams = aruco::DetectorParameters::create();

Ptr<aruco::Dictionary> dictionary =
    aruco::getPredefinedDictionary(aruco::PREDEFINED_DICTIONARY_NAME(dictionaryId));

// create charuco board object
Ptr<aruco::CharucoBoard> charucoboard =
    aruco::CharucoBoard::create(squaresX, squaresY, squareLength, markerLength, dictionary);
Ptr<aruco::Board> board = charucoboard.staticCast<aruco::Board>();

Mat image = imread("C:\Users\Piotrek\Desktop\calib\022.jpg"), imageCopy;

vector< int > markerIds, charucoIds;
vector< vector< Point2f > > markerCorners, rejectedMarkers;
vector< Point2f > charucoCorners;

// detect markers
aruco::detectMarkers(image, dictionary, markerCorners, markerIds, detectorParams,
    rejectedMarkers);

image.copyTo(imageCopy);
if (markerIds.size() > 0) {
    aruco::drawDetectedMarkers(imageCopy, markerCorners);
}

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

//display results
imshow("out", imageCopy);
waitKey(0);

return 0;
}

Sample image from camera:

问题是检测到标记但由于未知原因被拒绝:

Rejected markers

我使用 OpenCV 3.1。

问题已解决。我必须翻转图像,现在可以完美地检测到标记。

是的,在x方向翻转图像即可解决。

opencv cv::flip(image, flippedImage, 1)