@@ -4,7 +4,7 @@ import { drawMatches } from '../drawMatches';
4
4
import { getBriefDescriptors } from '../getBriefDescriptors' ;
5
5
import { getOrientedFastKeypoints } from '../getOrientedFastKeypoints' ;
6
6
7
- test ( 'alphabet image as source and destination' , ( ) => {
7
+ test ( 'alphabet image as source and destination, nbKeypoint = 10 ' , ( ) => {
8
8
const source = testUtils . load ( 'various/alphabet.jpg' ) ;
9
9
const grey = source . convertColor ( ImageColorModel . GREY ) ;
10
10
const sourceKeypoints = getOrientedFastKeypoints ( grey , { maxNbFeatures : 10 } ) ;
@@ -33,17 +33,50 @@ test('alphabet image as source and destination', () => {
33
33
expect ( result ) . toMatchImageSnapshot ( ) ;
34
34
} ) ;
35
35
36
- test ( 'destination rotated' , ( ) => {
37
- const source = testUtils . load ( 'various/alphabet.jpg' ) ;
36
+ test ( 'destination rotated +2°' , ( ) => {
37
+ const source = testUtils
38
+ . load ( 'featureMatching/alphabet.jpg' )
39
+ . convertColor ( ImageColorModel . GREY ) ;
40
+ const sourceKeypoints = getOrientedFastKeypoints ( source ) ;
41
+ const sourceDescriptors = getBriefDescriptors ( source , sourceKeypoints ) ;
42
+
43
+ const destination = testUtils
44
+ . load ( 'featureMatching/alphabetRotated2.jpg' )
45
+ . convertColor ( ImageColorModel . GREY ) ;
46
+ const destinationKeypoints = getOrientedFastKeypoints ( destination ) ;
47
+ const destinationDescriptors = getBriefDescriptors (
48
+ destination ,
49
+ destinationKeypoints ,
50
+ ) ;
51
+ expect ( sourceKeypoints . length ) . toBe ( 119 ) ;
52
+ expect ( destinationKeypoints . length ) . toBe ( 135 ) ;
53
+
54
+ const matches = bruteForceOneMatch (
55
+ sourceDescriptors ,
56
+ destinationDescriptors ,
57
+ { nbBestMatches : 20 } ,
58
+ ) ;
59
+
60
+ const result = drawMatches (
61
+ source ,
62
+ destination ,
63
+ sourceKeypoints ,
64
+ destinationKeypoints ,
65
+ matches ,
66
+ { showScore : true } ,
67
+ ) ;
68
+
69
+ expect ( result ) . toMatchImageSnapshot ( ) ;
70
+ } ) ;
71
+
72
+ test ( 'destination rotated +10°' , ( ) => {
73
+ const source = testUtils . load ( 'featureMatching/alphabet.jpg' ) ;
38
74
const grey = source . convertColor ( ImageColorModel . GREY ) ;
39
75
const sourceKeypoints = getOrientedFastKeypoints ( grey ) ;
40
76
const sourceDescriptors = getBriefDescriptors ( grey , sourceKeypoints ) ;
41
77
42
- const destination = testUtils
43
- . load ( 'various/alphabet.jpg' )
44
- . rotate ( 10 , { fullImage : true } ) ;
78
+ const destination = testUtils . load ( 'featureMatching/alphabetRotated10.jpg' ) ;
45
79
const grey2 = destination . convertColor ( ImageColorModel . GREY ) ;
46
-
47
80
const destinationKeypoints = getOrientedFastKeypoints ( grey2 ) ;
48
81
const destinationDescriptors = getBriefDescriptors (
49
82
grey2 ,
0 commit comments