Skip to content

Incorrect checker box alignment in DNN based method of MCC checker detector #27219

@abhishek-gola

Description

@abhishek-gola

System Information

OpenCV version: 5.0.0-pre
Operating System / Platform: Ubuntu 24.04
Compiler & compiler version: GCC 13.30

Detailed description

There is an issue in the DNN method of MCC detector under objdetect module concerning the handling of image regions in the checkerAnalysis and get_profile functions:

Mismatch in Image Regions:
In case of DNN based method, in the checkerAnalysis function inside checker_detector.cpp, the cropped image’s checker boxes are used. However, the get_profile function is operating on the full image while still using the coordinates of the cropped image’s checker boxes. This mismatch leads to the extraction of incorrect actual colors and misaligned checkers with respect to the original image.

Previous Fix for Visualization:
Although the misalignment of checker bounding boxes was addressed for visualization purpose, the underlying issue with the color profiling and checker alignment has not been resolved.

Pull Request addressing the visualization issue: opencv/opencv_contrib#3875

Proposed Solution:
Adding the offset as an input parameter within the checkerAnalysis function to correctly map checker boxes to the full image, and removing the external offset previously used for visualization, should resolve the issue.

Steps to reproduce

Run macbeth_chart_detection.cpp on the same image using:

  1. DNN-based method
  2. Non-DNN method

Compare the actual_colors output from both runs — they will differ.

Perform Color Correction:

  1. Use the extracted actual_colors from both runs for color correction.
  2. The result from the non-DNN method will produce a visually correct, color-balanced image.
  3. The result from the DNN method will be incorrect, indicating that the actual_colors are wrong.

Root Cause in Code:

  1. In checkerAnalysis, both the full image and cropped image are passed.
  2. In the DNN method, checker boxes are based on the cropped image.
  3. But get_profile (called inside checkerAnalysis) uses the full image along with cropped image's checker boxes, causing a mismatch in coordinates.

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

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions