diff --git a/modules/imgproc/src/color_yuv.dispatch.cpp b/modules/imgproc/src/color_yuv.dispatch.cpp index 6cb508f980..18b2096680 100644 --- a/modules/imgproc/src/color_yuv.dispatch.cpp +++ b/modules/imgproc/src/color_yuv.dispatch.cpp @@ -406,6 +406,8 @@ void cvtColorTwoPlaneYUV2BGRpair( InputArray _ysrc, InputArray _uvsrc, OutputArr Mat ysrc = _ysrc.getMat(), uvsrc = _uvsrc.getMat(); + CV_CheckEQ(ysrc.step, uvsrc.step, ""); + _dst.create( ysz, CV_MAKETYPE(depth, dcn)); Mat dst = _dst.getMat(); diff --git a/modules/imgproc/test/test_color.cpp b/modules/imgproc/test/test_color.cpp index e1fb21bd40..450cf57923 100644 --- a/modules/imgproc/test/test_color.cpp +++ b/modules/imgproc/test/test_color.cpp @@ -3072,4 +3072,21 @@ TEST(ImgProc_RGB2YUV, regression_13668) EXPECT_EQ(res, ref); } +TEST(ImgProc_cvtColorTwoPlane, missing_check_17036) // test can be removed if required feature is implemented +{ + std::vector y_data(700 * 480); + std::vector uv_data(640 * 240); + + Mat y_plane_padding(480, 640, CV_8UC1, y_data.data(), 700); // with stride + Mat uv_plane(240, 320, CV_8UC2, uv_data.data()); + + Mat result; + + EXPECT_THROW( + cvtColorTwoPlane(y_plane_padding, uv_plane, result, COLOR_YUV2RGB_NV21); + , cv::Exception + ); +} + + }} // namespace