Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf53bf4c

Browse files
committed
Report error for unsupported matching types in Match Template fn
Signed-off-by: Pradeep Garigipati <pradeep.garigipati@gmail.com>
1 parent60f0ba9 commitf53bf4c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎src/vision/mod.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,10 @@ where
501501
T:HasAfEnum +ImageFilterType,
502502
T::AbsOutType:HasAfEnum,
503503
{
504+
match mtype{
505+
MatchType::NCC |MatchType::ZNCC |MatchType::SHD =>HANDLE_ERROR(AfError::ERR_ARG),
506+
_ =>(),// Do nothing valid matching type
507+
};
504508
unsafe{
505509
letmut temp:af_array = std::ptr::null_mut();
506510
let err_val =af_match_template(
@@ -670,3 +674,19 @@ where
670674
(temp.into(), inliers)
671675
}
672676
}
677+
678+
#[cfg(test)]
679+
mod tests{
680+
usecrate::randu;
681+
682+
#[test]
683+
#[should_panic]
684+
fncheck_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+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp