Made samples build independent from nonfree module.

This commit is contained in:
Alexander Smorkalov
2015-10-14 12:52:32 +03:00
parent bd34f6dd98
commit bba8c0beac
18 changed files with 301 additions and 110 deletions

View File

@@ -4,12 +4,23 @@
* @author A. Huaman
*/
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#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/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -28,7 +39,7 @@ int main( int argc, char** argv )
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
if( !img_1.data || !img_2.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
{ printf(" --(!) Error reading images \n"); return -1; }
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400;
@@ -97,4 +108,6 @@ int main( int argc, char** argv )
* @function readme
*/
void readme()
{ std::cout << " Usage: ./SURF_FlannMatcher <img1> <img2>" << std::endl; }
{ printf(" Usage: ./SURF_FlannMatcher <img1> <img2>\n"); }
#endif

View File

@@ -4,13 +4,24 @@
* @author A. Huaman
*/
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/nonfree/features2d.hpp"
#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/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/calib3d/calib3d.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -29,7 +40,7 @@ int main( int argc, char** argv )
Mat img_scene = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
if( !img_object.data || !img_scene.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
{ printf(" --(!) Error reading images \n"); return -1; }
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400;
@@ -121,4 +132,6 @@ int main( int argc, char** argv )
* @function readme
*/
void readme()
{ std::cout << " Usage: ./SURF_Homography <img1> <img2>" << std::endl; }
{ printf(" Usage: ./SURF_Homography <img1> <img2>\n"); }
#endif

View File

@@ -4,12 +4,23 @@
* @author A. Huaman
*/
#include "opencv2/opencv_modules.hpp"
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#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/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -70,3 +81,5 @@ int main( int argc, char** argv )
*/
void readme()
{ std::cout << " Usage: ./SURF_descriptor <img1> <img2>" << std::endl; }
#endif

View File

@@ -4,12 +4,23 @@
* @author A. Huaman
*/
#include <stdio.h>
#include "opencv2/opencv_modules.hpp"
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/features2d.hpp"
#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/core/core.hpp"
# include "opencv2/features2d/features2d.hpp"
# include "opencv2/highgui/highgui.hpp"
# include "opencv2/nonfree/features2d.hpp"
using namespace cv;
@@ -60,3 +71,5 @@ int main( int argc, char** argv )
*/
void readme()
{ std::cout << " Usage: ./SURF_detector <img1> <img2>" << std::endl; }
#endif