mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 15:23:05 +04:00
Merge pull request #13928 from catree:add_matx_div_operations
This commit is contained in:
@@ -69,6 +69,8 @@ protected:
|
||||
bool TestVec();
|
||||
bool TestMatxMultiplication();
|
||||
bool TestMatxElementwiseDivison();
|
||||
bool TestDivisionByValue();
|
||||
bool TestInplaceDivisionByValue();
|
||||
bool TestMatMatxCastSum();
|
||||
bool TestSubMatAccess();
|
||||
bool TestExp();
|
||||
@@ -976,6 +978,50 @@ bool CV_OperationsTest::TestMatxElementwiseDivison()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CV_OperationsTest::TestDivisionByValue()
|
||||
{
|
||||
try
|
||||
{
|
||||
Matx22f mat(2, 4, 6, 8);
|
||||
float alpha = 2.f;
|
||||
|
||||
Matx22f res = mat / alpha;
|
||||
|
||||
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::TestInplaceDivisionByValue()
|
||||
{
|
||||
try
|
||||
{
|
||||
Matx22f mat(2, 4, 6, 8);
|
||||
float alpha = 2.f;
|
||||
|
||||
mat /= alpha;
|
||||
|
||||
if(mat(0, 0) != 1.0) throw test_excep();
|
||||
if(mat(0, 1) != 2.0) throw test_excep();
|
||||
if(mat(1, 0) != 3.0) throw test_excep();
|
||||
if(mat(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()
|
||||
{
|
||||
@@ -1204,6 +1250,12 @@ void CV_OperationsTest::run( int /* start_from */)
|
||||
if (!TestMatxElementwiseDivison())
|
||||
return;
|
||||
|
||||
if (!TestDivisionByValue())
|
||||
return;
|
||||
|
||||
if (!TestInplaceDivisionByValue())
|
||||
return;
|
||||
|
||||
if (!TestMatMatxCastSum())
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user