continue fixing nonfree elements
fixed dependency of stitching module on xfeatures2d module as optional fixed the initModule_xfeatures2d function that was called in module stitching since it is in another namespace than the standard cv one.
This commit is contained in:
parent
d66815978a
commit
d27e440b2a
@ -3133,7 +3133,7 @@ Stores algorithm parameters in a file storage
|
|||||||
|
|
||||||
The method stores all the algorithm parameters (in alphabetic order) to the file storage. The method is virtual. If you define your own Algorithm derivative, your can override the method and store some extra information. However, it's rarely needed. Here are some examples:
|
The method stores all the algorithm parameters (in alphabetic order) to the file storage. The method is virtual. If you define your own Algorithm derivative, your can override the method and store some extra information. However, it's rarely needed. Here are some examples:
|
||||||
|
|
||||||
* SIFT feature detector (from nonfree module). The class only stores algorithm parameters and no keypoints or their descriptors. Therefore, it's enough to store the algorithm parameters, which is what ``Algorithm::write()`` does. Therefore, there is no dedicated ``SIFT::write()``.
|
* SIFT feature detector (from xfeatures2d module). The class only stores algorithm parameters and no keypoints or their descriptors. Therefore, it's enough to store the algorithm parameters, which is what ``Algorithm::write()`` does. Therefore, there is no dedicated ``SIFT::write()``.
|
||||||
|
|
||||||
* Background subtractor (from video module). It has the algorithm parameters and also it has the current background model. However, the background model is not stored. First, it's rather big. Then, if you have stored the background model, it would likely become irrelevant on the next run (because of shifted camera, changed background, different lighting etc.). Therefore, ``BackgroundSubtractorMOG`` and ``BackgroundSubtractorMOG2`` also rely on the standard ``Algorithm::write()`` to store just the algorithm parameters.
|
* Background subtractor (from video module). It has the algorithm parameters and also it has the current background model. However, the background model is not stored. First, it's rather big. Then, if you have stored the background model, it would likely become irrelevant on the next run (because of shifted camera, changed background, different lighting etc.). Therefore, ``BackgroundSubtractorMOG`` and ``BackgroundSubtractorMOG2`` also rely on the standard ``Algorithm::write()`` to store just the algorithm parameters.
|
||||||
|
|
||||||
@ -3179,7 +3179,7 @@ This static method creates a new instance of the specified algorithm. If there i
|
|||||||
|
|
||||||
Ptr<BackgroundSubtractor> bgfg = Algorithm::create<BackgroundSubtractor>("BackgroundSubtractor.MOG2");
|
Ptr<BackgroundSubtractor> bgfg = Algorithm::create<BackgroundSubtractor>("BackgroundSubtractor.MOG2");
|
||||||
|
|
||||||
.. note:: This is important note about seemingly mysterious behavior of ``Algorithm::create()`` when it returns NULL while it should not. The reason is simple - ``Algorithm::create()`` resides in OpenCV`s core module and the algorithms are implemented in other modules. If you create algorithms dynamically, C++ linker may decide to throw away the modules where the actual algorithms are implemented, since you do not call any functions from the modules. To avoid this problem, you need to call ``initModule_<modulename>();`` somewhere in the beginning of the program before ``Algorithm::create()``. For example, call ``initModule_nonfree()`` in order to use SURF/SIFT, call ``initModule_ml()`` to use expectation maximization etc.
|
.. note:: This is important note about seemingly mysterious behavior of ``Algorithm::create()`` when it returns NULL while it should not. The reason is simple - ``Algorithm::create()`` resides in OpenCV`s core module and the algorithms are implemented in other modules. If you create algorithms dynamically, C++ linker may decide to throw away the modules where the actual algorithms are implemented, since you do not call any functions from the modules. To avoid this problem, you need to call ``initModule_<modulename>();`` somewhere in the beginning of the program before ``Algorithm::create()``. For example, call ``initModule_xfeatures2d()`` in order to use SURF/SIFT, call ``initModule_ml()`` to use expectation maximization etc.
|
||||||
|
|
||||||
Creating Own Algorithms
|
Creating Own Algorithms
|
||||||
-----------------------
|
-----------------------
|
||||||
|
@ -8,7 +8,7 @@ if(IOS OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE OR NOT (JNI_FOUND O
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(the_description "The java bindings")
|
set(the_description "The java bindings")
|
||||||
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_imgcodecs opencv_videoio opencv_calib3d opencv_photo opencv_nonfree opencv_contrib)
|
ocv_add_module(java BINDINGS opencv_core opencv_imgproc OPTIONAL opencv_objdetect opencv_features2d opencv_video opencv_imgcodecs opencv_videoio opencv_calib3d opencv_photo opencv_xfeatures2d)
|
||||||
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp")
|
ocv_module_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/generator/src/cpp")
|
||||||
|
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
set(the_description "Images stitching")
|
set(the_description "Images stitching")
|
||||||
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect
|
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_objdetect
|
||||||
OPTIONAL opencv_cuda opencv_cudaarithm opencv_cudafilters opencv_cudafeatures2d)
|
OPTIONAL opencv_cuda opencv_cudaarithm opencv_cudafilters opencv_cudafeatures2d opencv_xfeatures2d)
|
||||||
|
@ -18,7 +18,7 @@ typedef TestBaseWithParam<string> match;
|
|||||||
typedef std::tr1::tuple<string, int> matchVector_t;
|
typedef std::tr1::tuple<string, int> matchVector_t;
|
||||||
typedef TestBaseWithParam<matchVector_t> matchVector;
|
typedef TestBaseWithParam<matchVector_t> matchVector;
|
||||||
|
|
||||||
#ifdef HAVE_OPENCV_NONFREE_TODO_FIND_WHY_SURF_IS_NOT_ABLE_TO_STITCH_PANOS
|
#ifdef HAVE_OPENCV_XFEATURES2D_TODO_FIND_WHY_SURF_IS_NOT_ABLE_TO_STITCH_PANOS
|
||||||
#define TEST_DETECTORS testing::Values("surf", "orb")
|
#define TEST_DETECTORS testing::Values("surf", "orb")
|
||||||
#else
|
#else
|
||||||
#define TEST_DETECTORS testing::Values<string>("orb")
|
#define TEST_DETECTORS testing::Values<string>("orb")
|
||||||
|
@ -49,7 +49,7 @@ using namespace cv::cuda;
|
|||||||
#ifdef HAVE_OPENCV_XFEATURES2D
|
#ifdef HAVE_OPENCV_XFEATURES2D
|
||||||
#include "opencv2/xfeatures2d.hpp"
|
#include "opencv2/xfeatures2d.hpp"
|
||||||
|
|
||||||
static bool makeUseOfNonfree = initModule_xfeatures2d();
|
static bool makeUseOfXfeatures2d = xfeatures2d::initModule_xfeatures2d();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -52,7 +52,7 @@ bool cv::initAll()
|
|||||||
&& initModule_features2d()
|
&& initModule_features2d()
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_OPENCV_XFEATURES2D
|
#ifdef HAVE_OPENCV_XFEATURES2D
|
||||||
&& initModule_xfeatures2d()
|
&& xfeatures2d::initModule_xfeatures2d()
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_flann
|
SET(OPENCV_CPP_SAMPLES_REQUIRED_DEPS opencv_core opencv_imgproc opencv_flann
|
||||||
opencv_imgcodecs opencv_videoio opencv_highgui opencv_ml opencv_video
|
opencv_imgcodecs opencv_videoio opencv_highgui opencv_ml opencv_video
|
||||||
opencv_objdetect opencv_photo opencv_features2d opencv_calib3d
|
opencv_objdetect opencv_photo opencv_features2d opencv_calib3d
|
||||||
opencv_stitching opencv_videostab opencv_shape)
|
opencv_stitching opencv_videostab opencv_shape opencv_xfeatures2d)
|
||||||
|
|
||||||
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
ocv_check_dependencies(${OPENCV_CPP_SAMPLES_REQUIRED_DEPS})
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::cerr << "OpenCV was built without nonfree module" << std::endl;
|
std::cerr << "OpenCV was built without xfeatures2d module" << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user