Made samples build independent from nonfree module.

(cherry picked from commit bba8c0beac)
This commit is contained in:
Alexander Smorkalov
2015-10-14 12:52:32 +03:00
parent 42447a7610
commit 966d35a9fb
18 changed files with 301 additions and 110 deletions

View File

@@ -4,7 +4,7 @@
# ----------------------------------------------------------------------------
SET(OPENCV_C_SAMPLES_REQUIRED_DEPS opencv_core opencv_flann opencv_imgproc
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo opencv_nonfree
opencv_highgui opencv_ml opencv_video opencv_objdetect opencv_photo
opencv_features2d opencv_calib3d opencv_legacy opencv_contrib)
ocv_check_dependencies(${OPENCV_C_SAMPLES_REQUIRED_DEPS})

View File

@@ -4,19 +4,31 @@
* Author: Liu Liu
* liuliu.1987+opencv@gmail.com
*/
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/legacy/compat.hpp"
#include <iostream>
#include <vector>
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/objdetect/objdetect.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/calib3d/calib3d.hpp"
# include "opencv2/nonfree/nonfree.hpp"
# include "opencv2/imgproc/imgproc_c.h"
# include "opencv2/legacy/legacy.hpp"
# include "opencv2/legacy/compat.hpp"
# include <vector>
using namespace std;
static void help()
{
@@ -320,3 +332,5 @@ int main(int argc, char** argv)
return 0;
}
#endif

View File

@@ -1,12 +1,25 @@
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include <fstream>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
std::cout << "The sample requires nonfree module that is not available in your OpenCV distribution." << std::endl;
return -1;
}
#else
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/core/core.hpp"
# include "opencv2/imgproc/imgproc.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/nonfree/nonfree.hpp"
# include "opencv2/legacy/legacy.hpp"
# include <iostream>
# include <fstream>
using namespace std;
using namespace cv;
@@ -164,3 +177,5 @@ int main( int argc, char **argv )
return 0;
}
#endif

View File

@@ -7,16 +7,28 @@
*
*/
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/legacy/legacy.hpp"
#include "opencv2/legacy/compat.hpp"
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#ifndef HAVE_OPENCV_NONFREE
int main(int, char**)
{
printf("The sample requires nonfree module that is not available in your OpenCV distribution.\n");
return -1;
}
#else
# include "opencv2/imgproc/imgproc.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/imgproc/imgproc_c.h"
# include "opencv2/nonfree/nonfree.hpp"
# include "opencv2/legacy/legacy.hpp"
# include "opencv2/legacy/compat.hpp"
#include <string>
#include <stdio.h>
static void help()
{
@@ -116,3 +128,5 @@ Mat DrawCorrespondences(const Mat& img1, const vector<KeyPoint>& features1, cons
return img_corr;
}
#endif