Skip to content

Python wrapper for detail - #13267

Merged
alalek merged 7 commits into
opencv:masterfrom
LaurentBerger:StitchPython
Dec 18, 2018
Merged

alalek merged 7 commits into
opencv:masterfrom
LaurentBerger:StitchPython

Conversation

@LaurentBerger

@LaurentBerger LaurentBerger commented Nov 24, 2018 •

Copy link
Copy Markdown
Contributor

Rewrite stitching_detailed.cpp in python

@LaurentBerger

LaurentBerger commented Nov 28, 2018 •

Copy link
Copy Markdown
Contributor Author

@alalek Something is wrong in my last commit but I don't understand Opencl test failed for stitching
In commit (d8416e3) and in following commit something is wrong :
diff.txt

I add four methods (getMatGains, setMatGains, setUpdateGain getUpdateGain ) and a protected member updateGain

@alalek

alalek commented Nov 28, 2018

Copy link
Copy Markdown
Member

Try to debug locally (built with opencv_contrib - SURF is there).

@alalek

alalek commented Nov 28, 2018

Copy link
Copy Markdown
Member

GDB:

(gdb) frame 2
#2  0x00007ffff7aff456 in cv::detail::BlocksGainCompensator::apply (this=0x7a25c0, index=0, _image=...) at /home/alalek/projects/opencv/dev/modules/stitching/src/exposure_compensate.cpp:263
263	    if (gain_maps_[index].size() == _image.size())
(gdb) p gain_maps_
$1 = std::vector of length 0, capacity 0

@LaurentBerger

LaurentBerger commented Nov 28, 2018 •

Copy link
Copy Markdown
Contributor Author

ABI the return ?

@alalek

alalek commented Nov 28, 2018

Copy link
Copy Markdown
Member

API only.

Add some default implementation instead of pure declaration. For example CV_Error(Error::StsInternal, "");

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well done!

It would be nice to have some Python example or simple test (without accuracy check, just check for non-empty result).

Ptr<detail::RotationWarper> rw;

public:
CV_WRAP PyRotationWarper(String type, float scale);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe this should be moved out from public headers.

Could you create file similar to "shadow_umat.hpp"?

Do you have any thoughts about Java?

@alalek

alalek commented Dec 9, 2018

Copy link
Copy Markdown
Member

My mistake - shadow doesn't work here, because there is not C++ class (like UMat).
Place this code as regular bindings only code in "misc" folder.

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add some simple Python test (no need to test accuracy, just test that provided bindings works and return non empty result)

Comment thread modules/python/src2/cv2.cpp Outdated
typedef std::vector<UMat> vector_UMat;
typedef std::vector<detail::ImageFeatures> vector_ImageFeatures;
typedef std::vector<detail::MatchesInfo> vector_MatchesInfo;
typedef std::vector<detail::CameraParams> vector_CameraParams;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only types from "core" module are allowed in cv2.cpp

Other types should be defined via "misc/python" headers.

std::vector<double> &focals);

bool CV_EXPORTS calibrateRotatingCamera(const std::vector<Mat> &Hs, Mat &K);
bool CV_EXPORTS_W calibrateRotatingCamera(const std::vector<Mat> &Hs, Mat &K);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use CV_OUT for output parameters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK

@LaurentBerger

Copy link
Copy Markdown
Contributor Author

Previous commit was wrong because PyRotationWraper was not exported in python

Comment thread modules/python/test/test_detail.py Outdated
@@ -0,0 +1,70 @@
#!/usr/bin/env python

@alalek alalek Dec 18, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!
Please move this test code into test_stitching.py.

class detail_test -> class stitching_detail_test

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well done! Thank you 👍

@alalek
alalek merged commit 2fb409b into opencv:master Dec 18, 2018
@LaurentBerger
LaurentBerger deleted the StitchPython branch January 3, 2019 14:15
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
* Python wrapper for detail

* hide pyrotationwrapper

* copy code in pyopencv_rotationwarper.hpp

* move ImageFeatures MatchInfo and CameraParams in core/misc/

* add python test for detail

* move test_detail in test_stitching

* rename
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
* Python wrapper for detail

* hide pyrotationwrapper

* copy code in pyopencv_rotationwarper.hpp

* move ImageFeatures MatchInfo and CameraParams in core/misc/

* add python test for detail

* move test_detail in test_stitching

* rename
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.

2 participants