image-js
Version:
Image processing and manipulation in JavaScript
29 lines • 1.23 kB
JavaScript
import { getBestKeypointsInRadius } from '../keypoints/getBestKeypointsInRadius.js';
import { getOrientedFastKeypoints } from '../keypoints/getOrientedFastKeypoints.js';
import { getBriefDescriptors } from './getBriefDescriptors.js';
/**
* Get the keypoints and corresponding descriptors for an image.
* @param image - Image to process.
* @param options - Get brief options.
* @returns The Brief (keypoints and corresponding descriptors).
*/
export function getBrief(image, options = {}) {
const { centroidPatchDiameter = 15, bestKptRadius = 10, minScore } = options;
const allSourceKeypoints = getOrientedFastKeypoints(image, {
centroidPatchDiameter,
});
const sourceKeypoints = getBestKeypointsInRadius(allSourceKeypoints, bestKptRadius);
const brief = getBriefDescriptors(image, sourceKeypoints);
if (minScore) {
for (let i = 0; i < brief.keypoints.length; i++) {
if (brief.keypoints[i].score < minScore) {
return {
keypoints: brief.keypoints.slice(0, i - 1),
descriptors: brief.descriptors.slice(0, i - 1),
};
}
}
}
return brief;
}
//# sourceMappingURL=getBrief.js.map