Skip to content
Snippets Groups Projects
Commit e0c7d667 authored by Angel Santamaria-Navarro's avatar Angel Santamaria-Navarro
Browse files

new naming for OpenCV3 headers in OpenCV examples

parent 378a596b
No related branches found
No related tags found
1 merge request!128Updates for OpenCV 3 api (keeping OpenCV 2 back compatibility)
This commit is part of merge request !128. Comments created here will be created in the context of that merge request.
//std includes
#include <iostream>
//opencv includes
#include "opencv2/features2d/features2d.hpp"
// OpenCV includes
#if defined (HAVE_OPENCV3)
#include <opencv2/features2d.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#else
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#endif
int main(int argc, char** argv)
{
......
......@@ -9,12 +9,20 @@
// general includes
#include "unistd.h"
#include <time.h>
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/features2d/features2d.hpp"
// OpenCV includes
#if defined (HAVE_OPENCV3)
#include <opencv2/features2d.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include "opencv2/calib3d.hpp"
#else
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#endif
// General includes
//#include <math.h>
......
//std includes
#include <iostream>
//opencv includes
#include "opencv2/features2d/features2d.hpp"
// OpenCV includes
#if defined (HAVE_OPENCV3)
#include <opencv2/features2d.hpp>
#else
#include <opencv2/features2d/features2d.hpp>
#endif
#include "processor_image_landmark.h"
......@@ -12,32 +16,39 @@ int main(int argc, char** argv)
std::cout << std::endl << "==================== tracker ORB test ======================" << std::endl;
cv::VideoCapture capture;
const char * filename;
if (argc == 1)
{
std::string video_path = "/src/examples/Test_ORB.mp4";
filename = (_WOLF_ROOT_DIR + video_path).c_str();
capture.open(filename);
}
else if (std::string(argv[1]) == "0")
{
//camera
filename = "0";
capture.open(0);
}
else
{
filename = argv[1];
capture.open(filename);
}
std::cout << "Input video file: " << filename << std::endl;
if(!capture.isOpened()) std::cout << "failed" << std::endl; else std::cout << "succeded" << std::endl;
//capture.set(CV_CAP_PROP_POS_MSEC, 3000);
unsigned int img_width = capture.get(CV_CAP_PROP_FRAME_WIDTH);
unsigned int img_height = capture.get(CV_CAP_PROP_FRAME_HEIGHT);
std::cout << "Image size: " << img_width << "x" << img_height << std::endl;
// parsing input params
const char * filename;
cv::VideoCapture capture;
if (argc < 2)
{
std::cout << "Please use\n\t./test_opencv <arg> "
"\nwith "
"\n\targ = <path/videoname.mp4> for video input "
"\n\targ = 0 for camera input." << std::endl;
return 0;
}
else if (std::string(argv[1]) == "0")
{
filename = "0"; // camera
capture.open(0);
std::cout << "Input stream from camera " << std::endl;
}
else
{
filename = argv[1]; // provided through argument
capture.open(filename);
std::cout << "Input video file: " << filename << std::endl;
}
// Open input stream
if (!capture.isOpened()) // check if we succeeded
std::cout << "failed" << std::endl;
else
std::cout << "succeded" << std::endl;
// set and print image properties
unsigned int img_width = (unsigned int)capture.get(CV_CAP_PROP_FRAME_WIDTH);
unsigned int img_height = (unsigned int)capture.get(CV_CAP_PROP_FRAME_HEIGHT);
std::cout << "Image size: " << img_width << "x" << img_height << std::endl;
//=====================================================
// Environment variable for configuration files
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment