1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge remote-tracking branch 'refs/remotes/opencv/master' into FileStorageBase64DocsTests

# Conflicts:
#	modules/core/test/test_io.cpp
This commit is contained in:
MYLS
2016-07-30 01:08:27 +08:00
196 changed files with 5398 additions and 1448 deletions
@@ -2,7 +2,7 @@
// http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html
//
// It uses standard OpenCV asymmetric circles grid pattern 11x4:
// https://github.com/Itseez/opencv/blob/2.4/doc/acircles_pattern.png.
// https://github.com/opencv/opencv/blob/2.4/doc/acircles_pattern.png.
// The results are the camera matrix and 5 distortion coefficients.
//
// Tap on highlighted pattern to capture pattern corners for calibration.
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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"
+4 -1
View File
@@ -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
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -81,9 +81,9 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
if(NOT WITH_OPENGL)
if(NOT HAVE_OPENGL)
list(REMOVE_ITEM all_samples "opengl.cpp")
endif(NOT WITH_OPENGL)
endif()
foreach(sample_filename ${all_samples})
get_filename_component(sample ${sample_filename} NAME_WE)
@@ -96,9 +96,9 @@ endif()
if(INSTALL_C_EXAMPLES AND NOT WIN32)
file(GLOB install_list *.c *.cpp *.jpg *.png *.data makefile.* build_all.sh *.dsp *.cmd )
if(NOT WITH_OPENGL)
if(NOT HAVE_OPENGL)
list(REMOVE_ITEM install_list "opengl.cpp")
endif(NOT WITH_OPENGL)
endif()
install(FILES ${install_list}
DESTINATION ${OPENCV_SAMPLES_SRC_INSTALL_PATH}/gpu
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT samples)
+1 -1
View File
@@ -71,7 +71,7 @@ def deskew(img):
class StatModel(object):
def load(self, fn):
self.model.load(fn) # Known bug: https://github.com/Itseez/opencv/issues/4969
self.model.load(fn) # Known bug: https://github.com/opencv/opencv/issues/4969
def save(self, fn):
self.model.save(fn)
+1 -1
View File
@@ -32,7 +32,7 @@ def main():
model = cv2.ml.SVM_load(classifier_fn)
else:
model = cv2.ml.SVM_create()
model.load_(classifier_fn) #Known bug: https://github.com/Itseez/opencv/issues/4969
model.load_(classifier_fn) #Known bug: https://github.com/opencv/opencv/issues/4969
while True:
ret, frame = cap.read()
+1 -1
View File
@@ -3,7 +3,7 @@
'''
Feature-based image matching sample.
Note, that you will need the https://github.com/Itseez/opencv_contrib repo for SIFT and SURF
Note, that you will need the https://github.com/opencv/opencv_contrib repo for SIFT and SURF
USAGE
find_obj.py [--feature=<sift|surf|orb|akaze|brisk>[-flann]] [ <image1> <image2> ]
+1 -1
View File
@@ -50,7 +50,7 @@ if __name__ == '__main__':
em.setCovarianceMatrixType(cv2.ml.EM_COV_MAT_GENERIC)
em.trainEM(points)
means = em.getMeans()
covs = em.getCovs() # Known bug: https://github.com/Itseez/opencv/pull/4232
covs = em.getCovs() # Known bug: https://github.com/opencv/opencv/pull/4232
found_distrs = zip(means, covs)
print('ready!\n')
+8 -5
View File
@@ -29,11 +29,14 @@ if __name__ == '__main__':
cimg = src.copy() # numpy function
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1, 10, np.array([]), 100, 30, 1, 30)
a, b, c = circles.shape
for i in range(b):
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv2.LINE_AA)
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv2.LINE_AA) # draw center of circle
if circles != None: # Check if circles have been found and only then iterate over these and add them to the image
a, b, c = circles.shape
for i in range(b):
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), circles[0][i][2], (0, 0, 255), 3, cv2.LINE_AA)
cv2.circle(cimg, (circles[0][i][0], circles[0][i][1]), 2, (0, 255, 0), 3, cv2.LINE_AA) # draw center of circle
cv2.imshow("detected circles", cimg)
cv2.imshow("source", src)
cv2.imshow("detected circles", cimg)
cv2.waitKey(0)
+13 -11
View File
@@ -36,17 +36,19 @@ if __name__ == '__main__':
else: # HoughLines
lines = cv2.HoughLines(dst, 1, math.pi/180.0, 50, np.array([]), 0, 0)
a,b,c = lines.shape
for i in range(a):
rho = lines[i][0][0]
theta = lines[i][0][1]
a = math.cos(theta)
b = math.sin(theta)
x0, y0 = a*rho, b*rho
pt1 = ( int(x0+1000*(-b)), int(y0+1000*(a)) )
pt2 = ( int(x0-1000*(-b)), int(y0-1000*(a)) )
cv2.line(cdst, pt1, pt2, (0, 0, 255), 3, cv2.LINE_AA)
if lines != None:
a,b,c = lines.shape
for i in range(a):
rho = lines[i][0][0]
theta = lines[i][0][1]
a = math.cos(theta)
b = math.sin(theta)
x0, y0 = a*rho, b*rho
pt1 = ( int(x0+1000*(-b)), int(y0+1000*(a)) )
pt2 = ( int(x0-1000*(-b)), int(y0-1000*(a)) )
cv2.line(cdst, pt1, pt2, (0, 0, 255), 3, cv2.LINE_AA)
cv2.imshow("detected lines", cdst)
cv2.imshow("source", src)
cv2.imshow("detected lines", cdst)
cv2.waitKey(0)
+1 -1
View File
@@ -27,7 +27,7 @@ font = cv2.FONT_HERSHEY_SIMPLEX
color = (0, 255, 0)
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_AUTOFOCUS, False) # Known bug: https://github.com/Itseez/opencv/pull/5474
cap.set(cv2.CAP_PROP_AUTOFOCUS, False) # Known bug: https://github.com/opencv/opencv/pull/5474
cv2.namedWindow("Video")