From 77346d728671254a9a2edb7553e83ce738137b8f Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Tue, 1 Oct 2019 16:52:14 +0300 Subject: [PATCH] core: workaround transform() inplace calls --- modules/core/src/matmul.dispatch.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/core/src/matmul.dispatch.cpp b/modules/core/src/matmul.dispatch.cpp index 6fcdb4c..a9b82ae 100644 --- a/modules/core/src/matmul.dispatch.cpp +++ b/modules/core/src/matmul.dispatch.cpp @@ -442,6 +442,12 @@ void transform(InputArray _src, OutputArray _dst, InputArray _mtx) _dst.create( src.size(), CV_MAKETYPE(depth, dcn) ); Mat dst = _dst.getMat(); + if (src.data == dst.data) // inplace case + { + CV_Assert(scn == dcn); + src = src.clone(); // TODO Add performance warning + } + int mtype = depth == CV_32S || depth == CV_64F ? CV_64F : CV_32F; AutoBuffer _mbuf; double* mbuf; -- 2.7.4