From cdf2a59afa5010c43e9ce348988bffc1552645e0 Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 30 Jun 2017 19:32:16 +0300 Subject: [PATCH] canny: disallow broken inplace arguments --- modules/imgproc/src/canny.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/imgproc/src/canny.cpp b/modules/imgproc/src/canny.cpp index b4a4ac4d71..c723c2b3c8 100644 --- a/modules/imgproc/src/canny.cpp +++ b/modules/imgproc/src/canny.cpp @@ -972,6 +972,9 @@ void Canny( InputArray _src, OutputArray _dst, const Size size = _src.size(); + // we don't support inplace parameters in case with RGB/BGR src + CV_Assert((_dst.getObj() != _src.getObj() || _src.type() == CV_8UC1) && "Inplace parameters are not supported"); + _dst.create(size, CV_8U); if (!L2gradient && (aperture_size & CV_CANNY_L2_GRADIENT) == CV_CANNY_L2_GRADIENT)