diff --git a/modules/cannops/include/opencv2/cann_interface.hpp b/modules/cannops/include/opencv2/cann_interface.hpp index 8483f41f08a..b35f6a7d7f5 100644 --- a/modules/cannops/include/opencv2/cann_interface.hpp +++ b/modules/cannops/include/opencv2/cann_interface.hpp @@ -484,6 +484,7 @@ CV_EXPORTS_W void resize(InputArray _src, OutputArray _dst, Size dsize, double i CV_EXPORTS_W void resize(const AscendMat& src, CV_OUT AscendMat& dst, Size dsize, double inv_scale_x, double inv_scale_y, int interpolation, AscendStream& stream = AscendStream::Null()); + //! @} cannops_core //! @addtogroup cannimgproc diff --git a/modules/cannops/perf/perf_core.cpp b/modules/cannops/perf/perf_core.cpp index 41f87313087..a9d86fca881 100644 --- a/modules/cannops/perf/perf_core.cpp +++ b/modules/cannops/perf/perf_core.cpp @@ -146,5 +146,16 @@ PERF_TEST_P(CPU, CROP, TYPICAL_ASCEND_MAT_SIZES) SANITY_CHECK_NOTHING(); } +PERF_TEST_P(NPU, CROP_OVERLOAD, TYPICAL_ASCEND_MAT_SIZES) +{ + Mat mat(GET_PARAM(0), CV_8UC3); + Mat dst; + declare.in(mat, WARMUP_RNG); + Rect b(1, 2, 4, 4); + cv::cann::setDevice(DEVICE_ID); + TEST_CYCLE() { cv::cann::crop(mat, b); } + cv::cann::resetDevice(); + SANITY_CHECK_NOTHING(); +} } // namespace } // namespace opencv_test diff --git a/modules/cannops/test/test_core.cpp b/modules/cannops/test/test_core.cpp index 9c5da9207d3..1dabdad282e 100644 --- a/modules/cannops/test/test_core.cpp +++ b/modules/cannops/test/test_core.cpp @@ -189,6 +189,7 @@ TEST(CORE, RESIZE) // only support {2 INTER_CUBIC} and {3 INTER_AREA} // only the resize result of INTER_AREA is close to CV's. int flags = 3; + cv::cann::setDevice(0); cv::resize(cpuMat, resized_cv, dsize, 0, 0, flags); cv::cann::resize(cpuMat, checker, dsize, 0, 0, flags); EXPECT_MAT_NEAR(resized_cv, checker, 1e-4); @@ -208,6 +209,7 @@ TEST(CORE, RESIZE) cv::cann::resize(npuMat, npuChecker, Size(), 0.5, 0.5, flags); npuChecker.download(checker); EXPECT_MAT_NEAR(resized_cv, checker, 1e-4); + cv::cann::resetDevice(); }