Operator * doesn't do multiplication for two cv::Mat Objects (Bug #2498)


Added by Mohammed Manna over 12 years ago. Updated over 12 years ago.


Status:Cancelled Start date:2012-10-31
Priority:Low Due date:
Assignee:Alexander Shishkov % Done:

0%

Category:trash
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Operator * doesn't work for matrix multiplication.
Please see the source file attached to verify.

I will appreciate a response to why this is not working....A discussion in Stackoverflow was raised under thread no. 13119314
http://stackoverflow.com/questions/13130864/re-13119414-matrix-multiplication-using-cvmat

Kind Regards,


MatMult.cpp - Matrisx Multiplication Doesn't Work (901 Bytes) Mohammed Manna, 2012-10-31 07:04 pm


Associated revisions

Revision 5effebb5
Added by Roman Donchenko almost 11 years ago

Merge pull request #2498 from dreamworld:fix_tutorial_mat_the_basic_image_container

History

Updated by Alexander Shishkov over 12 years ago

    int p[4] = {3,1,2,4};
    cv::Mat testMat = cv::Mat(1,4,CV_32S,p);
    std::cout << testMat << std::endl; // Doesn't show the correct result
    std::cout << testMat.at<unsigned int>(3) << std::endl; // Displays 4

    //cv::Mat resDot = testMat*(testMat.t());
    cv::Mat testMatTransp(testMat.t());
    std::cout << testMatTransp << std::endl; // Doesn't display correct result

    cv::MatExpr multRes = testMat.mul(testMat);
    std::cout << "dot product result = " << multRes << std::endl;
    cv::Mat tMf;
    testMat.convertTo(tMf, CV_32F);
    std::cout << "product result = " << tMf*tMf.t() << std::endl;
    std::cout << "continous blocks ? " << testMat.isContinuous() << std::endl;
>>>>>
[3, 1, 2, 4]
4
[3; 1; 2; 4]
dot product result = [9, 1, 4, 16]
product result = [30]
continous blocks ? 1
  • Category set to trash
  • Assignee set to Alexander Shishkov
  • Priority changed from Normal to Low
  • Status changed from Open to Cancelled

Also available in: Atom PDF