Skip to content

Fix: UsacParams Python bindings (Issue#18595)#18598

Merged
opencv-pushbot merged 1 commit intoopencv:masterfrom
aleromar:Issue18595_UsacParams_PythonBinding
Oct 18, 2020
Merged

Fix: UsacParams Python bindings (Issue#18595)#18598
opencv-pushbot merged 1 commit intoopencv:masterfrom
aleromar:Issue18595_UsacParams_PythonBinding

Conversation

@aleromar
Copy link
Copy Markdown

@aleromar aleromar commented Oct 16, 2020

resolves #18595

This PR is to fix issue #18595 .

The solution was to adopt a similar approach to the one taken for struct CirclesGridFinderParameters under the same file calib3d.hpp

It was verified that the modified binding exposes the data fields under struct UsacParams

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@alalek
Copy link
Copy Markdown
Member

alalek commented Oct 16, 2020

@komakai Could you please take a look on build issues of Swift bindings for this patch?

Details
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:62:9: error: cannot initialize return object of type 'LocalOptimMethod' with an lvalue of type 'cv::LocalOptimMethod'
        return self.nativePtr->loMethod;
               ^~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:66:29: error: assigning to 'cv::LocalOptimMethod' from incompatible type 'LocalOptimMethod'
        self.nativePtr->loMethod = loMethod;
                                   ^~~~~~~~
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:86:9: error: cannot initialize return object of type 'NeighborSearchMethod' with an lvalue of type 'cv::NeighborSearchMethod'
        return self.nativePtr->neighborsSearch;
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:90:36: error: assigning to 'cv::NeighborSearchMethod' from incompatible type 'NeighborSearchMethod'
        self.nativePtr->neighborsSearch = neighborsSearch;
                                          ^~~~~~~~~~~~~~~
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:102:9: error: cannot initialize return object of type 'SamplingMethod' with an lvalue of type 'cv::SamplingMethod'
        return self.nativePtr->sampler;
               ^~~~~~~~~~~~~~~~~~~~~~~
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:106:28: error: assigning to 'cv::SamplingMethod' from incompatible type 'SamplingMethod'
        self.nativePtr->sampler = sampler;
                                  ^~~~~~~
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:110:9: error: cannot initialize return object of type 'ScoreMethod' with an lvalue of type 'cv::ScoreMethod'
        return self.nativePtr->score;
               ^~~~~~~~~~~~~~~~~~~~~
/Volumes/build-storage/build/precommit_ios/build/build_ios/build/build-armv7-iphoneos/modules/objc/gen/objc/calib3d/UsacParams.mm:114:26: error: assigning to 'cv::ScoreMethod' from incompatible type 'ScoreMethod'
        self.nativePtr->score = score;
                                ^~~~~
8 errors generated.

@komakai
Copy link
Copy Markdown
Contributor

komakai commented Oct 17, 2020

@alalek Seems like the forward declarations of the relevant enum types are not being output. Will take a look

@komakai
Copy link
Copy Markdown
Contributor

komakai commented Oct 17, 2020

I found the problem - we are missing some casts
Generated code:

-(LocalOptimMethod)loMethod {
	return self.nativePtr->loMethod;
}

-(void)setLoMethod:(LocalOptimMethod)loMethod {
	self.nativePtr->loMethod = loMethod;
}

needs to be:

-(LocalOptimMethod)loMethod {
	return (LocalOptimMethod)self.nativePtr->loMethod;
}

-(void)setLoMethod:(LocalOptimMethod)loMethod {
	self.nativePtr->loMethod = (cv::LocalOptimMethod)loMethod;
}

I'll try and fix it

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Thank you 👍

@opencv-pushbot opencv-pushbot merged commit adac1da into opencv:master Oct 18, 2020
@aleromar
Copy link
Copy Markdown
Author

Thanks

@alalek alalek mentioned this pull request Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data fields in struct cv::UsacParams not accesible through Python

4 participants