Merge remote-tracking branch 'origin/2.4' into merge-2.4

Conflicts:
	modules/core/include/opencv2/core/types_c.h
	modules/gpu/src/cuda/imgproc.cu
	modules/gpu/src/cuda/safe_call.hpp
	modules/gpu/src/error.cpp
	modules/gpu/src/imgproc.cpp
	modules/imgproc/src/distransform.cpp
	modules/imgproc/src/shapedescr.cpp
	modules/python/src2/cv2.cpp
	modules/python/src2/cv2.cv.hpp
This commit is contained in:
Roman Donchenko 2013-07-22 18:38:57 +04:00
commit 3939d78336
32 changed files with 358 additions and 215 deletions

View File

@ -230,9 +230,15 @@ endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if (WIN32)
set(tbb_debug_postfix "_debug") # to fit pragmas in _windef.h inside TBB
else()
set(tbb_debug_postfix ${OPENCV_DEBUG_POSTFIX})
endif()
set_target_properties(tbb
PROPERTIES OUTPUT_NAME tbb
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
DEBUG_POSTFIX "${tbb_debug_postfix}"
ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}
)

View File

@ -99,7 +99,11 @@ if(CUDA_FOUND)
if(CUDA_GENERATION STREQUAL "Fermi")
set(__cuda_arch_bin "2.0 2.1(2.0)")
elseif(CUDA_GENERATION STREQUAL "Kepler")
set(__cuda_arch_bin "3.0")
if(${CUDA_VERSION} VERSION_LESS "5.0")
set(__cuda_arch_bin "3.0")
else()
set(__cuda_arch_bin "3.0 3.5")
endif()
elseif(CUDA_GENERATION STREQUAL "Auto")
execute_process( COMMAND "${CUDA_NVCC_EXECUTABLE}" "${OpenCV_SOURCE_DIR}/cmake/checks/OpenCVDetectCudaArch.cu" "--run"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/"
@ -113,8 +117,12 @@ if(CUDA_FOUND)
endif()
if(NOT DEFINED __cuda_arch_bin)
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
set(__cuda_arch_ptx "2.0 3.0")
if(${CUDA_VERSION} VERSION_LESS "5.0")
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
else()
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")
endif()
set(__cuda_arch_ptx "3.0")
endif()
set(CUDA_ARCH_BIN ${__cuda_arch_bin} CACHE STRING "Specify 'real' GPU architectures to build binaries for, BIN(PTX) format is supported")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -52,7 +52,7 @@ Use for example the *OpenCV_Debug* name. Then by selecting the sheet :menuselect
.. code-block:: bash
$(OPENCV_DIR)\include
$(OPENCV_DIR)\..\..\include
.. image:: images/PropertySheetOpenCVInclude.jpg
:alt: Add the include dir like this.
@ -64,7 +64,7 @@ Next go to the :menuselection:`Linker --> General` and under the *"Additional Li
.. code-block:: bash
$(OPENCV_DIR)\libs
$(OPENCV_DIR)\lib
.. image:: images/PropertySheetOpenCVLib.jpg
:alt: Add the library folder like this.

View File

@ -746,7 +746,7 @@ static void fjac(int /*i*/, int /*j*/, CvMat *point_params, CvMat* cam_params, C
CvMat* _mp = cvCreateMat(1, 1, CV_64FC2 ); //projection of the point
//split camera params into different matrices
CvMat _ri, _ti, _k;
CvMat _ri, _ti, _k = cvMat(0, 0, CV_64F, NULL); // dummy initialization to fix warning of cl.exe
cvGetRows( cam_params, &_ri, 0, 3 );
cvGetRows( cam_params, &_ti, 3, 6 );

View File

@ -59,6 +59,7 @@ CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
dd->set("nOctaveLayers", 5);
dd->set("contrastThreshold", 0.04);
dd->set("edgeThreshold", 10.7);
break;
case CvFeatureTrackerParams::SURF:
dd = Algorithm::create<Feature2D>("Feature2D.SURF");
if( dd.empty() )
@ -66,8 +67,10 @@ CvFeatureTracker::CvFeatureTracker(CvFeatureTrackerParams _params) :
dd->set("hessianThreshold", 400);
dd->set("nOctaves", 3);
dd->set("nOctaveLayers", 4);
break;
default:
CV_Error(CV_StsBadArg, "Unknown feature type");
break;
}
matcher = new BFMatcher(NORM_L2);

View File

@ -84,7 +84,7 @@
#ifndef CV_INLINE
# if defined __cplusplus
# define CV_INLINE static inline
# elif (defined WIN32 || defined _WIN32 || defined WINCE) && !defined __GNUC__
# elif defined _MSC_VER
# define CV_INLINE __inline
# else
# define CV_INLINE static

View File

@ -147,7 +147,7 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector<KeyPoint>
int clusterCount = descriptorSize(); // = vocabulary.rows
// Compute descriptors for the image.
Mat descriptors = _descriptors ? *_descriptors : Mat();
Mat descriptors;
dextractor->compute( image, keypoints, descriptors );
// Match keypoint descriptors to cluster center (to vocabulary)
@ -176,6 +176,11 @@ void BOWImgDescriptorExtractor::compute( const Mat& image, std::vector<KeyPoint>
// Normalize image descriptor.
imgDescriptor /= descriptors.rows;
// Add the descriptors of image keypoints
if (_descriptors) {
*_descriptors = descriptors.clone();
}
}
int BOWImgDescriptorExtractor::descriptorSize() const

View File

@ -275,8 +275,11 @@ bool CvCaptureCAM::grabFrame(double timeOut) {
double sleepTime = 0.005;
double total = 0;
while (![capture updateImage] && (total += sleepTime)<=timeOut)
usleep((int)(sleepTime*1000));
NSDate *loopUntil = [NSDate dateWithTimeIntervalSinceNow:sleepTime];
while (![capture updateImage] && (total += sleepTime)<=timeOut &&
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
beforeDate:loopUntil])
loopUntil = [NSDate dateWithTimeIntervalSinceNow:sleepTime];
[localpool drain];

View File

@ -744,6 +744,16 @@ void cv::distanceTransform( InputArray _src, OutputArray _dst, OutputArray _labe
if( labelType == CV_DIST_LABEL_CCOMP )
{
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if( maskSize == CV_DIST_MASK_5 )
{
IppiSize roi = { src->cols, src->rows };
if( ippiDistanceTransform_5x5_8u32f_C1R(
src->data.ptr, src->step,
dst->data.fl, dst->step, roi, _mask) >= 0 )
return;
}
#endif
Mat zpix = src == 0;
connectedComponents(zpix, labels, 8, CV_32S);
}

View File

@ -266,6 +266,8 @@ public:
}
private:
calcHist1D_Invoker operator=(const calcHist1D_Invoker&);
T* p_[one];
uchar* mask_;
int step_[one];
@ -338,6 +340,8 @@ public:
}
private:
calcHist2D_Invoker operator=(const calcHist2D_Invoker&);
T* p_[two];
uchar* mask_;
int step_[two];
@ -428,6 +432,8 @@ public:
}
private:
calcHist3D_Invoker operator=(const calcHist3D_Invoker&);
T* p_[three];
uchar* mask_;
int step_[three];
@ -767,8 +773,7 @@ calcHist_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
#ifdef HAVE_TBB
calcHist1D_Invoker<T> body(_ptrs, _deltas, hist, _uniranges, size[0], dims, imsize);
parallel_for(BlockedRange(0, imsize.height), body);
return;
#endif
#else
double a = uniranges[0], b = uniranges[1];
int sz = size[0], d0 = deltas[0], step0 = deltas[1];
const T* p0 = (const T*)ptrs[0];
@ -791,14 +796,15 @@ calcHist_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
((int*)H)[idx]++;
}
}
#endif //HAVE_TBB
return;
}
else if( dims == 2 )
{
#ifdef HAVE_TBB
calcHist2D_Invoker<T> body(_ptrs, _deltas, hist, _uniranges, size, dims, imsize, hstep);
parallel_for(BlockedRange(0, imsize.height), body);
return;
#endif
#else
double a0 = uniranges[0], b0 = uniranges[1], a1 = uniranges[2], b1 = uniranges[3];
int sz0 = size[0], sz1 = size[1];
int d0 = deltas[0], step0 = deltas[1],
@ -827,6 +833,8 @@ calcHist_( std::vector<uchar*>& _ptrs, const std::vector<int>& _deltas,
((int*)(H + hstep0*idx0))[idx1]++;
}
}
#endif //HAVE_TBB
return;
}
else if( dims == 3 )
{

View File

@ -381,7 +381,7 @@ cv::RotatedRect cv::fitEllipse( InputArray _points )
// New fitellipse algorithm, contributed by Dr. Daniel Weiss
Point2f c(0,0);
double gfp[5], rp[5], t;
const double min_eps = 1e-6;
const double min_eps = 1e-8;
bool is_float = depth == CV_32F;
const Point* ptsi = (const Point*)points.data;
const Point2f* ptsf = (const Point2f*)points.data;

View File

@ -41,6 +41,9 @@
//M*/
#include "precomp.hpp"
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
static IppStatus sts = ippInit();
#endif
namespace cv
{
@ -234,6 +237,53 @@ void cv::integral( InputArray _src, OutputArray _sum, OutputArray _sqsum, Output
if( sdepth <= 0 )
sdepth = depth == CV_8U ? CV_32S : CV_64F;
sdepth = CV_MAT_DEPTH(sdepth);
#if defined (HAVE_IPP) && (IPP_VERSION_MAJOR >= 7)
if( ( depth == CV_8U ) && ( !_tilted.needed() ) )
{
if( sdepth == CV_32F )
{
if( cn == 1 )
{
IppiSize srcRoiSize = ippiSize( src.cols, src.rows );
_sum.create( isize, CV_MAKETYPE( sdepth, cn ) );
sum = _sum.getMat();
if( _sqsum.needed() )
{
_sqsum.create( isize, CV_MAKETYPE( CV_64F, cn ) );
sqsum = _sqsum.getMat();
ippiSqrIntegral_8u32f64f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32f*)sum.data, sum.step, (Ipp64f*)sqsum.data, sqsum.step, srcRoiSize, 0, 0 );
}
else
{
ippiIntegral_8u32f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32f*)sum.data, sum.step, srcRoiSize, 0 );
}
return;
}
}
if( sdepth == CV_32S )
{
if( cn == 1 )
{
IppiSize srcRoiSize = ippiSize( src.cols, src.rows );
_sum.create( isize, CV_MAKETYPE( sdepth, cn ) );
sum = _sum.getMat();
if( _sqsum.needed() )
{
_sqsum.create( isize, CV_MAKETYPE( CV_64F, cn ) );
sqsum = _sqsum.getMat();
ippiSqrIntegral_8u32s64f_C1R( (const Ipp8u*)src.data, src.step, (Ipp32s*)sum.data, sum.step, (Ipp64f*)sqsum.data, sqsum.step, srcRoiSize, 0, 0 );
}
else
{
ippiIntegral_8u32s_C1R( (const Ipp8u*)src.data, src.step, (Ipp32s*)sum.data, sum.step, srcRoiSize, 0 );
}
return;
}
}
}
#endif
_sum.create( isize, CV_MAKETYPE(sdepth, cn) );
sum = _sum.getMat();

