Exported a high level stitcher for Scans to the DLL#10681
Exported a high level stitcher for Scans to the DLL#10681opencv-pushbot merged 1 commit intoopencv:masterfrom
Conversation
allows Stitcher to be used for scans from within python.
I had to use very strange notation because I couldn't export the `enum`
`Mode` making the Cpython generated code unable to compile.
```c++
class Stitcher {
public:
enum Mode
{
PANORAMA = 0,
SCANS = 1,
};
...
```
Also removed duplicate code from the `createStitcher` function making
use of the `Stitcher::create` function
|
👍 |
|
@terfendail is there a way to expose the enums to the python interface? If so, that would make it much easier to create these interfaces. To my knowledge, the only reason the function |
|
Hi, it is possible and quite easy see https://github.com/opencv/opencv/blob/master/modules/stitching/misc/python/pyopencv_stitching.hpp I agree with you that it would be much better to export the enum and create function, rather than creating yet another auxiliary function to create a Stitcher. There are already too many ways to create a Stitcher, it is a mess. I hope it will be cleaned in OpenCV 4.0. Sorry for being late, but you were quite fast with merging this. I think we can still remove the new function, since there has been no release, right? |
|
@hrnr Thanks for explaining. I've used SWIG before to export my C++ interfaces to Python and never actually created templates myself. Thanks for showing me the example. I personally think the old function should be removed too, I just couldn't find an example quickly. I'll try to implement the change, compile and update the PR. |
|
As far as I know OpenCV uses custom build binding generator and not SWIG. You can find it in the python module if you are interested. |
|
Hi @hrnr I added typedef Stitcher::Mode Mode;
template<>
PyObject* pyopencv_from(const Mode& value)
{
return PyInt_FromLong(value);
}but now I get Is there an easy way to generate that function without having to manually add the keys to a string compare dictionary? |
|
I'm not an expert in OpenCV python bindings, maybe @alalek knows how to do this properly? |
|
@hmaarrfk Could you please check the change with latest master? However at the moment such typedefs are added to |
allows Stitcher to be used for scans from within python.
I had to use very strange notation because I couldn't export the
enumModemaking the Cpython generated code unable to compile.Also removed duplicate code from the
createStitcherfunction makinguse of the
Stitcher::createfunctionThis pullrequest changes