Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.4' into merge-2.4
Browse files Browse the repository at this point in the history
Conflicts:
	modules/core/include/opencv2/core/operations.hpp
	modules/core/include/opencv2/core/version.hpp
	modules/core/src/gpumat.cpp
	modules/cudaimgproc/src/color.cpp
	modules/features2d/src/orb.cpp
	modules/imgproc/src/samplers.cpp
	modules/ocl/include/opencv2/ocl/matrix_operations.hpp
	modules/ocl/include/opencv2/ocl/ocl.hpp
	samples/ocl/facedetect.cpp
  • Loading branch information
Roman Donchenko committed Dec 10, 2013
2 parents 8db53c1 + 8f10ca5 commit 464a010
Show file tree
Hide file tree
Showing 26 changed files with 329 additions and 209 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/include/opencl/1.2/CL/cl_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ typedef unsigned int cl_GLenum;
/* Define alignment keys */
#if defined( __GNUC__ )
#define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
#elif defined( _WIN32) && (_MSC_VER)
#elif defined( _WIN32) && defined(_MSC_VER)
/* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
/* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
/* #include <crtdefs.h> */
Expand Down
2 changes: 1 addition & 1 deletion apps/traincascade/imagestorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool CvCascadeImageReader::NegReader::nextImg()
_offset.x = std::min( (int)round % winSize.width, src.cols - winSize.width );
_offset.y = std::min( (int)round / winSize.width, src.rows - winSize.height );
if( !src.empty() && src.type() == CV_8UC1
&& offset.x >= 0 && offset.y >= 0 )
&& _offset.x >= 0 && _offset.y >= 0 )
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Building OpenCV
Enable hardware optimizations
-----------------------------