File diff suppressed because it is too large Load Diff

View File

@ -245,6 +245,19 @@ public class Mat {
return retVal;
}
//
// C++: int Mat::dims()
//
// javadoc: Mat::dims()
public int dims()
{
int retVal = n_dims(nativeObj);
return retVal;
}
//
// C++: int Mat::cols()
//
@ -1130,6 +1143,9 @@ public class Mat {
// C++: Mat Mat::colRange(int startcol, int endcol)
private static native long n_colRange(long nativeObj, int startcol, int endcol);
// C++: int Mat::dims()
private static native int n_dims(long nativeObj);
// C++: int Mat::cols()
private static native int n_cols(long nativeObj);

View File

@ -15,7 +15,7 @@ public class MatOfByte extends Mat {
protected MatOfByte(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfByte extends Mat {
public MatOfByte(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -17,7 +17,7 @@ public class MatOfDMatch extends Mat {
protected MatOfDMatch(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat: " + toString());
throw new IllegalArgumentException("Incompatible Mat: " + toString());
//FIXME: do we need release() here?
}
@ -28,7 +28,7 @@ public class MatOfDMatch extends Mat {
public MatOfDMatch(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat: " + toString());
throw new IllegalArgumentException("Incompatible Mat: " + toString());
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfDouble extends Mat {
protected MatOfDouble(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfDouble extends Mat {
public MatOfDouble(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfFloat extends Mat {
protected MatOfFloat(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfFloat extends Mat {
public MatOfFloat(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfFloat4 extends Mat {
protected MatOfFloat4(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfFloat4 extends Mat {
public MatOfFloat4(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfFloat6 extends Mat {
protected MatOfFloat6(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfFloat6 extends Mat {
public MatOfFloat6(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -16,7 +16,7 @@ public class MatOfInt extends Mat {
protected MatOfInt(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -27,7 +27,7 @@ public class MatOfInt extends Mat {
public MatOfInt(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -16,7 +16,7 @@ public class MatOfInt4 extends Mat {
protected MatOfInt4(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -27,7 +27,7 @@ public class MatOfInt4 extends Mat {
public MatOfInt4(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -17,7 +17,7 @@ public class MatOfKeyPoint extends Mat {
protected MatOfKeyPoint(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -28,7 +28,7 @@ public class MatOfKeyPoint extends Mat {
public MatOfKeyPoint(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfPoint extends Mat {
protected MatOfPoint(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfPoint extends Mat {
public MatOfPoint(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfPoint2f extends Mat {
protected MatOfPoint2f(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfPoint2f extends Mat {
public MatOfPoint2f(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfPoint3 extends Mat {
protected MatOfPoint3(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfPoint3 extends Mat {
public MatOfPoint3(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -15,7 +15,7 @@ public class MatOfPoint3f extends Mat {
protected MatOfPoint3f(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -26,7 +26,7 @@ public class MatOfPoint3f extends Mat {
public MatOfPoint3f(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -16,7 +16,7 @@ public class MatOfRect extends Mat {
protected MatOfRect(long addr) {
super(addr);
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}
@ -27,7 +27,7 @@ public class MatOfRect extends Mat {
public MatOfRect(Mat m) {
super(m, Range.all());
if( !empty() && checkVector(_channels, _depth) < 0 )
throw new IllegalArgumentException("Incomatible Mat");
throw new IllegalArgumentException("Incompatible Mat");
//FIXME: do we need release() here?
}

View File

@ -1,6 +1,7 @@
#include <Python.h>
#define MODULESTR "cv2"
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/ndarrayobject.h>
#include "opencv2/core.hpp"
@ -200,10 +201,10 @@ public:
if(!o)
CV_Error_(Error::StsError, ("The numpy array of typenum=%d, ndims=%d can not be created", typenum, dims));
refcount = refcountFromPyObject(o);
npy_intp* _strides = PyArray_STRIDES(o);
npy_intp* _strides = PyArray_STRIDES((PyArrayObject*) o);
for( i = 0; i < dims - (cn > 1); i++ )
step[i] = (size_t)_strides[i];
datastart = data = (uchar*)PyArray_DATA(o);
datastart = data = (uchar*)PyArray_DATA((PyArrayObject*) o);
}
void deallocate(int* refcount, uchar*, uchar*)
@ -278,8 +279,10 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info)
return false;
}
PyArrayObject* oarr = (PyArrayObject*) o;
bool needcopy = false, needcast = false;
int typenum = PyArray_TYPE(o), new_typenum = typenum;
int typenum = PyArray_TYPE(oarr), new_typenum = typenum;
int type = typenum == NPY_UBYTE ? CV_8U :
typenum == NPY_BYTE ? CV_8S :
typenum == NPY_USHORT ? CV_16U :
@ -308,7 +311,7 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info)
const int CV_MAX_DIM = 32;
#endif
int ndims = PyArray_NDIM(o);
int ndims = PyArray_NDIM(oarr);
if(ndims >= CV_MAX_DIM)
{
failmsg("%s dimensionality (=%d) is too high", info.name, ndims);
@ -318,8 +321,8 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info)
int size[CV_MAX_DIM+1];
size_t step[CV_MAX_DIM+1];
size_t elemsize = CV_ELEM_SIZE1(type);
const npy_intp* _sizes = PyArray_DIMS(o);
const npy_intp* _strides = PyArray_STRIDES(o);
const npy_intp* _sizes = PyArray_DIMS(oarr);
const npy_intp* _strides = PyArray_STRIDES(oarr);
bool ismultichannel = ndims == 3 && _sizes[2] <= CV_CN_MAX;
for( int i = ndims-1; i >= 0 && !needcopy; i-- )
@ -343,11 +346,17 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info)
failmsg("Layout of the output array %s is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels)", info.name);
return false;
}
if( needcast )
o = (PyObject*)PyArray_Cast((PyArrayObject*)o, new_typenum);
else
o = (PyObject*)PyArray_GETCONTIGUOUS((PyArrayObject*)o);
_strides = PyArray_STRIDES(o);
if( needcast ) {
o = PyArray_Cast(oarr, new_typenum);
oarr = (PyArrayObject*) o;
}
else {
oarr = PyArray_GETCONTIGUOUS(oarr);
o = (PyObject*) oarr;
}
_strides = PyArray_STRIDES(oarr);
}
for(int i = 0; i < ndims; i++)
@ -375,7 +384,7 @@ static bool pyopencv_to(PyObject* o, Mat& m, const ArgInfo info)
return false;
}
m = Mat(ndims, size, type, PyArray_DATA(o), step);
m = Mat(ndims, size, type, PyArray_DATA(oarr), step);
if( m.data )
{

View File

@ -291,6 +291,7 @@ def main():
sheet.write_merge(row, row + 1, col, col, caption, header_style)
else:
sheet.write(row, col, caption, header_style)
col += 1
row += 2 if args.show_times_per_pixel else 1

View File

@ -552,13 +552,6 @@ Regression& Regression::operator() (const std::string& name, cv::InputArray arra
std::string nodename = getCurrentTestNodeName();
// This is a hack for compatibility and it should eventually get removed.
// gpu's tests don't even have CPU sanity data anymore.
if(suiteName == "gpu")
{
nodename = (PERF_RUN_GPU() ? "GPU_" : "CPU_") + nodename;
}
cv::FileNode n = rootIn[nodename];
if(n.isNone())
{