Skip to content

objdetect aruco module CORNER_REFINE_CONTOUR has no effect (regression in opencv 4.7) #23437

@smeng9

Description

@smeng9

System Information

OpenCV python version: 4.7.0.68 and 4.7.0.72
Operating System / Platform: Ubuntu 22.04
Python version: 3.10.6

Detailed description

The parameter CORNER_REFINE_CONTOUR is supposed to refine the corners, but the returned corner are still an integer value

Steps to reproduce

I have created a following code snippet to process the image
aruco-test-image

import os
import csv
import time
import datetime
import threading

import cv2
import cv2.aruco as aruco
import numpy as np

# opencv 4.7
aruco_dict = aruco.getPredefinedDictionary(dict=aruco.DICT_6X6_250)
parameters = aruco.DetectorParameters()
# opencv 4.6
#aruco_dict = aruco.Dictionary_get(dict=aruco.DICT_6X6_250)
#parameters = aruco.DetectorParameters_create()
parameters.cornerRefinementMethod = aruco.CORNER_REFINE_CONTOUR # CONTOUR works better than SUBPIX in terms of the std of the positions
parameters.cornerRefinementMaxIterations = 1000
parameters.cornerRefinementMinAccuracy = 0.001

image = cv2.imread("aruco-test-image.jpg")

markerCorners, markerIDs, rejectedImgPoints = aruco.detectMarkers(image, aruco_dict, parameters=parameters)
print(markerCorners)

In opencv 4.7 it will return without any refinement performed.

(array([[[ 361.,  417.],
        [1162.,  741.],
        [ 788., 1518.],
        [ 106., 1164.]]], dtype=float32),)

This is considered a regression from opencv 4.6. Running the above code in opencv 4.6 will produce a different result.

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions