File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -501,6 +501,10 @@ where
501
501
T : HasAfEnum + ImageFilterType ,
502
502
T :: AbsOutType : HasAfEnum ,
503
503
{
504
+ match mtype {
505
+ MatchType :: NCC | MatchType :: ZNCC | MatchType :: SHD => HANDLE_ERROR ( AfError :: ERR_ARG ) ,
506
+ _ => ( ) , // Do nothing valid matching type
507
+ } ;
504
508
unsafe {
505
509
let mut temp: af_array = std:: ptr:: null_mut ( ) ;
506
510
let err_val = af_match_template (
@@ -670,3 +674,19 @@ where
670
674
( temp. into ( ) , inliers)
671
675
}
672
676
}
677
+
678
+ #[ cfg( test) ]
679
+ mod tests {
680
+ use crate :: randu;
681
+
682
+ #[ test]
683
+ #[ should_panic]
684
+ fn check_invalid_matchtype ( ) {
685
+ crate :: core:: set_device ( 0 ) ;
686
+ let a = randu ! ( f32 ; 10 , 10 ) ;
687
+ let b = randu ! ( f32 ; 2 , 2 ) ;
688
+ super :: match_template ( & a, & b, crate :: MatchType :: NCC ) ;
689
+ super :: match_template ( & a, & b, crate :: MatchType :: ZNCC ) ;
690
+ super :: match_template ( & a, & b, crate :: MatchType :: SHD ) ;
691
+ }
692
+ }
You can’t perform that action at this time.
0 commit comments