5

I have a function in my project that would do stitching, the function is working fine, it is very simple:

Mat output(m_Img, true), pano; // a panaoramic image

    bool try_use_gpu = true;
    Stitcher iSticher = Stitcher::createDefault(try_use_gpu);   
    // Set Feature finder to be ORB
    iSticher.setFeaturesFinder(new detail::OrbFeaturesFinder());

    try{

        Stitcher::Status status = iSticher.stitch(Imgs, pano);
        if (status != Stitcher::OK)
        {
            LOG("Error stitching - Code: %d", int(status));
            return -1;
        }
    }
    catch(exception e)
    {
        LOG("Cannot Stitch Image,%s",e.what());
    }

The code works well and I was able to stitch images fairly well. The only problem is that when I want to deploy my code, I realized that I have to use non-free dll. Otherwise, the .exe won't run. My questions are: in order to use Stitcher class from opencv does that mean you have to pay, even if you are not using SURF or SIFT algorithms? Is there a way to do it without using "nonfree dlls"? Note: I am using opencv 2.4.2. Edit: I also tested it with OpenCV 2.4.11

Samer
  • 1,923
  • 3
  • 34
  • 54
  • What non-free DLL do you use? – Kyrylo Polezhaiev Jan 20 '16 at 00:58
  • @KyryloPolezhaiev, as far as I know there is only one non-free.dll. But, if you are asking about non free functions, I am not using any nonfree function, it is only the code here in the question... – Samer Jan 20 '16 at 01:52
  • It seems you don't need to deploy `opencv_nonfree.dll`, `opencv_stitching.dll` instead. Did you use SIFT or SURF elsewhere? Or did you link to `opencv_nonfree.lib` explicitly in your project? – herohuyongtao Jan 20 '16 at 05:01
  • @herohuyongtao, I tried to run the code with only opencv_stitching.dll but that didn't work, it asked for non-free.dll in order for it to run. I tried using Visual Studio 2008 and 2012. – Samer Jan 20 '16 at 14:17
  • @Samer Did you use SIFT or SURF elsewhere? Or did you link to opencv_nonfree.lib explicitly in your project? – herohuyongtao Jan 20 '16 at 14:22
  • @herohuyongtao, no I didn't here are the libraries that I linked to: opencv_core242.lib opencv_imgproc242.lib opencv_highgui242.lib opencv_stitching242.lib – Samer Jan 20 '16 at 14:29
  • 1
    Did you check with http://www.dependencywalker.com/ what your binary tries to load from the DLL? – x29a Jan 25 '16 at 08:09
  • @x29a I did that and apparently there are some header file that are included when you use stitching class, but the question, if you use the header file, does that mean you are violating the patent? – Samer Jan 25 '16 at 14:40

1 Answers1

1

So, after a lot of digging. I think I have found a solution to this issue: There is a flag in opencv_modules.hpp called: HAVE_OPENCV_NONFREE If you undefine or comment the definition of this flag and build opencv from source then this should fix this issue, i.e. opencv_stitching.dll will not depeneds on opencv_non-free.dll

Samer
  • 1,923
  • 3
  • 34
  • 54