diff --git a/modules/core/include/opencv2/core/cuda.hpp b/modules/core/include/opencv2/core/cuda.hpp index 03f8dfdc67..dfad4f93f8 100644 --- a/modules/core/include/opencv2/core/cuda.hpp +++ b/modules/core/include/opencv2/core/cuda.hpp @@ -1327,15 +1327,6 @@ private: CV_EXPORTS_W void printCudaDeviceInfo(int device); CV_EXPORTS_W void printShortCudaDeviceInfo(int device); -/** @brief Converts an array to half precision floating number. - -@param _src input array. -@param _dst output array. -@param stream Stream for the asynchronous version. -@sa cv::Mat::convertTo -*/ -CV_EXPORTS void convertFp16(InputArray _src, OutputArray _dst, Stream& stream = Stream::Null()); - //! @} cudacore_init }} // namespace cv { namespace cuda { diff --git a/modules/core/src/cuda/gpu_mat.cu b/modules/core/src/cuda/gpu_mat.cu index b212138d63..f6878f3bee 100644 --- a/modules/core/src/cuda/gpu_mat.cu +++ b/modules/core/src/cuda/gpu_mat.cu @@ -565,9 +565,9 @@ void cv::cuda::GpuMat::convertTo(OutputArray _dst, int rtype, Stream& stream) co {convertToNoScale, convertToNoScale, 0, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, 0, 0, 0, convertToNoScale, convertToNoScale, convertToNoScale}, {convertToNoScale, convertToNoScale, convertToNoScale, 0, convertToNoScale, convertToNoScale, convertToNoScale, 0, 0, 0, convertToNoScale, convertToNoScale, convertToNoScale}, {convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, 0, convertToNoScale, convertToNoScale, 0, 0, 0, convertToNoScale, convertToNoScale, convertToNoScale}, - {convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, 0, convertToNoScale, 0, 0, 0, convertToNoScale, convertToNoScale, convertToNoScale}, + {convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, 0, convertToNoScale, convertScaleHalf, 0, 0, convertToNoScale, convertToNoScale, convertToNoScale}, {convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, 0, 0, 0, 0, convertToNoScale, convertToNoScale, convertToNoScale}, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, convertScaleHalf, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, convertToNoScale, 0, 0, 0, 0, convertToNoScale, convertToNoScale}, @@ -619,38 +619,4 @@ void cv::cuda::GpuMat::convertTo(OutputArray _dst, int rtype, double alpha, doub func(src.reshape(1), dst.reshape(1), alpha, beta, stream); } -void cv::cuda::convertFp16(InputArray _src, OutputArray _dst, Stream& stream) -{ - GpuMat src = _src.getGpuMat(); - int ddepth = 0; - - switch(src.depth()) - { - case CV_32F: - ddepth = CV_16F; - break; - case CV_16F: - ddepth = CV_32F; - break; - default: - CV_Error(Error::StsUnsupportedFormat, "Unsupported input depth"); - return; - } - int type = CV_MAKE_TYPE(CV_MAT_DEPTH(ddepth), src.channels()); - _dst.create(src.size(), type); - GpuMat dst = _dst.getGpuMat(); - - typedef void (*func_t)(const GpuMat& src, const GpuMat& dst, Stream& stream); - static const func_t funcs[] = - { - 0, 0, 0, - 0, 0, convertScaleHalf, - 0, convertScaleHalf, 0, - }; - - func_t func = funcs[ddepth]; - CV_Assert(func); - func(src.reshape(1), dst.reshape(1), stream); -} - #endif diff --git a/modules/core/test/test_io.cpp b/modules/core/test/test_io.cpp index 43f83b8d11..fe5e01aed3 100644 --- a/modules/core/test/test_io.cpp +++ b/modules/core/test/test_io.cpp @@ -1991,7 +1991,6 @@ static void test_20279(FileStorage& fs) m32fc1.at((int)i) = v * 0.5f; } Mat m16fc1; - // produces CV_16S output: convertFp16(m32fc1, m16fc1); m32fc1.convertTo(m16fc1, CV_16FC1); EXPECT_EQ(CV_16FC1, m16fc1.type()) << typeToString(m16fc1.type()); //std::cout << m16fc1 << std::endl;