Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 57597df

Browse files
committed
test: id crops work pretty well
1 parent e8a520d commit 57597df

File tree

7 files changed

+25
-28
lines changed

7 files changed

+25
-28
lines changed

scripts/featureMatching/featureMatchingTest.ts

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ const getBriefOptions: GetBriefOptions = {
2525
bestKptRadius: 5,
2626
};
2727

28+
const firstNumber = 1;
29+
const secondNumber = 2;
30+
2831
let source = readSync(
29-
'../../test/img/featureMatching/id-crops/crop1.png',
32+
`../../test/img/featureMatching/id-crops/crop${firstNumber}.png`,
3033
).convertColor(ImageColorModel.GREY);
3134
// fix contrast
3235
const sourceExtremums = getMinMax(source);
@@ -37,7 +40,7 @@ source.level({
3740
});
3841

3942
let destination = readSync(
40-
'../../test/img/featureMatching/id-crops/crop3.png',
43+
`../../test/img/featureMatching/id-crops/crop${secondNumber}.png`,
4144
).convertColor(ImageColorModel.GREY);
4245
// fix contrast
4346
const destinationExtremums = getMinMax(destination);
@@ -52,16 +55,10 @@ console.log({
5255
destination: { width: destination.width, height: destination.height },
5356
});
5457

55-
const sliceBriefOptions = { start: 0, end: 20 };
58+
const sliceBriefOptions = { start: 0, end: 15 };
5659

57-
const sourceBrief = sliceBrief(
58-
getBrief(source, getBriefOptions),
59-
sliceBriefOptions,
60-
);
61-
const destinationBrief = sliceBrief(
62-
getBrief(destination, getBriefOptions),
63-
sliceBriefOptions,
64-
);
60+
const sourceBrief = getBrief(source, getBriefOptions);
61+
const destinationBrief = getBrief(destination, getBriefOptions);
6562

6663
console.table(sourceBrief.keypoints);
6764

@@ -80,11 +77,11 @@ console.log({
8077
},
8178
});
8279

83-
const matches = bruteForceOneMatch(
84-
sourceBrief.descriptors,
85-
destinationBrief.descriptors,
86-
);
87-
console.log('nb matches: ' + matches.length);
80+
// const matches = bruteForceOneMatch(
81+
// sourceBrief.descriptors,
82+
// destinationBrief.descriptors,
83+
// );
84+
// console.log('nb matches: ' + matches.length);
8885

8986
const crossMatches = getCrosscheckMatches(
9087
sourceBrief.descriptors,
@@ -99,17 +96,17 @@ const montage = new Montage(source, destination, {
9996

10097
const showDistanceOptions: GetColorsOptions = { minValueFactor: 0.2 };
10198

102-
montage.drawMatches(
103-
matches,
104-
sourceBrief.keypoints,
105-
destinationBrief.keypoints,
106-
{
107-
showDistance: true,
108-
color: [255, 0, 0],
109-
circleDiameter: getBriefOptions.centroidPatchDiameter,
110-
showDistanceOptions,
111-
},
112-
);
99+
// montage.drawMatches(
100+
// matches,
101+
// sourceBrief.keypoints,
102+
// destinationBrief.keypoints,
103+
// {
104+
// showDistance: true,
105+
// color: [255, 0, 0],
106+
// circleDiameter: getBriefOptions.centroidPatchDiameter,
107+
// showDistanceOptions,
108+
// },
109+
// );
113110

114111
montage.drawMatches(
115112
crossMatches,
@@ -136,6 +133,6 @@ montage.drawKeypoints(destinationBrief.keypoints, {
136133
origin: montage.destinationOrigin,
137134
});
138135

139-
writeSync('./result.png', montage.image);
136+
writeSync(`./results/result-${firstNumber}-${secondNumber}.png`, montage.image);
140137

141138
console.log('IMAGE WRITTEN TO DISK');

scripts/featureMatching/result.png

-173 KB
Binary file not shown.
160 KB
Loading
173 KB
Loading
161 KB
Loading
148 KB
Loading
159 KB
Loading

0 commit comments

Comments
 (0)