Depending on target platfrom architecture different instruction sets can be used. By default
Depending on target platform architecture different instruction sets can be used. By default
compiler generates code for armv5l without VFPv3 and NEON extensions. Add ``-DUSE_VFPV3=ON``
to cmake command line to enable code generation for VFPv3 and ``-DUSE_NEON=ON`` for using
NEON SIMD extensions.
Expand Down
2 changes: 2 additions & 0 deletions modules/cudaimgproc/src/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,8 @@ void cv::cuda::cvtColor(InputArray src, OutputArray dst, int code, int dcn, Stre

void cv::cuda::demosaicing(InputArray _src, OutputArray _dst, int code, int dcn, Stream& stream)
{
CV_Assert( !_src.empty() );

switch (code)
{
case cv::COLOR_BayerBG2GRAY: case cv::COLOR_BayerGB2GRAY: case cv::COLOR_BayerRG2GRAY: case cv::COLOR_BayerGR2GRAY:
Expand Down
8 changes: 8 additions & 0 deletions modules/cudaimgproc/test/test_color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2357,6 +2357,7 @@ struct Demosaicing : testing::TestWithParam<cv::cuda::DeviceInfo>
CUDA_TEST_P(Demosaicing, BayerBG2BGR)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(1, 1));
Expand All @@ -2370,6 +2371,7 @@ CUDA_TEST_P(Demosaicing, BayerBG2BGR)
CUDA_TEST_P(Demosaicing, BayerGB2BGR)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(0, 1));
Expand All @@ -2383,6 +2385,7 @@ CUDA_TEST_P(Demosaicing, BayerGB2BGR)
CUDA_TEST_P(Demosaicing, BayerRG2BGR)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(0, 0));
Expand All @@ -2396,6 +2399,7 @@ CUDA_TEST_P(Demosaicing, BayerRG2BGR)
CUDA_TEST_P(Demosaicing, BayerGR2BGR)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(1, 0));
Expand All @@ -2409,6 +2413,7 @@ CUDA_TEST_P(Demosaicing, BayerGR2BGR)
CUDA_TEST_P(Demosaicing, BayerBG2BGR_MHT)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(1, 1));
Expand All @@ -2422,6 +2427,7 @@ CUDA_TEST_P(Demosaicing, BayerBG2BGR_MHT)
CUDA_TEST_P(Demosaicing, BayerGB2BGR_MHT)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(0, 1));
Expand All @@ -2435,6 +2441,7 @@ CUDA_TEST_P(Demosaicing, BayerGB2BGR_MHT)
CUDA_TEST_P(Demosaicing, BayerRG2BGR_MHT)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(0, 0));
Expand All @@ -2448,6 +2455,7 @@ CUDA_TEST_P(Demosaicing, BayerRG2BGR_MHT)
CUDA_TEST_P(Demosaicing, BayerGR2BGR_MHT)
{
cv::Mat img = readImage("stereobm/aloe-L.png");
ASSERT_FALSE(img.empty()) << "Can't load input image";

cv::Mat_<uchar> src;
mosaic(img, src, cv::Point(1, 0));
Expand Down
12 changes: 6 additions & 6 deletions modules/features2d/src/orb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ static void computeOrbDescriptor(const KeyPoint& kpt,
float x, y;
int ix, iy;
#if 1
#define GET_VALUE(idx) \
(x = pattern[idx].x*a - pattern[idx].y*b, \
y = pattern[idx].x*b + pattern[idx].y*a, \
ix = cvRound(x), \
iy = cvRound(y), \
*(center + iy*step + ix) )
#define GET_VALUE(idx) \
(x = pattern[idx].x*a - pattern[idx].y*b, \
y = pattern[idx].x*b + pattern[idx].y*a, \
ix = cvRound(x), \
iy = cvRound(y), \
*(center + iy*step + ix) )
#else
#define GET_VALUE(idx) \
(x = pattern[idx].x*a - pattern[idx].y*b, \
Expand Down
4 changes: 2 additions & 2 deletions modules/highgui/src/window_gtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1552,9 +1552,9 @@ static gboolean icvOnMouse( GtkWidget *widget, GdkEvent *event, gpointer user_da
// image origin is not necessarily at (0,0)
int x0 = (widget->allocation.width - image_widget->scaled_image->cols)/2;
int y0 = (widget->allocation.height - image_widget->scaled_image->rows)/2;
pt.x = cvRound( ((pt32f.x-x0)*image_widget->original_image->cols)/
pt.x = cvFloor( ((pt32f.x-x0)*image_widget->original_image->cols)/
image_widget->scaled_image->cols );
pt.y = cvRound( ((pt32f.y-y0)*image_widget->original_image->rows)/
pt.y = cvFloor( ((pt32f.y-y0)*image_widget->original_image->rows)/
image_widget->scaled_image->rows );
}
else{
Expand Down
8 changes: 4 additions & 4 deletions modules/imgproc/src/samplers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ adjustRect( const uchar* src, size_t src_step, int pix_size,
rect.x = win_size.width;
}

if( ip.x + win_size.width < src_size.width )
if( ip.x < src_size.width - win_size.width )
rect.width = win_size.width;
else
{
Expand All @@ -85,7 +85,7 @@ adjustRect( const uchar* src, size_t src_step, int pix_size,
else
rect.y = -ip.y;

if( ip.y + win_size.height < src_size.height )
if( ip.y < src_size.height - win_size.height )
rect.height = win_size.height;
else
{
Expand Down Expand Up @@ -155,8 +155,8 @@ void getRectSubPix_Cn_(const _Tp* src, size_t src_step, Size src_size,
src_step /= sizeof(src[0]);
dst_step /= sizeof(dst[0]);

if( 0 <= ip.x && ip.x + win_size.width < src_size.width &&
0 <= ip.y && ip.y + win_size.height < src_size.height )
if( 0 <= ip.x && ip.x < src_size.width - win_size.width &&
0 <= ip.y && ip.y < src_size.height - win_size.height)
{
// extracted rectangle is totally inside the image
src += ip.y * src_step + ip.x*cn;
Expand Down
8 changes: 0 additions & 8 deletions modules/ocl/doc/data_structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ OpenCV C++ 1-D or 2-D dense array class ::
//! returns true if oclMatrix data is NULL
bool empty() const;

//! returns pointer to y-th row
uchar* ptr(int y = 0);
const uchar *ptr(int y = 0) const;

//! template version of the above method
template<typename _Tp> _Tp *ptr(int y = 0);
template<typename _Tp> const _Tp *ptr(int y = 0) const;

//! matrix transposition
oclMat t() const;

Expand Down
8 changes: 0 additions & 8 deletions modules/ocl/include/opencv2/ocl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,6 @@ namespace cv
//! returns true if oclMatrix data is NULL
bool empty() const;

//! returns pointer to y-th row
uchar* ptr(int y = 0);
const uchar *ptr(int y = 0) const;

//! template version of the above method
template<typename _Tp> _Tp *ptr(int y = 0);
template<typename _Tp> const _Tp *ptr(int y = 0) const;

//! matrix transposition
oclMat t() const;

Expand Down
30 changes: 0 additions & 30 deletions modules/ocl/include/opencv2/ocl/matrix_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,36 +456,6 @@ namespace cv
return data == 0;
}



inline uchar *oclMat::ptr(int y)
{
CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return data + step * y;
}

inline const uchar *oclMat::ptr(int y) const
{
CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return data + step * y;
}

template<typename _Tp> inline _Tp *oclMat::ptr(int y)
{
CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return (_Tp *)(data + step * y);
}

template<typename _Tp> inline const _Tp *oclMat::ptr(int y) const
{
CV_DbgAssert( (unsigned)y < (unsigned)rows );
CV_Error(Error::GpuNotSupported, "This function hasn't been supported yet.\n");
return (const _Tp *)(data + step * y);
}

inline oclMat oclMat::t() const
{
oclMat tmp;
Expand Down
2 changes: 1 addition & 1 deletion modules/ocl/perf/perf_moments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ PERF_TEST_P(MomentsFixture, Moments,
Mat src(srcSize, type), dst(7, 1, CV_64F);
randu(src, 0, 255);

oclMat src_d(src);
cv::Moments mom;
if (RUN_OCL_IMPL)
{
oclMat src_d(src);
OCL_TEST_CYCLE() mom = cv::ocl::ocl_moments(src_d, binaryImage);
}
else if (RUN_PLAIN_IMPL)
Expand Down
2 changes: 1 addition & 1 deletion modules/ocl/src/brute_force_matcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ void cv::ocl::BruteForceMatcher_OCL_base::matchCollection(const oclMat &query, c
ensureSizeIsEnough(1, nQuery, CV_32S, imgIdx);
ensureSizeIsEnough(1, nQuery, CV_32F, distance);

matchDispatcher(query, (const oclMat *)trainCollection.ptr(), trainCollection.cols, masks, trainIdx, imgIdx, distance, distType);
matchDispatcher(query, &trainCollection, trainCollection.cols, masks, trainIdx, imgIdx, distance, distType);

return;
}
Expand Down
5 changes: 3 additions & 2 deletions modules/ocl/src/cl_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ void openCLFree(void *devPtr)
}
#else
// TODO FIXIT Attach clReleaseMemObject call to event completion callback
Context* ctx = Context::getContext();
clFinish(getClCommandQueue(ctx));
// TODO 2013/12/04 Disable workaround
// Context* ctx = Context::getContext();
// clFinish(getClCommandQueue(ctx));
#endif
openCLSafeCall(clReleaseMemObject(data.mainBuffer));
}
Expand Down
Loading

0 comments on commit 464a010

Please sign in to comment.