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

Commit bf044f6

Browse files
committed
test: refactor FM test images
1 parent fabe579 commit bf044f6

22 files changed

+28
-29
lines changed

scripts/featureMatching/featureMatchingTest.ts

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

28-
let source = readSync('../../test/img/featureMatching/crop1.png').convertColor(
29-
ImageColorModel.GREY,
30-
);
28+
let source = readSync(
29+
'../../test/img/featureMatching/id-crops/crop1.png',
30+
).convertColor(ImageColorModel.GREY);
3131
// fix contrast
3232
const sourceExtremums = getMinMax(source);
3333
source.level({
@@ -37,7 +37,7 @@ source.level({
3737
});
3838

3939
let destination = readSync(
40-
'../../test/img/featureMatching/crop3.png',
40+
'../../test/img/featureMatching/id-crops/crop3.png',
4141
).convertColor(ImageColorModel.GREY);
4242
// fix contrast
4343
const destinationExtremums = getMinMax(destination);

scripts/generateFMtestImages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const basePath = join(__dirname, '../test/img/featureMatching/polygons');
99

1010
console.log(basePath);
1111

12-
const original = readSync(`${basePath}/scaleneTriangle.png`);
12+
const original = readSync(`${basePath}/betterScaleneTriangle.png`);
1313

14-
const angles = [10, 90, 180];
14+
const angles = [2, 10, 90, 180];
1515
for (let angle of angles) {
1616
const rotated = original.transformRotate(angle, { fullImage: true });
1717
writeSync(`${basePath}/scaleneTriangle${angle}.png`, rotated);
Loading
Loading
Loading

src/featureMatching/keypoints/__tests__/getOrientedFastKeypoints.test.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,14 @@ test('patch with one keypoint, centroidPatchDiameter=15', () => {
175175

176176
test.each([
177177
{
178-
message: 'betterScaleneTriangle',
179-
image: 'betterScaleneTriangle',
178+
message: 'scaleneTriangle',
179+
image: 'scaleneTriangle',
180180
},
181181
{
182-
message: 'betterScaleneTriangle90',
183-
image: 'betterScaleneTriangle90',
182+
message: 'scaleneTriangle90',
183+
image: 'scaleneTriangle90',
184184
},
185-
])('patchDiameter = 31 ($message)', (data) => {
185+
])('centroidPatchDiameter = 31 ($message)', (data) => {
186186
const centroidPatchDiameter = 31;
187187

188188
const image = testUtils
@@ -213,7 +213,7 @@ test('verify single keypoint orientation', () => {
213213
const centroidPatchDiameter = 31;
214214

215215
const origialImage = testUtils
216-
.load('featureMatching/polygons/betterScaleneTriangle.png')
216+
.load('featureMatching/polygons/scaleneTriangle.png')
217217
.convertColor(ImageColorModel.GREY)
218218
.invert();
219219

@@ -237,7 +237,7 @@ test('verify single keypoint orientation', () => {
237237
test('small patchsize and large marker', () => {
238238
// this test shows that the orientation is not good when the centroidPatchDiameter is too small
239239
// ideally we should use the same patch size for orientation and descriptors (getKeypointPatch)
240-
const origin = { row: 730, column: 291 };
240+
const origin = { row: 868, column: 332 };
241241
const size = 51;
242242
const radius = (size - 1) / 2;
243243

@@ -249,7 +249,7 @@ test('small patchsize and large marker', () => {
249249
const centroidPatchDiameter = 7;
250250

251251
const origialImage = testUtils
252-
.load('featureMatching/polygons/betterScaleneTriangle90.png')
252+
.load('featureMatching/polygons/scaleneTriangle90.png')
253253
.convertColor(ImageColorModel.GREY)
254254
.invert();
255255

@@ -270,7 +270,8 @@ test('small patchsize and large marker', () => {
270270
expect(result).toMatchImageSnapshot();
271271
});
272272

273-
test('check angle for different windowSize', () => {
273+
test('check angle for different centroidPatchDiameter', () => {
274+
// we can see the impact of patch size on the orientation
274275
const image = testUtils
275276
.load('featureMatching/polygons/scaleneTriangle10.png')
276277
.convertColor(ImageColorModel.GREY)
@@ -284,5 +285,5 @@ test('check angle for different windowSize', () => {
284285
centroidPatchDiameter: 31,
285286
})[0].angle;
286287

287-
expect([angle77, angle15, angle31]).toBeDeepCloseTo([69.81, 62.84, 61.79], 0);
288+
expect([angle15, angle31, angle77]).toBeDeepCloseTo([5.15, 3.64, 9.71], 0);
288289
});

0 commit comments

Comments
 (0)