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

Changes to make this more useful as an external library #10

Open
slensgra opened this issue Mar 15, 2020 · 5 comments
Open

Changes to make this more useful as an external library #10

slensgra opened this issue Mar 15, 2020 · 5 comments

Comments

@slensgra
Copy link

slensgra commented Mar 15, 2020

I'd like to get the ROS node I have running put into a more finished state by separating out the STag code and the ROS wrapper. To get that node running I had to make a couple of changes to this code:

  • There was a memory leak in the EDInterface, so I added a destructor
  • The code only compiles on a windows computer unless you remove the windows specific stuff (thankfully not necessary to detect markers!), so I just deleted it (Timer.cpp and the function that finds files in a directory)
  • No CMakeLists.txt was provided, so I made one to compile Stag.cpp into a library
  • I patched the marker being decoded multiple times problem
  • The Stag class has a vector of Marker objects which would increase in size indefinitely over all frames, so I made it clear the markers
  • Made detectMarkers return the number of markers detected
  • Made the markers vector on the Stag class public to make the markers usable by other code
  • Changed the define of NULL to STAG_NULL to avoid a compiler warning
  • Put everything into the stag namespace to avoid name collisions in client code
  • Added explicit termination criteria into the PoseRefiner.cpp code for the pose optimization

Are you interested in having these changes contributed back into your code? If so, I can do the separation work and improve the style of what I have then make a PR into this code. I could also add an alternate implementation for the windows specific code which would work on linux.

Here is a diff for your reference (messy but can be cleaned if you want the changes).
master...dartmouthrobotics:master

@slensgra slensgra changed the title Changes to make this useful as an external library Changes to make this more useful as an external library Mar 15, 2020
@Norfo
Copy link

Norfo commented Mar 25, 2020

Hello, @slensgra! Can you explain where you added destructor, please. I'm also faced with this problem.

@bbenligiray
Copy link
Owner

bbenligiray commented Mar 25, 2020

Hey @slensgra , I'd be happy to merge your PR!

@slensgra
Copy link
Author

slensgra commented Mar 25, 2020

Great, let me get one ready.

@Norfo See destructor in EDInterface at line 27 of EDInterface.cpp in the diff above

@Norfo
Copy link

Norfo commented Mar 26, 2020

@slensgra, thanks! By the way, @bbenligiray, do you have any plans to rewrite ED classes? As far as I understand, they are quite old. I faced with a problem that they cannot be used together with OpenCV4. In addition, there is a possibility to rewrite them with cuda support.

@bbenligiray
Copy link
Owner

The ED code was my coauthors' work and I barely wrapped it for this project. Cihan Topal had a student refactor it with C++ STL (https://github.com/CihanTopal/ED_Lib). As far as I know it's slightly slower, but I would prefer to use that for production. I think there is some ongoing work to integrate this version to OpenCV by third parties.
opencv/opencv_contrib#2313

Especially the edge segment detection part of the algorithm is considerably sequential, so it requires some modifications for a CUDA implementation. There is a proof of concept below from 2012, but I didn't see the code being released.
https://ieeexplore.ieee.org/document/6152450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants