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

Commit 678363d

Browse files
committed
fix: enhance generic fm script
1 parent c7fb312 commit 678363d

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

scripts/featureMatching/featureMatchingTest.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@ import {
1212
getBestKeypointsInRadius,
1313
} from '../../src/featureMatching';
1414
import { ImageColorModel, readSync, writeSync } from '../../src';
15-
import { getBrief } from './getBrief';
15+
import { getBrief, GetBriefOptions } from './getBrief';
1616
import { GetColorsOptions } from '../../src/featureMatching/utils/getColors';
1717
import { getMinMax } from '../../src/utils/getMinMax';
1818

1919
import util from 'util';
2020
import { sliceBrief } from './sliceBrief';
2121
util.inspect.defaultOptions.depth = 5;
2222

23-
const getBriefOptions = {
24-
windowSize: 31,
23+
const getBriefOptions: GetBriefOptions = {
24+
centroidPatchDiameter: 31,
2525
bestKptRadius: 5,
2626
};
2727

2828
let source = readSync('../../test/img/featureMatching/crop1.png').convertColor(
2929
ImageColorModel.GREY,
3030
);
31+
// fix contrast
3132
const sourceExtremums = getMinMax(source);
3233
source.level({
3334
inputMin: sourceExtremums.min[0],
@@ -38,6 +39,7 @@ source.level({
3839
let destination = readSync(
3940
'../../test/img/featureMatching/crop3.png',
4041
).convertColor(ImageColorModel.GREY);
42+
// fix contrast
4143
const destinationExtremums = getMinMax(destination);
4244
destination.level({
4345
inputMin: destinationExtremums.min[0],
@@ -104,6 +106,7 @@ montage.drawMatches(
104106
{
105107
showDistance: true,
106108
color: [255, 0, 0],
109+
circleDiameter: getBriefOptions.centroidPatchDiameter,
107110
showDistanceOptions,
108111
},
109112
);
@@ -115,6 +118,7 @@ montage.drawMatches(
115118
{
116119
showDistance: true,
117120
color: [0, 0, 255],
121+
circleDiameter: getBriefOptions.centroidPatchDiameter,
118122
showDistanceOptions,
119123
},
120124
);

scripts/featureMatching/getBrief.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
import { getOrientedFastKeypoints } from '../../src/featureMatching/keypoints/getOrientedFastKeypoints';
88

99
export interface GetBriefOptions {
10-
windowSize?: number;
10+
centroidPatchDiameter?: number;
1111
bestKptRadius?: number;
1212
minScore?: number;
1313
}
@@ -21,9 +21,9 @@ export interface GetBriefOptions {
2121
* @returns The Brief.
2222
*/
2323
export function getBrief(image: Image, options: GetBriefOptions = {}): Brief {
24-
const { windowSize = 15, bestKptRadius = 10, minScore } = options;
24+
const { centroidPatchDiameter = 15, bestKptRadius = 10, minScore } = options;
2525
const allSourceKeypoints = getOrientedFastKeypoints(image, {
26-
windowSize,
26+
centroidPatchDiameter,
2727
});
2828
let sourceKeypoints = getBestKeypointsInRadius(
2929
allSourceKeypoints,

scripts/featureMatching/result.png

608 Bytes
Loading

0 commit comments

Comments
 (0)