gpt4 book ai didi

opencv - 在标记识别中调整 aruco 检测参数

转载 作者:行者123 更新时间:2023-12-02 17:04:02 26 4
gpt4 key购买 nike

我有两张照片真的很像这个被正确识别为 5x5_250 字典的标记 209

marker 209 recognized by Aruco

虽然这另一个非常相似但无法识别,它是同一个 5x5_250 字典的标记 207:

marker 207 NOT recognized by Aruco

而且标记 207 在另一张照片中被识别出来了:

marker 207 recognized

我试过更改检测器参数中的某些内容

params->adaptiveThreshWinSizeMin = 4;
params->adaptiveThreshWinSizeMax = 26;
params->adaptiveThreshWinSizeStep = 2;
params->minMarkerPerimeterRate = 0.01;
params->maxMarkerPerimeterRate = 4;
params->polygonalApproxAccuracyRate = 0.1;
params->perspectiveRemovePixelPerCell = 10;

但似乎没有任何变化所以我回到默认值,所以我的问题是:

  1. 标记周围必须有白色边框吗?
  2. 为什么在第二张照片中没有识别出标记 207?谢谢

最佳答案

ArUco 标记周围的白色边框是必需的,因为 ArUco 标记检测的第一步是检测角点。有关引用,请参阅 page 4 of the documentation of the ArUco library .

不幸的是,切断标记周围所谓的“安静区域”是一个常见问题。将来,打印带有额外角的标记可能会有所帮助,如下所示:

ArUco marker with corners

要生成角点,请运行此代码段并将图像拖放到指定位置。然后右键单击并“将图像另存为...”。

var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
var theImage = null;

function redraw(){
if (!theImage){
context.font = "30px Arial";
context.fillStyle = "black";
context.fillText("Drag & Drop image here.", 10, 40);
return;
}

var width = theImage.width;
var height = theImage.height;

var nTiles = 8;
var padding = 3;
var cornerLength = 4;
var dx = width / nTiles;
var dy = height / nTiles;

canvas.width = 2 * padding * dx + width;
canvas.height = 2 * padding * dy + height;

// clear background
context.fillStyle = "#ffffff";
context.fillRect(0, 0, canvas.width, canvas.height);

// draw corners
context.fillStyle = "#000000";
context.fillRect(0, 0, dx, dy * cornerLength);
context.fillRect(0, 0, cornerLength * dx, dy);
context.fillRect(canvas.width - dx, canvas.height - dy * cornerLength, dx, dy * cornerLength);
context.fillRect(canvas.width - cornerLength * dx, canvas.height - dy, cornerLength * dx, dy);
context.fillRect(canvas.width - dx, 0, dx, dy * cornerLength);
context.fillRect(canvas.width - cornerLength * dx, 0, dx * cornerLength, dy);
context.fillRect(0, canvas.height - dy * cornerLength, dx, dy * cornerLength);
context.fillRect(0, canvas.height - dy, cornerLength * dx, dy);

// draw image
context.drawImage(theImage, padding * dx, padding * dy);
}

redraw();

function handleFile(file){
var reader = new FileReader();
reader.onload = function(){
var image = new Image();
image.src = this.result;
image.onload = function(){
theImage = image;
redraw();
}
}
reader.readAsDataURL(file);
}

canvas.addEventListener("dragover", function(e){
e.preventDefault()
e.stopPropagation()
})

canvas.addEventListener("drop", function(e){
var files = e.dataTransfer.files;
for (var i = 0; i < files.length; i++){
handleFile(files[i]);
}
e.preventDefault()
e.stopPropagation()
})
<canvas id="myCanvas" width="512" height="512"></canvas>

关于opencv - 在标记识别中调整 aruco 检测参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57845196/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com