Skip to content

core(MatExpr): .type() implementation bug #16655

@alalek

Description

@alalek

MatExpr::type() may ignore channels.

Test code:

Mat a(Size(5, 5), CV_32FC3, Scalar::all(1));
Mat b(Size(5, 5), CV_32FC3, Scalar::all(2));
MatExpr ab_expr = a != b;
Mat ab_mat = ab_expr;
EXPECT_EQ(CV_8UC3, ab_expr.type())
    << "MatExpr: CV_8UC3 != " << typeToString(ab_expr.type());
EXPECT_EQ(CV_8UC3, ab_mat.type())
    << "Mat: CV_8UC3 != " << typeToString(ab_mat.type());

Output (OpenCV 3.4.9-dev):

Failure
Expected equality of these values:
  (((0) & ((1 << 3) - 1)) + (((3)-1) << 3))
    Which is: 16
  ab_expr.type()
    Which is: 0
MatExpr: CV_8UC3 != CV_8UC1

exploded by #16653 and improper test code (dnn:imagesFromBlob.Regression).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions