Refactoring to prepare for other vector types while mutualizing methods#18074
Merged
opencv-pushbot merged 1 commit intoopencv:3.4from Aug 12, 2020
Merged
Conversation
20e3019 to
98de57c
Compare
alalek
reviewed
Aug 12, 2020
Contributor
Author
|
Well, I know that and was some kind of hesitating keeping the new and
delete as it is when I moved them for the refactoring. I decided to do so
as this is how FLANN was originally coded within all its different files,
with almost 20 of "new" within just the kmeans_index.h file.
I suggest we keep it like that for this branch as there is no regression
because it is just like it was before, and I will create later another
branch removing the new/delete from the different source files. In between
I will push another branch for computing new kinds of vectors, as this is
the main reason of my recent PRs. Are you fine with that?
Le mer. 12 août 2020 à 12:17, Alexander Alekhin <notifications@github.com>
a écrit :
… ***@***.**** commented on this pull request.
------------------------------
In modules/flann/include/opencv2/flann/kmeans_index.h
<#18074 (comment)>:
> + sq_dist = new_sq_dist;
+ }
+ }
+ if (sq_dist>radiuses[belongs_to[i]]) {
+ radiuses[belongs_to[i]] = sq_dist;
+ }
+ count[belongs_to[i]]++;
+ }
+
+ CentersType** centers = new CentersType*[branching];
+
+ Distance* dummy = NULL;
+ refineAndSplitClustering(node, indices, indices_length, branching, level,
+ centers, radiuses, belongs_to, count, dummy);
+
+ delete[] centers;
Please avoid manual memory management, because it is not exception safe.
Use cv::AutoBuffer or std::vector instead.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#18074 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPELVN6RENQV5I2RQLQ2FTSAJT2DANCNFSM4P3TT77A>
.
|
Member
OK for moved code. |
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.