Skip to content

Fix binding for cv::getRectSubPix#1368

Merged
deadprogram merged 1 commit into
hybridgroup:devfrom
michaelarusso:get-rect-subpixel-fix
May 28, 2026
Merged

Fix binding for cv::getRectSubPix#1368
deadprogram merged 1 commit into
hybridgroup:devfrom
michaelarusso:get-rect-subpixel-fix

Conversation

@michaelarusso

Copy link
Copy Markdown
Collaborator

Updated the GetRectSubPix binding to use a float center (Point2f) end-to-end instead of integer coordinates, matching OpenCV’s API and intended behavior. The previous integer center lost precision at the boundary between Go and C++.

Why int casting defeats the purpose:
GetRectSubPix is specifically for sub-pixel sampling. Casting center coordinates to int truncates fractional values, so a center like (200.5, 172.5) becomes (200, 172). That removes sub-pixel precision and effectively turns the call into whole-pixel extraction, which defeats why this function exists.

Note:
This is a breaking API change: GetRectSubPix now accepts Point2f for center instead of image.Point. Existing clients must update call sites to pass Point2f values.

@deadprogram

Copy link
Copy Markdown
Member

Oops sorry @michaelarusso I missed the notification on this.

Yes, it is breaking, but the original code was incorrect I see now. As such, merging now. Thanks you for the fix!

@deadprogram
deadprogram merged commit 66d42ed into hybridgroup:dev May 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants