Skip to content
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

Fix the problem that the non-maximum suppression return position is 0 #999

Open
wants to merge 12 commits into
base: release
Choose a base branch
from

Conversation

Hexert
Copy link

@Hexert Hexert commented Jul 5, 2022

No description provided.

@Hexert
Copy link
Author

Hexert commented Jul 5, 2022

image

For the same target, when the length of boxes and indices is 2, after the NMSBoxes method, the length of the returned indices is also 2, and the values in the indices are all 0. At this time, one of the boxes cannot be removed, and the appropriate target detection is retained. frame, so return the length of indicesVector to extract a suitable target detection frame

@deadprogram
Copy link
Member

Hello @Hexert thanks for looking into this.

Seems to me the correct solution is to set the size/values of the slice returned with indices, that way a developer does not have to "guess" the resulting size.

For example:

...
indices = make([]int, indicesVector.length)
for i := 0; i < int(indicesVector.length); i++ {
		indices[i] = int(ptr[i])
}
return

Generally speaking we almost never add another param to a function signature that does not exist in the OpenCV function itself.

The same solution would also be needed for NMSBoxesWithParams().

Also, the branch for PRs is normally against dev. See https://github.com/hybridgroup/gocv/blob/release/CONTRIBUTING.md for details.

@Hexert Hexert closed this Oct 30, 2022
@Hexert Hexert reopened this Oct 30, 2022
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