-
Notifications
You must be signed in to change notification settings - Fork 46
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
Make a "proper" PDL::OpenCV module #362
Comments
It seems @fantasma13 has started to implement this! https://sourceforge.net/p/pdl/mailman/message/37620582/ |
I've started PDL::OCV, which tries to link PDL and a more modern OpenCV. With v4 the C interface was dropped, which complicates matters significantly. |
Please help me with creating persistent perl or C bindings to opaque C structs holding objects! |
I will take a look at this very soon! May I suggest renaming the repo (and modules) to PDL-OpenCV? Dima's one was never uploaded to CPAN, so the name is free, and "OCV" would be terribly unclear for people to tell what it is. |
Did you take a look at Libtmp/GSL/INTERP and its use of the |
Finally I figured how to use the pointers and references. The GSL example has two pointers wrapped in an array, that got me confused for a while. I dereferenced one level off. |
The module is significantly more complete now. All basic OpenCV data types are supported, video IO works, so PDL has now a way to read videos. |
Is the issue resolved? |
Great work! I'd like to leave this open a bit longer, until the module is on CPAN. @fantasma13 Would you mind if I look over the code and make some tweaks? |
Implied tasks: we need an Alien::OpenCV |
With this input as
And a checkout of https://github.com/opencv/opencv in
produces JSON describing the various enums, Python classes, and methods thereof (with the doc), which can be processed to generate wrappers for the C++ methods. |
Brilliant idea! |
I've been conceptually blocked for a while by how to handle more complicated inputs/outputs, particularly I now think the way forward is:
This preserves the C API concept of #358 so the As part of this, it may be useful to add |
This will also need adding a modifier |
Instead, the broadcast check is runtime. |
Next steps will be:
|
My working notes: general"skip" for cv.{h,v}concat, transpose cv.CLAHE.getTilesGridSize returns a Size, check works docsdoc enums as Subdiv2Dcv.Subdiv2D.insert vector_Point2f form - picking form more params, else highest-D param(s) calib3dcv.solveP3P has output vector_Mat features2dcv.Feature2D.detect output vector_vector_KeyPoint trackercv.TrackerGOTURN.create empty params yet " background_segmcv.createBackgroundSubtractorMOG2 needs changing to cv.BackgroundSubtractorMOG2.create objdetectcv.createBackgroundSubtractorKNN ditto imgcodecscv.imread doc has - for list |
Update: To describe "comp mode": the relevant output variables are put in the The returning of string values works. There is also partial parsing of Doxygen docs, and a dumb and partial conversion of that to POD. It's comprehensible and includes All the functions and methods are put in appropriate packages under PDL::OpenCV, and none are added to the PDL namespace. Only package-less functions, and class-static methods (a thing in C++ which I chose to just make exported functions rather than Remaining is to make the I will also be wrapping the more interesting (ideally, nearly all) the remaining classes, especially So far, to make the dev cycle relatively quick, I have limited the number of wrapped functions to what I use in my testing, expanding by one example per added wrapping-feature. However, as I am using the now repo-tracked |
Vectors of strings, of Mats, and of other vectors now works. They get input/output as array-refs, of strings/ndarrays. That uses the Next is to generalise wrapping of other classes, including allowing more fancy constructors via polymorphism. That will also apply to at least VideoCapture.open, to allow both passing a string, and an integer (to allow opening the user's webcam). |
The wrapping of all the classes in the enabled modules is now complete, and polymorphism in both constructors and other functions/methods is handled in a naive but effective way, by just numbering them: e.g. Remaining steps:
|
The first two of these are done. The additional modules are revealing a few extra issues like deeper namespaces ( |
Point 4 was also done (i.e. PDL::OpenCV 0.001 is now on CPAN). Point 3 (add the other modules) is ongoing, subject to the issues of deeper-namespace (now at least partly addressed) and also a more accurate handling of wrapped classes than the current heuristic. |
Currently there is (from 2013) an XS module https://metacpan.org/pod/Cv, and not on CPAN (and naively generated from header files) https://github.com/dkogan/PDL-OpenCV - it would be good to make a real PDL module, possibly starting from those.
The text was updated successfully, but these errors were encountered: