Problem with MatExpr (A x B.t).t (Bug #2106)


Added by nemerle - over 12 years ago. Updated over 12 years ago.


Status:Done Start date:2012-06-27
Priority:Normal Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:core
Target version:2.4.2
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

The following code:

void testMe()
{ 
    cv::Mat1f a(2,2);
    cv::Mat1f b(1,2);
    cv::Mat1f c = (a*b.t()).t();
}

causes assertion failure:

OpenCV Error: Assertion failed (a_size.height == len) in gemm, file .../dev/Ai/opencv/modules/core/src/matmul.cpp, line 723

Am I expecting too much from MatExpr and should assign a*b.t() to a temporary ?


Associated revisions

Revision d60b1f2f
Added by Vadim Pisarevsky over 12 years ago

fixed bug #2106; added test

Revision 7acea487
Added by Roman Donchenko about 11 years ago

Merge pull request #2106 from robbertkl:patch-2

History

Updated by nemerle - over 12 years ago

If anyone else is having problems with this sequence of operations, using transpose of a matrix product transform
serves as a workaround
\(A x B).t => B.t x A.t

void testMeWorkaround()
{ 
    cv::Mat1f a(2,2);
    cv::Mat1f b(1,2);
    cv::Mat1f c = b*a.t(); // was (a*b.t()).t()
}

Updated by Vadim Pisarevsky over 12 years ago

thanks! fixed in r8808

  • Status changed from Open to Done

Updated by Andrey Kamaev over 12 years ago

  • Target version set to 2.4.2

Also available in: Atom PDF