Skip to content

Strange behaviour of multiply  #8385

@LaurentBerger

Description

@LaurentBerger
System information (version)
  • OpenCV => 3.2-dev
  • Operating System / Platform => Windows 10 64 Bit
  • Compiler => Visual Studio 2015
Detailed description

My program is

        Mat x(1, 2, CV_8UC1, Scalar::all(3)),y;
        cout<<x<<"\n";
        add(x, 2.0, x);
        cout << x << "\n";
        multiply(x, 2.1, y, 1, CV_32F);
        cout << y << "\n";
        multiply(x, x, x,1,CV_16UC1); // Line A to change
        cout << x << "\n";

results:
[ 3, 3]
[ 5, 5]
[10.5, 10.5]
[42025, 42025] : why?

Now instead of A I write
multiply(x, x, x);

[ 3, 3]
[ 5, 5]
[10.5, 10.5]
[ 25, 25] OK

instead of A I write
multiply(x, 2.1, x, 1, CV_32F);

results are
[ 3, 3]
[ 5, 5]
[10.5, 10.5]
[430.5, 430.5]

May be a clone is missing or an exception must be thrown when dts=src but type is changed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions