diff --git a/apps/traincascade/cascadeclassifier.cpp b/apps/traincascade/cascadeclassifier.cpp index de26557dc5..c9b524f5ef 100644 --- a/apps/traincascade/cascadeclassifier.cpp +++ b/apps/traincascade/cascadeclassifier.cpp @@ -168,6 +168,13 @@ bool CvCascadeClassifier::train( const string _cascadeDirName, featureEvaluator = CvFeatureEvaluator::create(cascadeParams.featureType); featureEvaluator->init( featureParams, numPos + numNeg, cascadeParams.winSize ); stageClassifiers.reserve( numStages ); + }else{ + // Make sure that if model parameters are preloaded, that people are aware of this, + // even when passing other parameters to the training command + cout << "---------------------------------------------------------------------------------" << endl; + cout << "Training parameters are pre-loaded from the parameter file in data folder!" << endl; + cout << "Please empty this folder if you want to use a NEW set of training parameters." << endl; + cout << "---------------------------------------------------------------------------------" << endl; } cout << "PARAMETERS:" << endl; cout << "cascadeDirName: " << _cascadeDirName << endl; diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in index 3df038b90f..ee4a186430 100644 --- a/cmake/templates/OpenCVConfig.cmake.in +++ b/cmake/templates/OpenCVConfig.cmake.in @@ -41,6 +41,21 @@ # # =================================================================================== +# Search packages for host system instead of packages for target system. +# in case of cross compilation thess macro should be defined by toolchain file + +if(NOT COMMAND find_host_package) + macro(find_host_package) + find_package(${ARGN}) + endmacro() +endif() + +if(NOT COMMAND find_host_program) + macro(find_host_program) + find_program(${ARGN}) + endmacro() +endif() + if(NOT DEFINED OpenCV_MODULES_SUFFIX) if(ANDROID) string(REPLACE - _ OpenCV_MODULES_SUFFIX "_${ANDROID_NDK_ABI_NAME}") @@ -255,7 +270,7 @@ foreach(__opttype OPT DBG) # CUDA if(OpenCV_CUDA_VERSION) if(NOT CUDA_FOUND) - find_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED) + find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED) else() if(NOT CUDA_VERSION_STRING VERSION_EQUAL OpenCV_CUDA_VERSION) message(FATAL_ERROR "OpenCV static library was compiled with CUDA ${OpenCV_CUDA_VERSION} support. Please, use the same version or rebuild OpenCV with CUDA ${CUDA_VERSION_STRING}") diff --git a/doc/tutorials/ios/hello/hello.markdown b/doc/tutorials/ios/hello/hello.markdown index 51dd8cca72..5a499c3091 100644 --- a/doc/tutorials/ios/hello/hello.markdown +++ b/doc/tutorials/ios/hello/hello.markdown @@ -51,3 +51,11 @@ Output ------ ![](images/output.png) + +Changes for XCode5+ and iOS8+ +----------------------------- + +With the newer XCode and iOS versions you need to watch out for some specific details + +- The *.m file in your project should be renamed to *.mm. +- You have to manually include AssetsLibrary.framework into your project, which is not done anymore by default. diff --git a/modules/androidcamera/src/camera_activity.cpp b/modules/androidcamera/src/camera_activity.cpp index e4669b4107..956c0d3439 100644 --- a/modules/androidcamera/src/camera_activity.cpp +++ b/modules/androidcamera/src/camera_activity.cpp @@ -309,13 +309,13 @@ cv::String CameraWrapperConnector::getPathLibFolder() const char* libName=dl_info.dli_fname; while( ((*libName)=='/') || ((*libName)=='.') ) - libName++; + libName++; - char lineBuf[2048]; FILE* file = fopen("/proc/self/smaps", "rt"); if(file) { + char lineBuf[2048]; while (fgets(lineBuf, sizeof lineBuf, file) != NULL) { //verify that line ends with library name diff --git a/modules/cudaarithm/src/cuda/minmax.cu b/modules/cudaarithm/src/cuda/minmax.cu index 517427073a..c5e912c8e9 100644 --- a/modules/cudaarithm/src/cuda/minmax.cu +++ b/modules/cudaarithm/src/cuda/minmax.cu @@ -134,7 +134,7 @@ void cv::cuda::minMax(InputArray _src, double* minVal, double* maxVal, InputArra *maxVal = vals[1]; } -namespace cv { namespace cuda { namespace internal { +namespace cv { namespace cuda { namespace device { void findMaxAbs(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream); @@ -155,7 +155,7 @@ namespace } } -void cv::cuda::internal::findMaxAbs(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream) +void cv::cuda::device::findMaxAbs(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream) { typedef void (*func_t)(const GpuMat& _src, const GpuMat& mask, GpuMat& _dst, Stream& stream); static const func_t funcs[] = diff --git a/modules/cudaarithm/src/cuda/norm.cu b/modules/cudaarithm/src/cuda/norm.cu index baf76a6db3..43bd358f32 100644 --- a/modules/cudaarithm/src/cuda/norm.cu +++ b/modules/cudaarithm/src/cuda/norm.cu @@ -128,7 +128,7 @@ double cv::cuda::norm(InputArray _src1, InputArray _src2, int normType) return val; } -namespace cv { namespace cuda { namespace internal { +namespace cv { namespace cuda { namespace device { void normL2(cv::InputArray _src, cv::OutputArray _dst, cv::InputArray _mask, Stream& stream); @@ -158,7 +158,7 @@ namespace } } -void cv::cuda::internal::normL2(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream) +void cv::cuda::device::normL2(InputArray _src, OutputArray _dst, InputArray _mask, Stream& stream) { typedef void (*func_t)(const GpuMat& _src, const GpuMat& mask, GpuMat& _dst, Stream& stream); static const func_t funcs[] = diff --git a/modules/cudaarithm/src/reductions.cpp b/modules/cudaarithm/src/reductions.cpp index 04d1ac5de0..50185b161e 100644 --- a/modules/cudaarithm/src/reductions.cpp +++ b/modules/cudaarithm/src/reductions.cpp @@ -84,7 +84,7 @@ void cv::cuda::sqrIntegral(InputArray, OutputArray, Stream&) { throw_no_cuda(); //////////////////////////////////////////////////////////////////////// // norm -namespace cv { namespace cuda { namespace internal { +namespace cv { namespace cuda { namespace device { void normL2(cv::InputArray _src, cv::OutputArray _dst, cv::InputArray _mask, Stream& stream); @@ -106,11 +106,11 @@ void cv::cuda::calcNorm(InputArray _src, OutputArray dst, int normType, InputArr } else if (normType == NORM_L2) { - cv::cuda::internal::normL2(src_single_channel, dst, mask, stream); + cv::cuda::device::normL2(src_single_channel, dst, mask, stream); } else // NORM_INF { - cv::cuda::internal::findMaxAbs(src_single_channel, dst, mask, stream); + cv::cuda::device::findMaxAbs(src_single_channel, dst, mask, stream); } } diff --git a/modules/highgui/include/opencv2/highgui.hpp b/modules/highgui/include/opencv2/highgui.hpp index 5a579ff370..9275ae7c22 100644 --- a/modules/highgui/include/opencv2/highgui.hpp +++ b/modules/highgui/include/opencv2/highgui.hpp @@ -275,8 +275,8 @@ CV_EXPORTS_W int waitKey(int delay = 0); @param mat Image to be shown. The function imshow displays an image in the specified window. If the window was created with the -CV_WINDOW_AUTOSIZE flag, the image is shown with its original size. Otherwise, the image is scaled -to fit the window. The function may scale the image, depending on its depth: +CV_WINDOW_AUTOSIZE flag, the image is shown with its original size, however it is still limited by the screen resolution. +Otherwise, the image is scaled to fit the window. The function may scale the image, depending on its depth: - If the image is 8-bit unsigned, it is displayed as is. - If the image is 16-bit unsigned or 32-bit integer, the pixels are divided by 256. That is, the @@ -287,6 +287,10 @@ to fit the window. The function may scale the image, depending on its depth: If window was created with OpenGL support, imshow also support ogl::Buffer , ogl::Texture2D and cuda::GpuMat as input. +If the window was not created before this function, it is assumed creating a window with CV_WINDOW_AUTOSIZE. + +If you need to show an image that is bigger than the screen resolution, you will need to call namedWindow("", WINDOW_NORMAL) before the imshow. + @note This function should be followed by waitKey function which displays the image for specified milliseconds. Otherwise, it won't display the image. For example, waitKey(0) will display the window infinitely until any keypress (it is suitable for image display). waitKey(25) will display a frame diff --git a/modules/imgproc/include/opencv2/imgproc.hpp b/modules/imgproc/include/opencv2/imgproc.hpp index a434500b87..83cafc9653 100644 --- a/modules/imgproc/include/opencv2/imgproc.hpp +++ b/modules/imgproc/include/opencv2/imgproc.hpp @@ -1051,7 +1051,7 @@ CV_EXPORTS_W Ptr createLineSegmentDetector( The function computes and returns the \f$\texttt{ksize} \times 1\f$ matrix of Gaussian filter coefficients: -\f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma} )^2},\f] +\f[G_i= \alpha *e^{-(i-( \texttt{ksize} -1)/2)^2/(2* \texttt{sigma}^2)},\f] where \f$i=0..\texttt{ksize}-1\f$ and \f$\alpha\f$ is the scale factor chosen so that \f$\sum_i G_i=1\f$. @@ -3613,7 +3613,7 @@ CV_EXPORTS_W float intersectConvexConvex( InputArray _p1, InputArray _p2, /** @brief Fits an ellipse around a set of 2D points. The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of -all. It returns the rotated rectangle in which the ellipse is inscribed. The algorithm @cite Fitzgibbon95 +all. It returns the rotated rectangle in which the ellipse is inscribed. The first algorithm described by @cite Fitzgibbon95 is used. Developer should keep in mind that it is possible that the returned ellipse/rotatedRect data contains negative indices, due to the data points being close to the border of the containing Mat element. diff --git a/modules/imgproc/src/drawing.cpp b/modules/imgproc/src/drawing.cpp index e498d01368..94aef348f0 100644 --- a/modules/imgproc/src/drawing.cpp +++ b/modules/imgproc/src/drawing.cpp @@ -239,7 +239,7 @@ Line( Mat& img, Point pt1, Point pt2, { if( connectivity == 0 ) connectivity = 8; - if( connectivity == 1 ) + else if( connectivity == 1 ) connectivity = 4; LineIterator iterator(img, pt1, pt2, connectivity, true); @@ -288,14 +288,14 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color ) int x_step, y_step; int i, j; int ep_table[9]; - int cb = ((uchar*)color)[0], cg = ((uchar*)color)[1], cr = ((uchar*)color)[2]; - int _cb, _cg, _cr; + int cb = ((uchar*)color)[0], cg = ((uchar*)color)[1], cr = ((uchar*)color)[2], ca = ((uchar*)color)[3]; + int _cb, _cg, _cr, _ca; int nch = img.channels(); uchar* ptr = img.ptr(); size_t step = img.step; Size size = img.size(); - if( !((nch == 1 || nch == 3) && img.depth() == CV_8U) ) + if( !((nch == 1 || nch == 3 || nch == 4) && img.depth() == CV_8U) ) { Line(img, pt1, pt2, color); return; @@ -468,7 +468,7 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color ) } #undef ICV_PUT_POINT } - else + else if(nch == 1) { #define ICV_PUT_POINT() \ { \ @@ -543,6 +543,89 @@ LineAA( Mat& img, Point pt1, Point pt2, const void* color ) } #undef ICV_PUT_POINT } + else + { + #define ICV_PUT_POINT() \ + { \ + _cb = tptr[0]; \ + _cb += ((cb - _cb)*a + 127)>> 8;\ + _cg = tptr[1]; \ + _cg += ((cg - _cg)*a + 127)>> 8;\ + _cr = tptr[2]; \ + _cr += ((cr - _cr)*a + 127)>> 8;\ + _ca = tptr[3]; \ + _ca += ((ca - _ca)*a + 127)>> 8;\ + tptr[0] = (uchar)_cb; \ + tptr[1] = (uchar)_cg; \ + tptr[2] = (uchar)_cr; \ + tptr[3] = (uchar)_ca; \ + } + if( ax > ay ) + { + ptr += (pt1.x >> XY_SHIFT) * 4; + + while( ecount >= 0 ) + { + uchar *tptr = ptr + ((pt1.y >> XY_SHIFT) - 1) * step; + + int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 + + (((ecount >= 2) + 1) & (ecount | 2))]; + int a, dist = (pt1.y >> (XY_SHIFT - 5)) & 31; + + a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff; + ICV_PUT_POINT(); + ICV_PUT_POINT(); + + tptr += step; + a = (ep_corr * FilterTable[dist] >> 8) & 0xff; + ICV_PUT_POINT(); + ICV_PUT_POINT(); + + tptr += step; + a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff; + ICV_PUT_POINT(); + ICV_PUT_POINT(); + + pt1.y += y_step; + ptr += 4; + scount++; + ecount--; + } + } + else + { + ptr += (pt1.y >> XY_SHIFT) * step; + + while( ecount >= 0 ) + { + uchar *tptr = ptr + ((pt1.x >> XY_SHIFT) - 1) * 4; + + int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 + + (((ecount >= 2) + 1) & (ecount | 2))]; + int a, dist = (pt1.x >> (XY_SHIFT - 5)) & 31; + + a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff; + ICV_PUT_POINT(); + ICV_PUT_POINT(); + + tptr += step; + a = (ep_corr * FilterTable[dist] >> 8) & 0xff; + ICV_PUT_POINT(); + ICV_PUT_POINT(); + + tptr += step; + a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff; + ICV_PUT_POINT(); + ICV_PUT_POINT(); + + pt1.x += x_step; + ptr += step; + scount++; + ecount--; + } + } + #undef ICV_PUT_POINT + } }