Skip to content

Conversation

@dheeraj25406
Copy link
Contributor

Issue

Fixes #26085

The function Image2BlobParams::blobRectsToImageRects returned incorrect bounding boxes when using padding modes such as DNN_PMODE_LETTERBOX and DNN_PMODE_CROP_CENTER.

Root Cause

The offset introduced during preprocessing was not removed correctly when mapping blob‐space rectangles back to original image coordinates.

Fix

Adjust rectangle coordinates based on resize factor and padding offsets, so that coordinates are mapped consistently to the original image space.

Testing

  • Built OpenCV locally
  • Ran dnn tests including opencv_test_dnn --gtest_filter=*blobRects*
  • All tests passed

@asmorkalov asmorkalov added category: dnn pr: needs test New functionality requires minimal tests set labels Jan 1, 2026
@asmorkalov
Copy link
Contributor

@dheeraj25406 Please add simple test that highlights the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: dnn pr: needs test New functionality requires minimal tests set

Projects

None yet

Development

Successfully merging this pull request may close these issues.

blobRectsToImageRects,This function has an error

2 participants