File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
use std:: path:: PathBuf ;
4
4
5
- use opencv:: core:: Size ;
5
+ use opencv:: core:: { Size , NORM_HAMMING , no_array } ;
6
6
use opencv:: prelude:: * ;
7
7
use opencv:: types:: VectorOfKeyPoint ;
8
8
use opencv:: { features2d, imgcodecs, Result } ;
@@ -45,17 +45,11 @@ fn orb_bruteforce_match() -> Result<()> {
45
45
assert_eq ! ( size, kp_b. len( ) ) ;
46
46
assert_eq ! ( Size :: new( 32 , size as i32 ) , des_b. size( ) ?) ;
47
47
48
- let mut bf_matcher = features2d:: BFMatcher :: create ( NORM_HAMMING , true ) . unwrap ( ) ;
49
-
50
- // Match descriptors
51
- let mut query_descriptors: Vector < Mat > = Vector :: new ( ) ;
52
- query_descriptors. push ( des_a) ;
53
- query_descriptors. push ( des_b) ;
48
+ let bf_matcher = features2d:: BFMatcher :: create ( NORM_HAMMING , true ) . unwrap ( ) ;
54
49
55
50
let mut matches = opencv:: types:: VectorOfDMatch :: new ( ) ;
56
- bf_matcher. match_ ( & query_descriptors , & mut matches, & no_array ( ) ) . unwrap ( ) ;
51
+ bf_matcher. train_match ( & des_a , & des_b , & mut matches, & no_array ( ) ) . unwrap ( ) ;
57
52
58
53
assert_ne ! ( matches. len( ) , 0 ) ; // expected many matches since images are equal
59
- println ! ( "Match {:?}" , matches) ;
60
54
Ok ( ( ) )
61
55
}
You can’t perform that action at this time.
0 commit comments