Merge pull request #10391 from ElenaGvozdeva:HAL_minMaxIdx

This commit is contained in:
Alexander Alekhin 2018-01-11 14:15:40 +00:00
commit 18edd917e3
3 changed files with 38 additions and 0 deletions

View File

@ -712,6 +712,22 @@ inline int hal_ni_gemm64fc(const double* src1, size_t src1_step, const double* s
#define cv_hal_gemm64fc hal_ni_gemm64fc #define cv_hal_gemm64fc hal_ni_gemm64fc
//! @endcond //! @endcond
/**
@brief Finds the global minimum and maximum in an array.
@param src_data,src_step Source image
@param width,height Source image dimensions
@param depth Depth of source image
@param minVal,maxVal Pointer to the returned global minimum and maximum in an array.
@param minIdx,maxIdx Pointer to the returned minimum and maximum location.
@param mask Specified array region.
*/
inline int hal_ni_minMaxIdx(const uchar* src_data, size_t src_step, int width, int height, int depth, double* minVal, double* maxVal,
int* minIdx, int* maxIdx, uchar* mask) { return CV_HAL_ERROR_NOT_IMPLEMENTED; }
//! @cond IGNORED
#define cv_hal_minMaxIdx hal_ni_minMaxIdx
//! @endcond
//! @} //! @}

View File

@ -2713,6 +2713,10 @@ void cv::minMaxIdx(InputArray _src, double* minVal,
Mat src = _src.getMat(), mask = _mask.getMat(); Mat src = _src.getMat(), mask = _mask.getMat();
if (src.dims <= 2)
CALL_HAL(minMaxIdx, cv_hal_minMaxIdx, src.data, src.step, src.cols, src.rows, src.depth(), minVal, maxVal,
minIdx, maxIdx, mask.data);
CV_OVX_RUN(!ovx::skipSmallImages<VX_KERNEL_MINMAXLOC>(src.cols, src.rows), CV_OVX_RUN(!ovx::skipSmallImages<VX_KERNEL_MINMAXLOC>(src.cols, src.rows),
openvx_minMaxIdx(src, minVal, maxVal, minIdx, maxIdx, mask)) openvx_minMaxIdx(src, minVal, maxVal, minIdx, maxIdx, mask))

View File

@ -1867,6 +1867,24 @@ TEST(Core_BoolVector, support)
ASSERT_FLOAT_EQ((float)nz/n, (float)(mean(test)[0])); ASSERT_FLOAT_EQ((float)nz/n, (float)(mean(test)[0]));
} }
TEST(MinMaxLoc, Mat_UcharMax_Without_Loc)
{
Mat_<uchar> mat(50, 50);
uchar iMaxVal = numeric_limits<uchar>::max();
mat.setTo(iMaxVal);
double min, max;
Point minLoc, maxLoc;
minMaxLoc(mat, &min, &max, &minLoc, &maxLoc, Mat());
ASSERT_EQ(iMaxVal, min);
ASSERT_EQ(iMaxVal, max);
ASSERT_EQ(Point(0, 0), minLoc);
ASSERT_EQ(Point(0, 0), maxLoc);
}
TEST(MinMaxLoc, Mat_IntMax_Without_Mask) TEST(MinMaxLoc, Mat_IntMax_Without_Mask)
{ {
Mat_<int> mat(50, 50); Mat_<int> mat(50, 50);