support elementwise division for Matx with "/" operator.

This commit is contained in:
Vikas Dhiman
2013-06-14 11:38:29 -04:00
parent 6faf00b8e5
commit dbc9b4db0c
2 changed files with 39 additions and 1 deletions

View File

@@ -75,6 +75,7 @@ protected:
bool TestSparseMat();
bool TestVec();
bool TestMatxMultiplication();
bool TestMatxElementwiseDivison();
bool TestSubMatAccess();
bool TestExp();
bool TestSVD();
@@ -891,6 +892,28 @@ bool CV_OperationsTest::TestMatxMultiplication()
return true;
}
bool CV_OperationsTest::TestMatxElementwiseDivison()
{
try
{
Matx22f mat(2, 4, 6, 8); // Identity matrix
Matx22f mat2(2, 2, 2, 2);
Matx22f res = mat / mat2;
if(res(0, 0) != 1.0) throw test_excep();
if(res(0, 1) != 2.0) throw test_excep();
if(res(1, 0) != 3.0) throw test_excep();
if(res(1, 1) != 4.0) throw test_excep();
}
catch(const test_excep&)
{
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_OUTPUT);
return false;
}
return true;
}
bool CV_OperationsTest::TestVec()
{