image-js
Version:
Image processing and manipulation in JavaScript
17 lines • 630 B
JavaScript
/**
* Slice a Brief to keep only the desired keypoints and the corresponding descriptors.
* @param brief - Brief to process.
* @param options - Slice Brief options.
* @returns The desired keypoints + descriptors.
*/
export function sliceBrief(brief, options = {}) {
const { start = 0, end = brief.keypoints.length } = options;
if (start < 0 || end > brief.keypoints.length) {
throw new RangeError('start or end are out of range');
}
return {
keypoints: brief.keypoints.slice(start, end),
descriptors: brief.descriptors.slice(start, end),
};
}
//# sourceMappingURL=sliceBrief.js.map