Merge remote-tracking branch 'refs/remotes/opencv/master' into FileStorageBase64DocsTests
# Conflicts: # modules/core/test/test_io.cpp
This commit is contained in:
@@ -89,10 +89,10 @@ static void help()
|
||||
"\tThis will detect only the face in image.jpg.\n";
|
||||
|
||||
cout << " \n\nThe classifiers for face and eyes can be downloaded from : "
|
||||
" \nhttps://github.com/Itseez/opencv/tree/master/data/haarcascades";
|
||||
" \nhttps://github.com/opencv/opencv/tree/master/data/haarcascades";
|
||||
|
||||
cout << "\n\nThe classifiers for nose and mouth can be downloaded from : "
|
||||
" \nhttps://github.com/Itseez/opencv_contrib/tree/master/modules/face/data/cascades\n";
|
||||
" \nhttps://github.com/opencv/opencv_contrib/tree/master/modules/face/data/cascades\n";
|
||||
}
|
||||
|
||||
static void detectFaces(Mat& img, vector<Rect_<int> >& faces, string cascade_path)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Online docs: http://docs.opencv.org
|
||||
Q&A forum: http://answers.opencv.org
|
||||
Issue tracker: http://code.opencv.org
|
||||
GitHub: https://github.com/Itseez/opencv/
|
||||
GitHub: https://github.com/opencv/opencv/
|
||||
************************************************** */
|
||||
|
||||
#include "opencv2/calib3d.hpp"
|
||||
|
||||
@@ -56,10 +56,13 @@
|
||||
#include "opencv2/stitching/detail/matchers.hpp"
|
||||
#include "opencv2/stitching/detail/motion_estimators.hpp"
|
||||
#include "opencv2/stitching/detail/seam_finders.hpp"
|
||||
#include "opencv2/stitching/detail/util.hpp"
|
||||
#include "opencv2/stitching/detail/warpers.hpp"
|
||||
#include "opencv2/stitching/warpers.hpp"
|
||||
|
||||
#define ENABLE_LOG 1
|
||||
#define LOG(msg) std::cout << msg
|
||||
#define LOGLN(msg) std::cout << msg << std::endl
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
using namespace cv::detail;
|
||||
|
||||
@@ -13,7 +13,8 @@ using namespace std;
|
||||
using namespace cv;
|
||||
|
||||
/// Global Variables
|
||||
Mat img; Mat templ; Mat result;
|
||||
bool use_mask;
|
||||
Mat img; Mat templ; Mat mask; Mat result;
|
||||
const char* image_window = "Source Image";
|
||||
const char* result_window = "Result window";
|
||||
|
||||
@@ -31,7 +32,7 @@ int main( int argc, char** argv )
|
||||
if (argc < 3)
|
||||
{
|
||||
cout << "Not enough parameters" << endl;
|
||||
cout << "Usage:\n./MatchTemplate_Demo <image_name> <template_name>" << endl;
|
||||
cout << "Usage:\n./MatchTemplate_Demo <image_name> <template_name> [<mask_name>]" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -39,7 +40,12 @@ int main( int argc, char** argv )
|
||||
img = imread( argv[1], IMREAD_COLOR );
|
||||
templ = imread( argv[2], IMREAD_COLOR );
|
||||
|
||||
if(img.empty() || templ.empty())
|
||||
if(argc > 3) {
|
||||
use_mask = true;
|
||||
mask = imread( argv[3], IMREAD_COLOR );
|
||||
}
|
||||
|
||||
if(img.empty() || templ.empty() || (use_mask && mask.empty()))
|
||||
{
|
||||
cout << "Can't read one of the images" << endl;
|
||||
return -1;
|
||||
@@ -76,7 +82,12 @@ void MatchingMethod( int, void* )
|
||||
result.create( result_rows, result_cols, CV_32FC1 );
|
||||
|
||||
/// Do the Matching and Normalize
|
||||
matchTemplate( img, templ, result, match_method );
|
||||
bool method_accepts_mask = (CV_TM_SQDIFF == match_method || match_method == CV_TM_CCORR_NORMED);
|
||||
if (use_mask && method_accepts_mask)
|
||||
{ matchTemplate( img, templ, result, match_method, mask); }
|
||||
else
|
||||
{ matchTemplate( img, templ, result, match_method); }
|
||||
|
||||
normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
|
||||
/// Localizing the best match with minMaxLoc
|
||||
|
||||
@@ -185,7 +185,7 @@ int main(int argc, const char* argv[])
|
||||
}
|
||||
|
||||
Mat_<Point2f> flow;
|
||||
Ptr<DenseOpticalFlow> tvl1 = createOptFlow_DualTVL1();
|
||||
Ptr<DualTVL1OpticalFlow> tvl1 = cv::DualTVL1OpticalFlow::create();
|
||||
|
||||
const double start = (double)getTickCount();
|
||||
tvl1->calc(frame0, frame1, flow);
|
||||
|
||||
Reference in New Issue
Block a user