fix cv::subtract function:

call dst.create(...) before using it
This commit is contained in:
Vladislav Vinogradov
2014-05-07 13:15:19 +04:00
parent 5042ab1f32
commit 4c66614e07
2 changed files with 15 additions and 1 deletions

View File

@@ -1562,8 +1562,12 @@ void cv::subtract( InputArray src1, InputArray src2, OutputArray dst,
if (dtype == -1 && dst.fixedType())
dtype = dst.depth();
if (!dst.fixedType() || dtype == dst.depth())
dtype = CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src1.channels());
if (!dst.fixedType() || dtype == dst.type())
{
dst.create(src1.size(), dtype);
if (dtype == CV_16S)
{
Mat _dst = dst.getMat();