bbenligiray / stag

STag: A Stable Fiducial Marker System
MIT License
188 stars 52 forks source link

Help compiling and running on mac os x #15

Open vshesh opened 3 years ago

vshesh commented 3 years ago

Hello,

Trying to run your detector on Mac OS X and so far I have managed to download the code, change some flags for new opencv and build the library by using CMake. I want to build the library as a shared library so I can call it from python and use it to detect tags. The Stag parts compile okay, but when the compilation gets to the ED/ED.cpp file it fails in the directory generally due to dependency on old opencv code (such as IplImage). Any ideas on how I can update the library to compile against new opencv?

Scanning dependencies of target STag
[  4%] Building CXX object CMakeFiles/STag.dir/src/ED/ED.cpp.o
In file included from /Users/Vishesh/repos/tui-table/tags/stag/src/ED/ED.cpp:18:
/Users/Vishesh/repos/tui-table/tags/stag/src/ED/Utilities.h:22:14: error: unknown type name
      'IplImage'
void RGB2Lab(IplImage *rgbImg, IplImage *labImg);
             ^
/Users/Vishesh/repos/tui-table/tags/stag/src/ED/Utilities.h:22:32: error: unknown type name
      'IplImage'
void RGB2Lab(IplImage *rgbImg, IplImage *labImg);
                               ^

There is also a dependency on windows.h in the Timer.h module. How do I convert this to mac?

Another question is whether this whole library can be wrapped for python or similar so that I can ignore main.cpp and write my own loop function there (and just use the library to run the detection algorithm).

Sologala commented 3 years ago

hi! i just pull request a branch to build in macos , please refer to this link

vshesh commented 3 years ago

^ took a look. seems like you have made changes for windows.h and Timer.h modules, which is helpful. how did you resolve the old opencv version issue? I don't see anything in your pull request for that.

Also, once you did get it to build, how are you using this package as a detector? Have you wrapped it, or are you writing your own c++ code and linking it against this library yourself? It would be somewhat difficult for me to maintain my own c++ code using the cv::Mat and associated functions ... i'd much rather use python or similar with this library as glue.

Sologala commented 3 years ago

I just also got this repositary, so that do not know more details about it. But you can check this:

 stag.detectMarkers(image);
 stag.logResults("");

logResults() will give you some inspiration.

In most of my time, i use it as a library within my own c++ code. You can use pybind11 to warp it for python.

Sologala commented 3 years ago

@vshesh Or you can check this demo

vshesh commented 3 years ago

Thanks for the response. I think this is all helpful, except I cannot build your package against opencv version 4. The package uses the old C struct IplImage instead of the newer cv::Mat class.

Have you found a way around this?

Sologala commented 3 years ago

I have not met this problem. It seems like that Sloving this problem well cost a bunch of time. the version of my opencv is 3.4.13, and My environment won't be later version for the time being. Nevertheless, I will publish it If I met it and successfully tackle it.

vshesh commented 3 years ago

OK, that is helpful I will investigate if it's possible for me to have both opencv 3 and opencv 4 installed on my machine...

On Tue, Mar 16, 2021 at 1:15 AM Sologala @.***> wrote:

I have not met this problem. It �seems like that Sloving this problem well cost a bunch of time. the version of my opencv is 3.4.13, and My environment won't be later version for the time being. Nevertheless, I will publish it If I met it and successfully tackle it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bbenligiray/stag/issues/15#issuecomment-800051805, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWLKJNBW32273FKXZT5V63TD4HRXANCNFSM4XXYCYWA .