Mixing Matx and Mat in cv::add results in an error (Bug #2336)


Added by Reto Grieder over 12 years ago. Updated over 12 years ago.


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

0%

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

Description

When mixing cv::Mat and cv::Matx for the source arguments in cv::add, OpenCV complains about not being to do the operation even though it should be possible.

A short example with 3x3 matrices should explain it quite well.

Error:
cv::add(cv::Mat(3, 3, CV_32F), cv::Matx33f(), cv::Matx33f());
Works (surrounded 2nd argument with cv::Mat)
cv::add(cv::Mat(3, 3, CV_32F), cv::Mat(cv::Matx33f()), cv::Matx33f());
Works too (not mixing src1 and src2)
cv::add(cv::Matx33f(), cv::Matx33f(), cv::Matx33f());

The problem seems to be that the arithm_op function is fine when the source kinds are equal, but does a wrong check otherwise and complains as soon as one of the input matrices is of type MatX.


Associated revisions

Revision 1ded1597
Added by Vadim Pisarevsky over 12 years ago

fixed mixed-type array operations (bug #2336)

Revision 3542da71
Added by Roman Donchenko about 11 years ago

Merge pull request #2336 from SpecLad:useOclChanged

History

Updated by Reto Grieder over 12 years ago

Forgot to mention: OpenCV 2.4.2, running on Windows and iOS (same problem).

Updated by Alexander Shishkov over 12 years ago

  • Category set to core
  • Description changed from When mixing cv::Mat and cv::Matx for the source arguments in cv::add, OpenCV ... to When mixing cv::Mat and cv::Matx for the source arguments in cv::add, OpenCV ... More

Updated by Reto Grieder over 12 years ago

For starters, I believe the query (kind1 == kind2) on line 1227 in arithm.cpp to be insufficient because it shouldn't make a difference whether the input is cv::Mat or cv::Matx as long as a matrix header can be derived.

Updated by Vadim Pisarevsky over 12 years ago

thanks! the bug was fixed in commmit:1ded15

  • Status changed from Open to Done
  • Target version set to 2.4.3
  • Assignee set to Vadim Pisarevsky

Also available in: Atom PDF