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

Have detect/extract/detect_and_extract methods return underlying object #1974

Closed
wants to merge 5 commits into from
Closed

Conversation

afloren
Copy link

@afloren afloren commented Mar 1, 2016

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.

@soupault soupault added the ⏩ type: Enhancement Improve existing features label Mar 2, 2016
@soupault soupault changed the title Pull request for Issue #1962 Have detect/extract/detect_and_extract methods return underlying object Mar 8, 2016
@@ -182,3 +184,5 @@ def extract(self, image, keypoints):

_brief_loop(image, self.descriptors.view(np.uint8), keypoints,
pos1, pos2)

return self
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing Return in docs...

Base automatically changed from master to main February 18, 2021 18:22
@afloren afloren closed this by deleting the head repository Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants