-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Have detect/extract/detect_and_extract methods return underlying object #1974
Conversation
@@ -182,3 +184,5 @@ def extract(self, image, keypoints): | |||
|
|||
_brief_loop(image, self.descriptors.view(np.uint8), keypoints, | |||
pos1, pos2) | |||
|
|||
return self |
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.
missing Return in docs... also shall we return itself of just self.descriptors
?
@@ -206,6 +208,8 @@ def detect(self, image): | |||
self.scales = scales[best_indices] | |||
self.orientations = orientations[best_indices] | |||
self.responses = responses[best_indices] | |||
|
|||
return self |
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.
missing Return in docs...
@@ -272,6 +276,8 @@ def extract(self, image, keypoints, scales, orientations): | |||
|
|||
self.descriptors = np.vstack(descriptors_list).view(np.bool) | |||
self.mask_ = np.hstack(mask_list) | |||
|
|||
return self |
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.
missing Return in docs...
@@ -338,3 +344,5 @@ def detect_and_extract(self, image): | |||
self.orientations = orientations[best_indices] | |||
self.responses = responses[best_indices] | |||
self.descriptors = descriptors[best_indices] | |||
|
|||
return self |
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.
missing Return in docs...
Pull request for issue #1962
This is the most straightforward solution where I've simply added return self to the end of the appropriate functions. However, I believe as @vighneshbirodkar alluded to in the issue thread there may be a better solution where instead the FeatureDetector and DescriptorExtractor base classes are modified to return the underlying object instead. In this case, these methods would call something like self._detect and self._extract (and throwing not implemented exceptions there if necessary) before returning self. However, as is the FeatureDetector and DesciptorExtract base classes don't really do anything besides throw not implemented exceptions so it wasn't clear that the refactoring would be worth it.