我有两张照片真的很相似
此人被正确识别为5x5_250词典的标记209

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

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

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

并且在另一张照片中也识别出了标记207:

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

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

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

但似乎没有什么变化,所以我回到默认值,
所以我的问题是:
  • 标记周围是否需要白色边框?
  • 为什么第二张照片无法识别标记207?
    谢谢
  • 最佳答案

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

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

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

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

    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/

    10-16 12:21