-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Transform offset to indeces for MatND in minMaxIdx HAL #25563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asmorkalov I've done some more testing and I believe it should be
minIdx[1]andmaxIdx[1]. I thought that minIdx[0] would correspond to the X direction, but it seems that in OpenCV it corresponds to the row. According do the docs:If I change these indices from 0 to 1 then my tests pass.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mplatings It's not clear from the docs if
minIdxandmaxIdxshould contain pointers to an offset to convert it to array indices or to indices themselves.In the first case (which is how OpenCV tab functions from
getMinmaxTab()actually work) there should be 0th index and no such thing asminIdx[i]ormaxIdx[i]is ever possible for everyi > 0.In the second case you're right since HAL call gets 1-dimensional array and puts Y index to
minIdx[0]and X tominIdx[1](the same formaxIdx). Since it's just one dimensional, Y index should always be zero which looks impractical to me but looks like this is how it is implemented now.I think we should choose between these two options first.
By the way, can you tell me what tests are failing? Looks like OpenCV tests do not cover that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KleidiCV's tests fail with the head of the OpenCV 4.x branch. Specifically this: https://gitlab.arm.com/kleidi/kleidicv/-/blob/main/conformity/opencv/test_min_max.cpp?ref_type=heads#L59
In KleidiCV 0.1.0 we did not enable minmax in the HAL so from our point of view it's fine for us to change how the HAL should work. If the HAL code should return an offset instead of 2-dimensional indices then that makes KleidiCV's code simpler.
So I'm happy to either change these indices from 0 to 1, or to require that the HAL returns an offset and we will change KleidiCV to match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let's do like this so that HAL should return offset.
I'll prepare PR to OpenCV which documents such behaviour.