@@ -613,6 +613,8 @@ class CV_WarpPerspectiveTest : public CV_ImgWarpBaseTest
613613 int prepare_test_case ( int test_case_idx );
614614 void prepare_to_validation ( int /* test_case_idx*/ );
615615 double get_success_error_level ( int test_case_idx, int i, int j );
616+
617+ int borderType;
616618};
617619
618620
@@ -636,21 +638,24 @@ void CV_WarpPerspectiveTest::get_test_array_types_and_sizes( int test_case_idx,
636638
637639void CV_WarpPerspectiveTest::run_func ()
638640{
639- CvMat mtx = cvMat ( test_mat[INPUT][ 1 ]) ;
640- cvWarpPerspective ( test_array [INPUT][0 ], test_array[INPUT_OUTPUT][ 0 ], &mtx , interpolation );
641+ Mat& dst = test_mat[INPUT_OUTPUT][ 0 ] ;
642+ cv::warpPerspective (test_mat [INPUT][0 ], dst, test_mat[INPUT][ 1 ], dst. size () , interpolation, borderType, Scalar::all ( 0 ) );
641643}
642644
643645
644646double CV_WarpPerspectiveTest::get_success_error_level ( int /* test_case_idx*/ , int /* i*/ , int /* j*/ )
645647{
646648 int depth = test_mat[INPUT][0 ].depth ();
647- return depth == CV_8U ? 16 : depth == CV_16U ? 1024 : 5e-2 ;
649+ return depth == CV_8U ? 16 : depth == CV_16U ? 1024 : 0.13 ;
648650}
649651
650652
651653int CV_WarpPerspectiveTest::prepare_test_case ( int test_case_idx )
652654{
653655 RNG& rng = ts->get_rng ();
656+
657+ // only these two borders are declared as supported
658+ borderType = rng () % 2 ? BORDER_REPLICATE : BORDER_CONSTANT;
654659 int code = CV_ImgWarpBaseTest::prepare_test_case ( test_case_idx );
655660 const CvMat src = cvMat (test_mat[INPUT][0 ]);
656661 const CvMat dst = cvMat (test_mat[INPUT_OUTPUT][0 ]);
@@ -720,7 +725,7 @@ void CV_WarpPerspectiveTest::prepare_to_validation( int /*test_case_idx*/ )
720725 }
721726
722727 Mat mask ( dst.size (), CV_8U );
723- test_remap ( src, dst, mapx, mapy, &mask );
728+ test_remap ( src, dst, mapx, mapy, &mask, interpolation );
724729 dst.setTo (Scalar::all (0 ), mask);
725730 dst0.setTo (Scalar::all (0 ), mask);
726731}
0 commit comments